1a06e9158STyler Dauwalder// MimeSnifferTest.cpp
2a06e9158STyler Dauwalder
3155b583aSIngo Weinhold#include "MimeSnifferTest.h"
4155b583aSIngo Weinhold
5a06e9158STyler Dauwalder#include <cppunit/Test.h>
6a06e9158STyler Dauwalder#include <cppunit/TestSuite.h>
7a06e9158STyler Dauwalder#include <cppunit/TestCaller.h>
8b657eab3STyler Dauwalder#include <sniffer/Rule.h>
9a06e9158STyler Dauwalder#include <sniffer/Parser.h>
10b657eab3STyler Dauwalder#include <DataIO.h>
11a06e9158STyler Dauwalder#include <Mime.h>
12a06e9158STyler Dauwalder#include <String.h>		// BString
13a06e9158STyler Dauwalder#include <TestUtils.h>
14a06e9158STyler Dauwalder
150b6140dcSTyler Dauwalder#include <stdio.h>
1677aa0e2aSOliver Tappe
1777aa0e2aSOliver Tappe#include <iostream>
1877aa0e2aSOliver Tappeusing std::cout;
1977aa0e2aSOliver Tappeusing std::endl;
200b6140dcSTyler Dauwalder
2109d84e61STyler Dauwalderusing namespace BPrivate::Storage::Sniffer;
22a06e9158STyler Dauwalder
23a06e9158STyler Dauwalder// Suite
24a06e9158STyler DauwalderCppUnit::Test*
25a06e9158STyler DauwalderMimeSnifferTest::Suite() {
26a06e9158STyler Dauwalder	CppUnit::TestSuite *suite = new CppUnit::TestSuite();
27a06e9158STyler Dauwalder	typedef CppUnit::TestCaller<MimeSnifferTest> TC;
28a06e9158STyler Dauwalder
29a06e9158STyler Dauwalder	suite->addTest( new TC("Mime Sniffer::Scanner Test",
30a06e9158STyler Dauwalder						   &MimeSnifferTest::ScannerTest) );
31a06e9158STyler Dauwalder	suite->addTest( new TC("Mime Sniffer::Parser Test",
32a06e9158STyler Dauwalder						   &MimeSnifferTest::ParserTest) );
33b657eab3STyler Dauwalder	suite->addTest( new TC("Mime Sniffer::Sniffer Test",
34b657eab3STyler Dauwalder						   &MimeSnifferTest::SnifferTest) );
35a06e9158STyler Dauwalder
36a06e9158STyler Dauwalder	return suite;
37a06e9158STyler Dauwalder}
38a06e9158STyler Dauwalder
39a06e9158STyler Dauwalder// Scanner Test
40a06e9158STyler Dauwaldervoid
41a06e9158STyler DauwalderMimeSnifferTest::ScannerTest() {
42a06e9158STyler Dauwalder#if TEST_R5
43a06e9158STyler Dauwalder	Outputf("(no tests actually performed for R5 version)\n");
44a06e9158STyler Dauwalder#else	// TEST_R5
45a06e9158STyler Dauwalder
46a06e9158STyler Dauwalder
47a06e9158STyler Dauwalder	// tests:
48a06e9158STyler Dauwalder	// Internal TokenStream and CharStream classes
49a06e9158STyler Dauwalder
50a06e9158STyler Dauwalder// Define some useful macros for dynamically allocating
51a06e9158STyler Dauwalder// various Token classes
52a06e9158STyler Dauwalder#define T(type) (new Token(type, -1))
53a06e9158STyler Dauwalder#define S(str) (new StringToken(str, -1))
54a06e9158STyler Dauwalder#define I(val) (new IntToken(val, -1))
55a06e9158STyler Dauwalder#define F(val) (new FloatToken(val, -1))
56a06e9158STyler Dauwalder
57a06e9158STyler Dauwalder	struct test_case {
58a06e9158STyler Dauwalder		const char *rule;
59a06e9158STyler Dauwalder		int tokenCount;
60a06e9158STyler Dauwalder		Token *tokens[256];
61a06e9158STyler Dauwalder	} testCases[] = {
62a06e9158STyler Dauwalder		{ "'Hey'[]:", 4,
63a06e9158STyler Dauwalder			{	S("Hey"),
64a06e9158STyler Dauwalder				T(LeftBracket),
65a06e9158STyler Dauwalder				T(RightBracket),
66a06e9158STyler Dauwalder				T(Colon)
67a06e9158STyler Dauwalder			}
68a06e9158STyler Dauwalder		},
69a06e9158STyler Dauwalder		{ "1", 1, { I(1) } },
70a06e9158STyler Dauwalder		{ "1.0", 1, { F(1.0) } },
71a06e9158STyler Dauwalder
72a06e9158STyler Dauwalder		{ "1.0 (\"ABCD\")", 4, { F(1.0), T(LeftParen), S("ABCD"), T(RightParen) } },
73a06e9158STyler Dauwalder		{ "1.0 ('ABCD')", 4, { F(1.0), T(LeftParen), S("ABCD"), T(RightParen) } },
74a06e9158STyler Dauwalder		{ "  1.0 ('ABCD')  ", 4, { F(1.0), T(LeftParen), S("ABCD"), T(RightParen) } },
75a06e9158STyler Dauwalder		{ "0.8 [0:3] ('ABCDEFG' | 'abcdefghij')", 11,
76a06e9158STyler Dauwalder			{	F(0.8),
77a06e9158STyler Dauwalder				T(LeftBracket),
78a06e9158STyler Dauwalder				I(0),
79a06e9158STyler Dauwalder				T(Colon),
80a06e9158STyler Dauwalder				I(3),
81a06e9158STyler Dauwalder				T(RightBracket),
82a06e9158STyler Dauwalder				T(LeftParen),
83a06e9158STyler Dauwalder				S("ABCDEFG"),
84a06e9158STyler Dauwalder				T(Divider),
85a06e9158STyler Dauwalder				S("abcdefghij"),
86a06e9158STyler Dauwalder				T(RightParen)
87a06e9158STyler Dauwalder			}
88a06e9158STyler Dauwalder		},
89a06e9158STyler Dauwalder		{ "0.5([10]'ABCD'|[17]'abcd'|[13]'EFGH')", 17,
90a06e9158STyler Dauwalder			{	F(0.5),
91a06e9158STyler Dauwalder				T(LeftParen),
92a06e9158STyler Dauwalder				T(LeftBracket),
93a06e9158STyler Dauwalder				I(10),
94a06e9158STyler Dauwalder				T(RightBracket),
95a06e9158STyler Dauwalder				S("ABCD"),
96a06e9158STyler Dauwalder				T(Divider),
97a06e9158STyler Dauwalder				T(LeftBracket),
98a06e9158STyler Dauwalder				I(17),
99a06e9158STyler Dauwalder				T(RightBracket),
100a06e9158STyler Dauwalder				S("abcd"),
101a06e9158STyler Dauwalder				T(Divider),
102a06e9158STyler Dauwalder				T(LeftBracket),
103a06e9158STyler Dauwalder				I(13),
104a06e9158STyler Dauwalder				T(RightBracket),
105a06e9158STyler Dauwalder				S("EFGH"),
106a06e9158STyler Dauwalder				T(RightParen)
107a06e9158STyler Dauwalder			}
108a06e9158STyler Dauwalder		},
109a06e9158STyler Dauwalder		{ "0.5  \n   [0:3]  \t ('ABCD' \n | 'abcd' | 'EFGH')", 13,
110a06e9158STyler Dauwalder			{	F(0.5),
111a06e9158STyler Dauwalder				T(LeftBracket),
112a06e9158STyler Dauwalder				I(0),
113a06e9158STyler Dauwalder				T(Colon),
114a06e9158STyler Dauwalder				I(3),
115a06e9158STyler Dauwalder				T(RightBracket),
116a06e9158STyler Dauwalder				T(LeftParen),
117a06e9158STyler Dauwalder				S("ABCD"),
118a06e9158STyler Dauwalder				T(Divider),
119a06e9158STyler Dauwalder				S("abcd"),
120a06e9158STyler Dauwalder				T(Divider),
121a06e9158STyler Dauwalder				S("EFGH"),
122a06e9158STyler Dauwalder				T(RightParen)
123a06e9158STyler Dauwalder			}
124a06e9158STyler Dauwalder		},
125a06e9158STyler Dauwalder		{ "0.8 [  0  :  3  ] ('ABCDEFG' | 'abcdefghij')", 11,
126a06e9158STyler Dauwalder			{	F(0.8),
127a06e9158STyler Dauwalder				T(LeftBracket),
128a06e9158STyler Dauwalder				I(0),
129a06e9158STyler Dauwalder				T(Colon),
130a06e9158STyler Dauwalder				I(3),
131a06e9158STyler Dauwalder				T(RightBracket),
132a06e9158STyler Dauwalder				T(LeftParen),
133a06e9158STyler Dauwalder				S("ABCDEFG"),
134a06e9158STyler Dauwalder				T(Divider),
135a06e9158STyler Dauwalder				S("abcdefghij"),
136a06e9158STyler Dauwalder				T(RightParen)
137a06e9158STyler Dauwalder			}
138a06e9158STyler Dauwalder		},
139a06e9158STyler Dauwalder		{ "0.8 [0:3] ('ABCDEFG' & 'abcdefg')", 11,
140a06e9158STyler Dauwalder			{	F(0.8),
141a06e9158STyler Dauwalder				T(LeftBracket),
142a06e9158STyler Dauwalder				I(0),
143a06e9158STyler Dauwalder				T(Colon),
144a06e9158STyler Dauwalder				I(3),
145a06e9158STyler Dauwalder				T(RightBracket),
146a06e9158STyler Dauwalder				T(LeftParen),
147a06e9158STyler Dauwalder				S("ABCDEFG"),
148a06e9158STyler Dauwalder				T(Ampersand),
149a06e9158STyler Dauwalder				S("abcdefg"),
150a06e9158STyler Dauwalder				T(RightParen)
151a06e9158STyler Dauwalder			}
152a06e9158STyler Dauwalder		},
153a06e9158STyler Dauwalder		{ "1.0 ('ABCD') | ('EFGH')", 8,
154a06e9158STyler Dauwalder			{	F(1.0),
155a06e9158STyler Dauwalder				T(LeftParen),
156a06e9158STyler Dauwalder				S("ABCD"),
157a06e9158STyler Dauwalder				T(RightParen),
158a06e9158STyler Dauwalder				T(Divider),
159a06e9158STyler Dauwalder				T(LeftParen),
160a06e9158STyler Dauwalder				S("EFGH"),
161a06e9158STyler Dauwalder				T(RightParen)
162a06e9158STyler Dauwalder			}
163a06e9158STyler Dauwalder		},
164a06e9158STyler Dauwalder		{ "1.0 [0:3] ('ABCD') | [2:4] ('EFGH')", 18,
165a06e9158STyler Dauwalder			{	F(1.0),
166a06e9158STyler Dauwalder				T(LeftBracket),
167a06e9158STyler Dauwalder				I(0),
168a06e9158STyler Dauwalder				T(Colon),
169a06e9158STyler Dauwalder				I(3),
170a06e9158STyler Dauwalder				T(RightBracket),
171a06e9158STyler Dauwalder				T(LeftParen),
172a06e9158STyler Dauwalder				S("ABCD"),
173a06e9158STyler Dauwalder				T(RightParen),
174a06e9158STyler Dauwalder				T(Divider),
175a06e9158STyler Dauwalder				T(LeftBracket),
176a06e9158STyler Dauwalder				I(2),
177a06e9158STyler Dauwalder				T(Colon),
178a06e9158STyler Dauwalder				I(4),
179a06e9158STyler Dauwalder				T(RightBracket),
180a06e9158STyler Dauwalder				T(LeftParen),
181a06e9158STyler Dauwalder				S("EFGH"),
182a06e9158STyler Dauwalder				T(RightParen)
183a06e9158STyler Dauwalder			}
184a06e9158STyler Dauwalder		},
185a06e9158STyler Dauwalder		{ "0.8 [0:4] (\\077Mkj0x34 & 'abcdefgh')", 11,
186a06e9158STyler Dauwalder			{	F(0.8),
187a06e9158STyler Dauwalder				T(LeftBracket),
188a06e9158STyler Dauwalder				I(0),
189a06e9158STyler Dauwalder				T(Colon),
190a06e9158STyler Dauwalder				I(4),
191a06e9158STyler Dauwalder				T(RightBracket),
192a06e9158STyler Dauwalder				T(LeftParen),
193a06e9158STyler Dauwalder				S("\077Mkj0x34"),
194a06e9158STyler Dauwalder				T(Ampersand),
195a06e9158STyler Dauwalder				S("abcdefgh"),
196a06e9158STyler Dauwalder				T(RightParen)
197a06e9158STyler Dauwalder			}
198a06e9158STyler Dauwalder		},
199a06e9158STyler Dauwalder		{ "0.8 [0:4] (\\077Mkj\\x34 & 'abcdefgh')", 11,
200a06e9158STyler Dauwalder			{	F(0.8),
201a06e9158STyler Dauwalder				T(LeftBracket),
202a06e9158STyler Dauwalder				I(0),
203a06e9158STyler Dauwalder				T(Colon),
204a06e9158STyler Dauwalder				I(4),
205a06e9158STyler Dauwalder				T(RightBracket),
206a06e9158STyler Dauwalder				T(LeftParen),
207a06e9158STyler Dauwalder				S("\077Mkj\x34"),
208a06e9158STyler Dauwalder				T(Ampersand),
209a06e9158STyler Dauwalder				S("abcdefgh"),
210a06e9158STyler Dauwalder				T(RightParen)
211a06e9158STyler Dauwalder			}
212a06e9158STyler Dauwalder		},
213a06e9158STyler Dauwalder		{ "0.8 [0:3] (\\077034 & 'abcd')", 11,
214a06e9158STyler Dauwalder			{	F(0.8),
215a06e9158STyler Dauwalder				T(LeftBracket),
216a06e9158STyler Dauwalder				I(0),
217a06e9158STyler Dauwalder				T(Colon),
218a06e9158STyler Dauwalder				I(3),
219a06e9158STyler Dauwalder				T(RightBracket),
220a06e9158STyler Dauwalder				T(LeftParen),
221a06e9158STyler Dauwalder				S("\077034"),
222a06e9158STyler Dauwalder				T(Ampersand),
223a06e9158STyler Dauwalder				S("abcd"),
224a06e9158STyler Dauwalder				T(RightParen)
225a06e9158STyler Dauwalder			}
226a06e9158STyler Dauwalder		},
227a06e9158STyler Dauwalder		{ "0.8 [0:3] (\\077\\034 & 'ab')", 11,
228a06e9158STyler Dauwalder			{	F(0.8),
229a06e9158STyler Dauwalder				T(LeftBracket),
230a06e9158STyler Dauwalder				I(0),
231a06e9158STyler Dauwalder				T(Colon),
232a06e9158STyler Dauwalder				I(3),
233a06e9158STyler Dauwalder				T(RightBracket),
234a06e9158STyler Dauwalder				T(LeftParen),
235a06e9158STyler Dauwalder				S("\077\034"),
236a06e9158STyler Dauwalder				T(Ampersand),
237a06e9158STyler Dauwalder				S("ab"),
238a06e9158STyler Dauwalder				T(RightParen)
239a06e9158STyler Dauwalder			}
240a06e9158STyler Dauwalder		},
241a06e9158STyler Dauwalder		{ "0.8 [0:3] (\\77\\034 & 'ab')", 11,
242a06e9158STyler Dauwalder			{	F(0.8),
243a06e9158STyler Dauwalder				T(LeftBracket),
244a06e9158STyler Dauwalder				I(0),
245a06e9158STyler Dauwalder				T(Colon),
246a06e9158STyler Dauwalder				I(3),
247a06e9158STyler Dauwalder				T(RightBracket),
248a06e9158STyler Dauwalder				T(LeftParen),
249a06e9158STyler Dauwalder				S("\077\034"),
250a06e9158STyler Dauwalder				T(Ampersand),
251a06e9158STyler Dauwalder				S("ab"),
252a06e9158STyler Dauwalder				T(RightParen)
253a06e9158STyler Dauwalder			}
254a06e9158STyler Dauwalder		},
255a06e9158STyler Dauwalder		{ "0.8 [0:3] (\\7 & 'a')", 11,
256a06e9158STyler Dauwalder			{	F(0.8),
257a06e9158STyler Dauwalder				T(LeftBracket),
258a06e9158STyler Dauwalder				I(0),
259a06e9158STyler Dauwalder				T(Colon),
260a06e9158STyler Dauwalder				I(3),
261a06e9158STyler Dauwalder				T(RightBracket),
262a06e9158STyler Dauwalder				T(LeftParen),
263a06e9158STyler Dauwalder				S("\007"),
264a06e9158STyler Dauwalder				T(Ampersand),
265a06e9158STyler Dauwalder				S("a"),
266a06e9158STyler Dauwalder				T(RightParen)
267a06e9158STyler Dauwalder			}
268a06e9158STyler Dauwalder		},
269a06e9158STyler Dauwalder		{ "0.8 [0:3] (\"\\17\" & 'a')", 11,
270a06e9158STyler Dauwalder			{	F(0.8),
271a06e9158STyler Dauwalder				T(LeftBracket),
272a06e9158STyler Dauwalder				I(0),
273a06e9158STyler Dauwalder				T(Colon),
274a06e9158STyler Dauwalder				I(3),
275a06e9158STyler Dauwalder				T(RightBracket),
276a06e9158STyler Dauwalder				T(LeftParen),
277a06e9158STyler Dauwalder				S("\017"),
278a06e9158STyler Dauwalder				T(Ampersand),
279a06e9158STyler Dauwalder				S("a"),
280a06e9158STyler Dauwalder				T(RightParen)
281a06e9158STyler Dauwalder			}
282a06e9158STyler Dauwalder		},
283a06e9158STyler Dauwalder		{ "0.8 [0:3] ('\\17' & 'a')", 11,
284a06e9158STyler Dauwalder			{	F(0.8),
285a06e9158STyler Dauwalder				T(LeftBracket),
286a06e9158STyler Dauwalder				I(0),
287a06e9158STyler Dauwalder				T(Colon),
288a06e9158STyler Dauwalder				I(3),
289a06e9158STyler Dauwalder				T(RightBracket),
290a06e9158STyler Dauwalder				T(LeftParen),
291a06e9158STyler Dauwalder				S("\017"),
292a06e9158STyler Dauwalder				T(Ampersand),
293a06e9158STyler Dauwalder				S("a"),
294a06e9158STyler Dauwalder				T(RightParen)
295a06e9158STyler Dauwalder			}
296a06e9158STyler Dauwalder		},
297a06e9158STyler Dauwalder		{ "0.8 [0:3] (\\g & 'a')", 11,
298a06e9158STyler Dauwalder			{	F(0.8),
299a06e9158STyler Dauwalder				T(LeftBracket),
300a06e9158STyler Dauwalder				I(0),
301a06e9158STyler Dauwalder				T(Colon),
302a06e9158STyler Dauwalder				I(3),
303a06e9158STyler Dauwalder				T(RightBracket),
304a06e9158STyler Dauwalder				T(LeftParen),
305a06e9158STyler Dauwalder				S("g"),
306a06e9158STyler Dauwalder				T(Ampersand),
307a06e9158STyler Dauwalder				S("a"),
308a06e9158STyler Dauwalder				T(RightParen)
309a06e9158STyler Dauwalder			}
310a06e9158STyler Dauwalder		},
311a06e9158STyler Dauwalder		{ "0.8 [0:3] (\\g&\\b)", 11,
312a06e9158STyler Dauwalder			{	F(0.8),
313a06e9158STyler Dauwalder				T(LeftBracket),
314a06e9158STyler Dauwalder				I(0),
315a06e9158STyler Dauwalder				T(Colon),
316a06e9158STyler Dauwalder				I(3),
317a06e9158STyler Dauwalder				T(RightBracket),
318a06e9158STyler Dauwalder				T(LeftParen),
319a06e9158STyler Dauwalder				S("g"),
320a06e9158STyler Dauwalder				T(Ampersand),
321a06e9158STyler Dauwalder				S("\b"),
322a06e9158STyler Dauwalder				T(RightParen)
323a06e9158STyler Dauwalder			}
324a06e9158STyler Dauwalder		},
325a06e9158STyler Dauwalder		{ "0.8 [0:3] (\\g\\&b & 'abc')", 11,
326a06e9158STyler Dauwalder			{	F(0.8),
327a06e9158STyler Dauwalder				T(LeftBracket),
328a06e9158STyler Dauwalder				I(0),
329a06e9158STyler Dauwalder				T(Colon),
330a06e9158STyler Dauwalder				I(3),
331a06e9158STyler Dauwalder				T(RightBracket),
332a06e9158STyler Dauwalder				T(LeftParen),
333a06e9158STyler Dauwalder				S("g&b"),
334a06e9158STyler Dauwalder				T(Ampersand),
335a06e9158STyler Dauwalder				S("abc"),
336a06e9158STyler Dauwalder				T(RightParen)
337a06e9158STyler Dauwalder			}
338a06e9158STyler Dauwalder		},
339a06e9158STyler Dauwalder		{ "0.8 [0:3] (0x3457 & 'ab')", 11,
340a06e9158STyler Dauwalder			{	F(0.8),
341a06e9158STyler Dauwalder				T(LeftBracket),
342a06e9158STyler Dauwalder				I(0),
343a06e9158STyler Dauwalder				T(Colon),
344a06e9158STyler Dauwalder				I(3),
345a06e9158STyler Dauwalder				T(RightBracket),
346a06e9158STyler Dauwalder				T(LeftParen),
347a06e9158STyler Dauwalder				S("\x34\x57"),
348a06e9158STyler Dauwalder				T(Ampersand),
349a06e9158STyler Dauwalder				S("ab"),
350a06e9158STyler Dauwalder				T(RightParen)
351a06e9158STyler Dauwalder			}
352a06e9158STyler Dauwalder		},
353a06e9158STyler Dauwalder		{ "0.8 [0:3] (\\x34\\x57 & 'ab')", 11,
354a06e9158STyler Dauwalder			{	F(0.8),
355a06e9158STyler Dauwalder				T(LeftBracket),
356a06e9158STyler Dauwalder				I(0),
357a06e9158STyler Dauwalder				T(Colon),
358a06e9158STyler Dauwalder				I(3),
359a06e9158STyler Dauwalder				T(RightBracket),
360a06e9158STyler Dauwalder				T(LeftParen),
361a06e9158STyler Dauwalder				S("\x34\x57"),
362a06e9158STyler Dauwalder				T(Ampersand),
363a06e9158STyler Dauwalder				S("ab"),
364a06e9158STyler Dauwalder				T(RightParen)
365a06e9158STyler Dauwalder			}
366a06e9158STyler Dauwalder		},
367a06e9158STyler Dauwalder		{ "0.8 [0:3] (0xA4b7 & 'ab')", 11,
368a06e9158STyler Dauwalder			{	F(0.8),
369a06e9158STyler Dauwalder				T(LeftBracket),
370a06e9158STyler Dauwalder				I(0),
371a06e9158STyler Dauwalder				T(Colon),
372a06e9158STyler Dauwalder				I(3),
373a06e9158STyler Dauwalder				T(RightBracket),
374a06e9158STyler Dauwalder				T(LeftParen),
375a06e9158STyler Dauwalder				S("\xA4\xb7"),
376a06e9158STyler Dauwalder				T(Ampersand),
377a06e9158STyler Dauwalder				S("ab"),
378a06e9158STyler Dauwalder				T(RightParen)
379a06e9158STyler Dauwalder			}
380a06e9158STyler Dauwalder		},
381a06e9158STyler Dauwalder		{ "0.8 [0:3] (\\xA4\\xb7 & 'ab')", 11,
382a06e9158STyler Dauwalder			{	F(0.8),
383a06e9158STyler Dauwalder				T(LeftBracket),
384a06e9158STyler Dauwalder				I(0),
385a06e9158STyler Dauwalder				T(Colon),
386a06e9158STyler Dauwalder				I(3),
387a06e9158STyler Dauwalder				T(RightBracket),
388a06e9158STyler Dauwalder				T(LeftParen),
389a06e9158STyler Dauwalder				S("\xA4\xb7"),
390a06e9158STyler Dauwalder				T(Ampersand),
391a06e9158STyler Dauwalder				S("ab"),
392a06e9158STyler Dauwalder				T(RightParen)
393a06e9158STyler Dauwalder			}
394a06e9158STyler Dauwalder		},
395a06e9158STyler Dauwalder		{ "0.8 [0:3] (\"\\xA4\\xb7\" & 'ab')", 11,
396a06e9158STyler Dauwalder			{	F(0.8),
397a06e9158STyler Dauwalder				T(LeftBracket),
398a06e9158STyler Dauwalder				I(0),
399a06e9158STyler Dauwalder				T(Colon),
400a06e9158STyler Dauwalder				I(3),
401a06e9158STyler Dauwalder				T(RightBracket),
402a06e9158STyler Dauwalder				T(LeftParen),
403a06e9158STyler Dauwalder				S("\xA4\xb7"),
404a06e9158STyler Dauwalder				T(Ampersand),
405a06e9158STyler Dauwalder				S("ab"),
406a06e9158STyler Dauwalder				T(RightParen)
407a06e9158STyler Dauwalder			}
408a06e9158STyler Dauwalder		},
409a06e9158STyler Dauwalder		{ "0.8 [0:3] (\'\\xA4\\xb7\' & 'ab')", 11,
410a06e9158STyler Dauwalder			{	F(0.8),
411a06e9158STyler Dauwalder				T(LeftBracket),
412a06e9158STyler Dauwalder				I(0),
413a06e9158STyler Dauwalder				T(Colon),
414a06e9158STyler Dauwalder				I(3),
415a06e9158STyler Dauwalder				T(RightBracket),
416a06e9158STyler Dauwalder				T(LeftParen),
417a06e9158STyler Dauwalder				S("\xA4\xb7"),
418a06e9158STyler Dauwalder				T(Ampersand),
419a06e9158STyler Dauwalder				S("ab"),
420a06e9158STyler Dauwalder				T(RightParen)
421a06e9158STyler Dauwalder			}
422a06e9158STyler Dauwalder		},
423a06e9158STyler Dauwalder		{ "0.8 [0:3] ('ab\"' & 'abc')", 11,
424a06e9158STyler Dauwalder			{	F(0.8),
425a06e9158STyler Dauwalder				T(LeftBracket),
426a06e9158STyler Dauwalder				I(0),
427a06e9158STyler Dauwalder				T(Colon),
428a06e9158STyler Dauwalder				I(3),
429a06e9158STyler Dauwalder				T(RightBracket),
430a06e9158STyler Dauwalder				T(LeftParen),
431a06e9158STyler Dauwalder				S("ab\""),
432a06e9158STyler Dauwalder				T(Ampersand),
433a06e9158STyler Dauwalder				S("abc"),
434a06e9158STyler Dauwalder				T(RightParen)
435a06e9158STyler Dauwalder			}
436a06e9158STyler Dauwalder		},
437a06e9158STyler Dauwalder		{ "0.8 [0:3] (\"ab\\\"\" & 'abc')", 11,
438a06e9158STyler Dauwalder			{	F(0.8),
439a06e9158STyler Dauwalder				T(LeftBracket),
440a06e9158STyler Dauwalder				I(0),
441a06e9158STyler Dauwalder				T(Colon),
442a06e9158STyler Dauwalder				I(3),
443a06e9158STyler Dauwalder				T(RightBracket),
444a06e9158STyler Dauwalder				T(LeftParen),
445a06e9158STyler Dauwalder				S("ab\""),
446a06e9158STyler Dauwalder				T(Ampersand),
447a06e9158STyler Dauwalder				S("abc"),
448a06e9158STyler Dauwalder				T(RightParen)
449a06e9158STyler Dauwalder			}
450a06e9158STyler Dauwalder		},
451a06e9158STyler Dauwalder		{ "0.8 [0:3] (\"ab\\A\" & 'abc')", 11,
452a06e9158STyler Dauwalder			{	F(0.8),
453a06e9158STyler Dauwalder				T(LeftBracket),
454a06e9158STyler Dauwalder				I(0),
455a06e9158STyler Dauwalder				T(Colon),
456a06e9158STyler Dauwalder				I(3),
457a06e9158STyler Dauwalder				T(RightBracket),
458a06e9158STyler Dauwalder				T(LeftParen),
459a06e9158STyler Dauwalder				S("abA"),
460a06e9158STyler Dauwalder				T(Ampersand),
461a06e9158STyler Dauwalder				S("abc"),
462a06e9158STyler Dauwalder				T(RightParen)
463a06e9158STyler Dauwalder			}
464a06e9158STyler Dauwalder		},
465a06e9158STyler Dauwalder		{ "0.8 [0:3] (\"ab'\" & 'abc')", 11,
466a06e9158STyler Dauwalder			{	F(0.8),
467a06e9158STyler Dauwalder				T(LeftBracket),
468a06e9158STyler Dauwalder				I(0),
469a06e9158STyler Dauwalder				T(Colon),
470a06e9158STyler Dauwalder				I(3),
471a06e9158STyler Dauwalder				T(RightBracket),
472a06e9158STyler Dauwalder				T(LeftParen),
473a06e9158STyler Dauwalder				S("ab'"),
474a06e9158STyler Dauwalder				T(Ampersand),
475a06e9158STyler Dauwalder				S("abc"),
476a06e9158STyler Dauwalder				T(RightParen)
477a06e9158STyler Dauwalder			}
478a06e9158STyler Dauwalder		},
479a06e9158STyler Dauwalder		{ "0.8 [0:3] (\"ab\\\\\" & 'abc')", 11,
480a06e9158STyler Dauwalder			{	F(0.8),
481a06e9158STyler Dauwalder				T(LeftBracket),
482a06e9158STyler Dauwalder				I(0),
483a06e9158STyler Dauwalder				T(Colon),
484a06e9158STyler Dauwalder				I(3),
485a06e9158STyler Dauwalder				T(RightBracket),
486a06e9158STyler Dauwalder				T(LeftParen),
487a06e9158STyler Dauwalder				S("ab\\"),
488a06e9158STyler Dauwalder				T(Ampersand),
489a06e9158STyler Dauwalder				S("abc"),
490a06e9158STyler Dauwalder				T(RightParen)
491a06e9158STyler Dauwalder			}
492a06e9158STyler Dauwalder		},
493a06e9158STyler Dauwalder		{ "0.8 [-5:-3] (\"abc\" & 'abc')", 11,
494a06e9158STyler Dauwalder			{	F(0.8),
495a06e9158STyler Dauwalder				T(LeftBracket),
496a06e9158STyler Dauwalder				I(-5),
497a06e9158STyler Dauwalder				T(Colon),
498a06e9158STyler Dauwalder				I(-3),
499a06e9158STyler Dauwalder				T(RightBracket),
500a06e9158STyler Dauwalder				T(LeftParen),
501a06e9158STyler Dauwalder				S("abc"),
502a06e9158STyler Dauwalder				T(Ampersand),
503a06e9158STyler Dauwalder				S("abc"),
504a06e9158STyler Dauwalder				T(RightParen)
505a06e9158STyler Dauwalder			}
506a06e9158STyler Dauwalder		},
507a06e9158STyler Dauwalder		{ "0.8 [5:3] (\"abc\" & 'abc')", 11,
508a06e9158STyler Dauwalder			{	F(0.8),
509a06e9158STyler Dauwalder				T(LeftBracket),
510a06e9158STyler Dauwalder				I(5),
511a06e9158STyler Dauwalder				T(Colon),
512a06e9158STyler Dauwalder				I(3),
513a06e9158STyler Dauwalder				T(RightBracket),
514a06e9158STyler Dauwalder				T(LeftParen),
515a06e9158STyler Dauwalder				S("abc"),
516a06e9158STyler Dauwalder				T(Ampersand),
517a06e9158STyler Dauwalder				S("abc"),
518a06e9158STyler Dauwalder				T(RightParen)
519a06e9158STyler Dauwalder			}
520a06e9158STyler Dauwalder		},
521a06e9158STyler Dauwalder		{ "1.2 ('ABCD')", 4,
522a06e9158STyler Dauwalder			{	F(1.2),
523a06e9158STyler Dauwalder				T(LeftParen),
524a06e9158STyler Dauwalder				S("ABCD"),
525a06e9158STyler Dauwalder				T(RightParen)
526a06e9158STyler Dauwalder			}
527a06e9158STyler Dauwalder		},
528a06e9158STyler Dauwalder		{ ".2 ('ABCD')", 4,
529a06e9158STyler Dauwalder			{	F(0.2),
530a06e9158STyler Dauwalder				T(LeftParen),
531a06e9158STyler Dauwalder				S("ABCD"),
532a06e9158STyler Dauwalder				T(RightParen)
533a06e9158STyler Dauwalder			}
534a06e9158STyler Dauwalder		},
535a06e9158STyler Dauwalder		{ "0. ('ABCD')", 4,
536a06e9158STyler Dauwalder			{	F(0.0),
537a06e9158STyler Dauwalder				T(LeftParen),
538a06e9158STyler Dauwalder				S("ABCD"),
539a06e9158STyler Dauwalder				T(RightParen)
540a06e9158STyler Dauwalder			}
541a06e9158STyler Dauwalder		},
542a06e9158STyler Dauwalder		// Signed integers
543a06e9158STyler Dauwalder		{ "-1 ('ABCD')", 4,
544a06e9158STyler Dauwalder			{	I(-1),
545a06e9158STyler Dauwalder				T(LeftParen),
546a06e9158STyler Dauwalder				S("ABCD"),
547a06e9158STyler Dauwalder				T(RightParen)
548a06e9158STyler Dauwalder			}
549a06e9158STyler Dauwalder		},
550a06e9158STyler Dauwalder		{ "+1 ('ABCD')", 4,
551a06e9158STyler Dauwalder			{	I(1),
552a06e9158STyler Dauwalder				T(LeftParen),
553a06e9158STyler Dauwalder				S("ABCD"),
554a06e9158STyler Dauwalder				T(RightParen)
555a06e9158STyler Dauwalder			}
556a06e9158STyler Dauwalder		},
557a06e9158STyler Dauwalder		// Unsigned extended floats
558a06e9158STyler Dauwalder		{ "1E25 ('ABCD')", 4,
559a06e9158STyler Dauwalder			{	F(1e25),
560a06e9158STyler Dauwalder				T(LeftParen),
561a06e9158STyler Dauwalder				S("ABCD"),
562a06e9158STyler Dauwalder				T(RightParen)
563a06e9158STyler Dauwalder			}
564a06e9158STyler Dauwalder		},
565a06e9158STyler Dauwalder		{ "1e25 ('ABCD')", 4,
566a06e9158STyler Dauwalder			{	F(1e25),
567a06e9158STyler Dauwalder				T(LeftParen),
568a06e9158STyler Dauwalder				S("ABCD"),
569a06e9158STyler Dauwalder				T(RightParen)
570a06e9158STyler Dauwalder			}
571a06e9158STyler Dauwalder		},
572a06e9158STyler Dauwalder		{ "1E+25 ('ABCD')", 4,
573a06e9158STyler Dauwalder			{	F(1e25),
574a06e9158STyler Dauwalder				T(LeftParen),
575a06e9158STyler Dauwalder				S("ABCD"),
576a06e9158STyler Dauwalder				T(RightParen)
577a06e9158STyler Dauwalder			}
578a06e9158STyler Dauwalder		},
579a06e9158STyler Dauwalder		{ "1e+25 ('ABCD')", 4,
580a06e9158STyler Dauwalder			{	F(1e25),
581a06e9158STyler Dauwalder				T(LeftParen),
582a06e9158STyler Dauwalder				S("ABCD"),
583a06e9158STyler Dauwalder				T(RightParen)
584a06e9158STyler Dauwalder			}
585a06e9158STyler Dauwalder		},
586a06e9158STyler Dauwalder		{ "1E-25 ('ABCD')", 4,
587a06e9158STyler Dauwalder			{	F(1e-25),
588a06e9158STyler Dauwalder				T(LeftParen),
589a06e9158STyler Dauwalder				S("ABCD"),
590a06e9158STyler Dauwalder				T(RightParen)
591a06e9158STyler Dauwalder			}
592a06e9158STyler Dauwalder		},
593a06e9158STyler Dauwalder		{ "1e-25 ('ABCD')", 4,
594a06e9158STyler Dauwalder			{	F(1e-25),
595a06e9158STyler Dauwalder				T(LeftParen),
596a06e9158STyler Dauwalder				S("ABCD"),
597a06e9158STyler Dauwalder				T(RightParen)
598a06e9158STyler Dauwalder			}
599a06e9158STyler Dauwalder		},
600a06e9158STyler Dauwalder		// Positive signed extended floats
601a06e9158STyler Dauwalder		{ "+1E25 ('ABCD')", 4,
602a06e9158STyler Dauwalder			{	F(1e25),
603a06e9158STyler Dauwalder				T(LeftParen),
604a06e9158STyler Dauwalder				S("ABCD"),
605a06e9158STyler Dauwalder				T(RightParen)
606a06e9158STyler Dauwalder			}
607a06e9158STyler Dauwalder		},
608a06e9158STyler Dauwalder		{ "+1e25 ('ABCD')", 4,
609a06e9158STyler Dauwalder			{	F(1e25),
610a06e9158STyler Dauwalder				T(LeftParen),
611a06e9158STyler Dauwalder				S("ABCD"),
612a06e9158STyler Dauwalder				T(RightParen)
613a06e9158STyler Dauwalder			}
614a06e9158STyler Dauwalder		},
615a06e9158STyler Dauwalder		{ "+1E+25 ('ABCD')", 4,
616a06e9158STyler Dauwalder			{	F(1e25),
617a06e9158STyler Dauwalder				T(LeftParen),
618a06e9158STyler Dauwalder				S("ABCD"),
619a06e9158STyler Dauwalder				T(RightParen)
620a06e9158STyler Dauwalder			}
621a06e9158STyler Dauwalder		},
622a06e9158STyler Dauwalder		{ "+1e+25 ('ABCD')", 4,
623a06e9158STyler Dauwalder			{	F(1e25),
624a06e9158STyler Dauwalder				T(LeftParen),
625a06e9158STyler Dauwalder				S("ABCD"),
626a06e9158STyler Dauwalder				T(RightParen)
627a06e9158STyler Dauwalder			}
628a06e9158STyler Dauwalder		},
629a06e9158STyler Dauwalder		{ "+1E-25 ('ABCD')", 4,
630a06e9158STyler Dauwalder			{	F(1e-25),
631a06e9158STyler Dauwalder				T(LeftParen),
632a06e9158STyler Dauwalder				S("ABCD"),
633a06e9158STyler Dauwalder				T(RightParen)
634a06e9158STyler Dauwalder			}
635a06e9158STyler Dauwalder		},
636a06e9158STyler Dauwalder		{ "+1e-25 ('ABCD')", 4,
637a06e9158STyler Dauwalder			{	F(1e-25),
638a06e9158STyler Dauwalder				T(LeftParen),
639a06e9158STyler Dauwalder				S("ABCD"),
640a06e9158STyler Dauwalder				T(RightParen)
641a06e9158STyler Dauwalder			}
642a06e9158STyler Dauwalder		},
643a06e9158STyler Dauwalder		// Negative signed extended floats
644a06e9158STyler Dauwalder		{ "-1E25 ('ABCD')", 4,
645a06e9158STyler Dauwalder			{	F(-1e25),
646a06e9158STyler Dauwalder				T(LeftParen),
647a06e9158STyler Dauwalder				S("ABCD"),
648a06e9158STyler Dauwalder				T(RightParen)
649a06e9158STyler Dauwalder			}
650a06e9158STyler Dauwalder		},
651a06e9158STyler Dauwalder		{ "-1e25 ('ABCD')", 4,
652a06e9158STyler Dauwalder			{	F(-1e25),
653a06e9158STyler Dauwalder				T(LeftParen),
654a06e9158STyler Dauwalder				S("ABCD"),
655a06e9158STyler Dauwalder				T(RightParen)
656a06e9158STyler Dauwalder			}
657