How to use parse method in Gherkin-python

Best Python code snippet using gherkin-python

Run Gherkin-python automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

spec.py

Source: spec.py Github

copy
1#!/usr/bin/env python3
2
3from .error import Error
4from .parse_enums import Acc, Emit, Key
5
6LEX_BYTE_CLASSES = bytearray(b"\000\000\000\000\000\000\000\000\000\001\002\000\000\000\000\000"
7                             b"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
8                             b"\001\003\004\005\006\007\007\007\007\007\010\011\012\013\014\015"
9                             b"\016\017\020\020\020\020\020\020\021\021\022\007\007\007\023\007"
10                             b"\007\024\024\024\025\026\024\027\027\027\027\027\027\027\027\027"
11                             b"\027\027\027\027\027\030\027\027\027\027\027\031\032\033\007\027"
12                             b"\007\034\035\024\025\036\037\027\027\040\027\027\041\027\042\027"
13                             b"\027\027\043\044\045\046\027\027\027\027\027\047\050\051\007\000"
14                             b"\052\052\052\052\052\052\052\052\052\052\052\052\052\052\052\052"
15                             b"\053\053\053\053\053\053\053\053\053\053\053\053\053\053\053\053"
16                             b"\054\054\054\054\054\054\054\054\054\054\054\054\054\054\054\054"
17                             b"\054\054\054\054\054\054\054\054\054\054\054\054\054\054\054\054"
18                             b"\055\055\056\056\056\056\056\056\056\056\056\056\056\056\056\056"
19                             b"\056\056\056\056\056\056\056\056\056\056\056\056\056\056\056\056"
20                             b"\057\060\060\060\060\060\060\060\060\060\060\060\060\061\060\060"
21                             b"\062\063\063\063\064\055\055\055\055\055\055\055\055\055\055\055")
22
23LEX_TRANSITIONS = [
24    bytearray(b"\214\220\201\113\041\125\115\220\117\002\124\003\001\001\004\005\005\005\013\067"
25              b"\001\001\001\001\001\120\220\121\001\001\001\024\031\001\014\001\001\020\001\122"
26              b"\101\123\215\215\215\215\215\215\215\215\215\215\215"),
27    bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"
28              b"\001\001\001\001\001\223\223\223\001\001\001\001\001\001\001\001\001\001\001\223"
29              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
30    bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\004\005\005\005\013\223"
31              b"\001\001\001\001\001\223\223\223\001\001\001\001\031\001\001\001\001\001\001\223"
32              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
33    bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\004\005\005\005\013\223"
34              b"\001\001\001\001\001\223\223\223\001\001\001\001\034\001\001\001\001\001\001\223"
35              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
36    bytearray(b"\324\324\324\324\324\324\324\324\324\001\324\001\006\001\001\001\001\001\013\324"
37              b"\001\001\010\001\001\324\324\324\001\001\010\001\001\001\001\001\001\001\001\324"
38              b"\324\324\324\324\324\324\324\324\324\324\324\324\324"),
39    bytearray(b"\324\324\324\324\324\324\324\324\324\001\324\001\006\001\005\005\005\005\013\324"
40              b"\001\001\010\001\001\324\324\324\001\001\010\001\001\001\001\001\001\001\001\324"
41              b"\324\324\324\324\324\324\324\324\324\324\324\324\324"),
42    bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\007\007\007\007\013\223"
43              b"\001\001\001\001\001\223\223\223\001\001\001\001\001\001\001\001\001\001\001\223"
44              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
45    bytearray(b"\325\325\325\325\325\325\325\325\325\001\325\001\001\001\007\007\007\007\013\325"
46              b"\001\001\010\001\001\325\325\325\001\001\010\001\001\001\001\001\001\001\001\325"
47              b"\325\325\325\325\325\325\325\325\325\325\325\325\325"),
48    bytearray(b"\223\223\223\223\223\223\223\223\223\011\223\011\001\001\012\012\012\012\013\223"
49              b"\001\001\001\001\001\223\223\223\001\001\001\001\001\001\001\001\001\001\001\223"
50              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
51    bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\012\012\012\012\013\223"
52              b"\001\001\001\001\001\223\223\223\001\001\001\001\001\001\001\001\001\001\001\223"
53              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
54    bytearray(b"\325\325\325\325\325\325\325\325\325\001\325\001\001\001\012\012\012\012\013\325"
55              b"\001\001\001\001\001\325\325\325\001\001\001\001\001\001\001\001\001\001\001\325"
56              b"\325\325\325\325\325\325\325\325\325\325\325\325\325"),
57    bytearray(b"\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322"
58              b"\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322\322"
59              b"\322\322\322\322\322\322\322\322\322\322\322\322\322"),
60    bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"
61              b"\001\001\001\001\001\223\223\223\037\001\001\001\001\001\001\001\001\001\015\223"
62              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
63    bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"
64              b"\001\001\001\001\001\223\223\223\001\001\001\001\001\016\001\001\001\001\001\223"
65              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
66    bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"
67              b"\001\001\001\001\001\223\223\223\001\001\001\001\001\017\001\001\001\001\001\223"
68              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
69    bytearray(b"\314\314\314\314\314\314\314\314\314\001\314\001\001\001\001\001\001\001\013\314"
70              b"\001\001\001\001\001\314\314\314\001\001\001\001\001\001\001\001\001\001\001\314"
71              b"\314\314\314\314\314\314\314\314\314\314\314\314\314"),
72    bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"
73              b"\001\001\001\001\001\223\223\223\001\001\001\001\001\001\001\021\001\001\001\223"
74              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
75    bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"
76              b"\001\001\001\001\001\223\223\223\001\001\001\001\001\001\001\001\001\001\022\223"
77              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
78    bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"
79              b"\001\001\001\001\001\223\223\223\001\001\023\001\001\001\001\001\001\001\001\223"
80              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
81    bytearray(b"\315\315\315\315\315\315\315\315\315\001\315\001\001\001\001\001\001\001\013\315"
82              b"\001\001\001\001\001\315\315\315\001\001\001\001\001\001\001\001\001\001\001\315"
83              b"\315\315\315\315\315\315\315\315\315\315\315\315\315"),
84    bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"
85              b"\001\001\001\001\001\223\223\223\025\001\001\001\001\001\001\001\001\001\001\223"
86              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
87    bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"
88              b"\001\001\001\001\001\223\223\223\001\001\001\001\001\026\001\001\001\001\001\223"
89              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
90    bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"
91              b"\001\001\001\001\001\223\223\223\001\001\001\001\001\001\001\001\027\001\001\223"
92              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
93    bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"
94              b"\001\001\001\001\001\223\223\223\001\001\030\001\001\001\001\001\001\001\001\223"
95              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
96    bytearray(b"\316\316\316\316\316\316\316\316\316\001\316\001\001\001\001\001\001\001\013\316"
97              b"\001\001\001\001\001\316\316\316\001\001\001\001\001\001\001\001\001\001\001\316"
98              b"\316\316\316\316\316\316\316\316\316\316\316\316\316"),
99    bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"
100              b"\001\001\001\001\001\223\223\223\001\001\001\001\001\001\032\001\001\001\001\223"
101              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
102    bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"
103              b"\001\001\001\001\001\223\223\223\001\001\001\033\001\001\001\001\001\001\001\223"
104              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
105    bytearray(b"\317\317\317\317\317\317\317\317\317\001\317\001\001\001\001\001\001\001\013\317"
106              b"\001\001\001\001\001\317\317\317\001\001\001\001\001\001\001\001\001\001\001\317"
107              b"\317\317\317\317\317\317\317\317\317\317\317\317\317"),
108    bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"
109              b"\001\001\001\001\001\223\223\223\001\001\001\001\001\001\035\001\001\001\001\223"
110              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
111    bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"
112              b"\001\001\001\001\001\223\223\223\001\001\001\036\001\001\001\001\001\001\001\223"
113              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
114    bytearray(b"\320\320\320\320\320\320\320\320\320\001\320\001\001\001\001\001\001\001\013\320"
115              b"\001\001\001\001\001\320\320\320\001\001\001\001\001\001\001\001\001\001\001\320"
116              b"\320\320\320\320\320\320\320\320\320\320\320\320\320"),
117    bytearray(b"\223\223\223\223\223\223\223\223\223\001\223\001\001\001\001\001\001\001\013\223"
118              b"\001\001\001\001\001\223\223\223\001\001\001\001\001\001\040\001\001\001\001\223"
119              b"\223\223\223\223\223\223\223\223\223\223\223\223\223"),
120    bytearray(b"\321\321\321\321\321\321\321\321\321\001\321\001\001\001\001\001\001\001\013\321"
121              b"\001\001\001\001\001\321\321\321\001\001\001\001\001\001\001\001\001\001\001\321"
122              b"\321\321\321\321\321\321\321\321\321\321\321\321\321"),
123    bytearray(b"\214\041\226\041\065\041\041\041\041\041\041\041\041\041\041\041\041\041\041\041"
124              b"\041\041\041\041\041\041\051\041\041\041\041\041\041\041\041\041\041\041\041\041"
125              b"\041\041\216\216\216\216\050\042\047\043\044\046\045"),
126    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
127              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
128              b"\217\217\217\217\050\217\217\217\217\217\217\217\217"),
129    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
130              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
131              b"\217\217\050\050\217\217\217\217\217\217\217\217\217"),
132    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
133              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
134              b"\217\217\217\047\047\217\217\217\217\217\217\217\217"),
135    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
136              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
137              b"\217\217\047\217\217\217\217\217\217\217\217\217\217"),
138    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
139              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
140              b"\217\217\047\047\047\217\217\217\217\217\217\217\217"),
141    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
142              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
143              b"\217\217\050\050\050\217\217\217\217\217\217\217\217"),
144    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
145              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
146              b"\217\217\041\041\041\217\217\217\217\217\217\217\217"),
147    bytearray(b"\224\224\226\224\041\224\224\224\224\224\224\224\224\041\224\224\224\224\224\224"
148              b"\224\224\224\224\052\224\041\224\224\041\224\041\224\224\041\041\224\041\060\224"
149              b"\224\224\224\224\224\224\224\224\224\224\224\224\224"),
150    bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\053\225\225\225\225\225"
151              b"\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225"
152              b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),
153    bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\054\225\225\225\225\225"
154              b"\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225"
155              b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),
156    bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\056\055\225\225\225\225"
157              b"\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225"
158              b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),
159    bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\057\225\225\225\225\225"
160              b"\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225"
161              b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),
162    bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\060\057\057\057\225\225"
163              b"\057\057\057\225\225\225\225\225\057\057\057\057\225\225\225\225\225\225\225\225"
164              b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),
165    bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\061\061\061\061\225\225"
166              b"\061\061\061\225\225\225\225\225\061\061\061\061\225\225\225\225\225\225\225\225"
167              b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),
168    bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\061\061\061\061\225\225"
169              b"\061\064\061\225\225\225\225\225\061\061\061\061\225\225\225\225\225\225\225\225"
170              b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),
171    bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\062\062\062\062\225\225"
172              b"\062\062\062\225\225\225\225\225\062\062\062\062\225\225\225\225\225\225\225\225"
173              b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),
174    bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\063\063\063\063\225\225"
175              b"\063\063\063\225\225\225\225\225\063\063\063\063\225\225\225\225\225\225\225\225"
176              b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),
177    bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\041\041\041\041\225\225"
178              b"\041\041\041\225\225\225\225\225\041\041\041\041\225\225\225\225\225\225\225\225"
179              b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),
180    bytearray(b"\225\225\226\225\225\225\225\225\225\225\225\225\225\225\062\062\062\225\225\225"
181              b"\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225\225"
182              b"\225\225\225\225\225\225\225\225\225\225\225\225\225"),
183    bytearray(b"\327\327\327\327\327\327\327\327\327\327\327\327\327\327\327\327\327\327\066\327"
184              b"\327\327\327\327\327\327\327\327\327\327\327\327\327\327\327\327\327\327\327\327"
185              b"\327\327\327\327\327\327\327\327\327\327\327\327\327"),
186    bytearray(b"\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323"
187              b"\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323\323"
188              b"\323\323\323\323\323\323\323\323\323\323\323\323\323"),
189    bytearray(b"\214\077\311\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100"
190              b"\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100"
191              b"\100\100\216\216\216\216\076\070\075\071\072\074\073"),
192    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
193              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
194              b"\217\217\217\217\076\217\217\217\217\217\217\217\217"),
195    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
196              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
197              b"\217\217\076\076\217\217\217\217\217\217\217\217\217"),
198    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
199              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
200              b"\217\217\217\075\075\217\217\217\217\217\217\217\217"),
201    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
202              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
203              b"\217\217\075\217\217\217\217\217\217\217\217\217\217"),
204    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
205              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
206              b"\217\217\075\075\075\217\217\217\217\217\217\217\217"),
207    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
208              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
209              b"\217\217\076\076\076\217\217\217\217\217\217\217\217"),
210    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
211              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
212              b"\217\217\100\100\100\217\217\217\217\217\217\217\217"),
213    bytearray(b"\214\100\311\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100"
214              b"\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100"
215              b"\100\100\216\216\216\216\076\070\075\071\072\074\073"),
216    bytearray(b"\214\100\330\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100"
217              b"\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100"
218              b"\100\100\216\216\216\216\076\070\075\071\072\074\073"),
219    bytearray(b"\214\111\312\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112"
220              b"\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112"
221              b"\112\112\216\216\216\216\110\102\107\103\104\106\105"),
222    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
223              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
224              b"\217\217\217\217\110\217\217\217\217\217\217\217\217"),
225    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
226              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
227              b"\217\217\110\110\217\217\217\217\217\217\217\217\217"),
228    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
229              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
230              b"\217\217\217\107\107\217\217\217\217\217\217\217\217"),
231    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
232              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
233              b"\217\217\107\217\217\217\217\217\217\217\217\217\217"),
234    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
235              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
236              b"\217\217\107\107\107\217\217\217\217\217\217\217\217"),
237    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
238              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
239              b"\217\217\110\110\110\217\217\217\217\217\217\217\217"),
240    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
241              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
242              b"\217\217\112\112\112\217\217\217\217\217\217\217\217"),
243    bytearray(b"\214\112\312\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112"
244              b"\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112"
245              b"\112\112\216\216\216\216\110\102\107\103\104\106\105"),
246    bytearray(b"\214\112\331\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112"
247              b"\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112\112"
248              b"\112\112\216\216\216\216\110\102\107\103\104\106\105"),
249    bytearray(b"\227\114\313\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227"
250              b"\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227"
251              b"\227\227\227\227\227\227\227\227\227\227\227\227\227"),
252    bytearray(b"\214\227\313\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227"
253              b"\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227\227"
254              b"\227\227\215\215\215\215\215\215\215\215\215\215\215"),
255    bytearray(b"\326\115\326\326\326\326\326\326\326\221\326\221\221\221\116\116\116\116\326\326"
256              b"\116\116\116\221\221\326\326\326\116\116\116\116\221\221\221\221\221\221\221\326"
257              b"\326\326\326\326\326\326\326\326\326\326\326\326\326"),
258    bytearray(b"\222\222\222\222\222\222\222\222\222\221\222\221\221\221\115\115\115\115\222\222"
259              b"\115\115\115\221\221\222\222\222\115\115\115\115\221\221\221\221\221\221\221\222"
260              b"\222\222\222\222\222\222\222\222\222\222\222\222\222"),
261    bytearray(b"\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303"
262              b"\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303\303"
263              b"\303\303\303\303\303\303\303\303\303\303\303\303\303"),
264    bytearray(b"\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304"
265              b"\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304\304"
266              b"\304\304\304\304\304\304\304\304\304\304\304\304\304"),
267    bytearray(b"\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305"
268              b"\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305\305"
269              b"\305\305\305\305\305\305\305\305\305\305\305\305\305"),
270    bytearray(b"\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306"
271              b"\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306\306"
272              b"\306\306\306\306\306\306\306\306\306\306\306\306\306"),
273    bytearray(b"\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307"
274              b"\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307\307"
275              b"\307\307\307\307\307\307\307\307\307\307\307\307\307"),
276    bytearray(b"\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310"
277              b"\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310\310"
278              b"\310\310\310\310\310\310\310\310\310\310\310\310\310"),
279    bytearray(b"\214\125\332\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125"
280              b"\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125"
281              b"\125\125\216\216\216\216\134\126\133\127\130\132\131"),
282    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
283              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
284              b"\217\217\217\217\134\217\217\217\217\217\217\217\217"),
285    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
286              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
287              b"\217\217\134\134\217\217\217\217\217\217\217\217\217"),
288    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
289              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
290              b"\217\217\217\133\133\217\217\217\217\217\217\217\217"),
291    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
292              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
293              b"\217\217\133\217\217\217\217\217\217\217\217\217\217"),
294    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
295              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
296              b"\217\217\133\133\133\217\217\217\217\217\217\217\217"),
297    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
298              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
299              b"\217\217\134\134\134\217\217\217\217\217\217\217\217"),
300    bytearray(b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
301              b"\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217\217"
302              b"\217\217\125\125\125\217\217\217\217\217\217\217\217"),
303]
304
305PARSE_DEFS = [
306    (Error.LONG, None, [], [], None),
307    (None, None, [1], [], None),
308    (None, Emit.NULL, [], [], None),
309    (None, Emit.TRUE, [], [], None),
310    (None, Emit.FALSE, [], [], None),
311    (None, Emit.INF, [], [], None),
312    (None, Emit.NEG_INF, [], [], None),
313    (None, Emit.NAN, [], [], None),
314    (None, Emit.INT, [], [], None),
315    (None, Emit.FLOAT, [], [], None),
316    (None, Emit.STRING, [], [], None),
317    (None, Emit.DATA, [], [], None),
318    (None, Emit.SHORT_ARRAY_IN, [17], [], None),
319    (None, Emit.SHORT_MAP_IN, [21], [], None),
320    (None, None, [2], [], None),
321    (None, Emit.NULL, [3], [], None),
322    (None, Emit.TRUE, [3], [], None),
323    (None, Emit.FALSE, [3], [], None),
324    (None, Emit.INF, [3], [], None),
325    (None, Emit.NEG_INF, [3], [], None),
326    (None, Emit.NAN, [3], [], None),
327    (None, Emit.INT, [3], [], None),
328    (None, Emit.FLOAT, [3], [], None),
329    (None, Emit.STRING, [3], [], None),
330    (None, None, [9], [Acc.DATA], None),
331    (None, None, [13], [Acc.STRING], None),
332    (None, None, [11], [], None),
333    (None, None, [15], [], None),
334    (None, Emit.SHORT_ARRAY_IN, [3, 17], [], None),
335    (None, Emit.LONG_ARRAY_IN, [19, 0], [], None),
336    (None, Emit.SHORT_MAP_IN, [3, 21], [], None),
337    (None, Emit.LONG_MAP_IN, [24, 0], [], Key.UNQUOTED),
338    (None, Emit.LONG_MAP_IN, [24, 0], [], Key.QUOTED),
339    (Error.SUFFIX, None, [], [], None),
340    (None, None, [2, 5], [], None),
341    (None, None, [3, 5], [], None),
342    (None, None, [4], [], None),
343    (None, None, [], [], None),
344    (None, None, [3], [], None),
345    (Error.SIBLING, None, [], [], None),
346    (Error.CHILD, None, [], [], None),
347    (None, None, [6], [], None),
348    (None, None, [6, 5], [], None),
349    (None, None, [5], [], None),
350    (Error.SHORT, None, [], [], None),
351    (None, None, [9], [], None),
352    (None, None, [9, 5], [], None),
353    (None, None, [8], [], None),
354    (None, Emit.ACC_DATA, [], [], None),
355    (None, None, [13], [Acc.NL, Acc.STRING], None),
356    (None, None, [11], [Acc.NL], None),
357    (None, None, [11, 5], [], None),
358    (None, None, [10], [], None),
359    (None, Emit.ACC_STRING, [], [Acc.NL], None),
360    (None, None, [13], [], None),
361    (None, None, [13], [Acc.SP, Acc.STRING], None),
362    (None, None, [13, 5], [], None),
363    (None, None, [12], [], None),
364    (Error.BANG_LAST, None, [], [], None),
365    (None, None, [15, 5], [], None),
366    (None, None, [14], [], None),
367    (None, Emit.ACC_STRING, [], [], None),
368    (Error.ARRAY_END, None, [], [], None),
369    (None, None, [16, 7], [], None),
370    (None, Emit.SHORT_ARRAY_OUT, [], [], None),
371    (None, Emit.NULL, [16], [], None),
372    (None, Emit.TRUE, [16], [], None),
373    (None, Emit.FALSE, [16], [], None),
374    (None, Emit.INF, [16], [], None),
375    (None, Emit.NEG_INF, [16], [], None),
376    (None, Emit.NAN, [16], [], None),
377    (None, Emit.INT, [16], [], None),
378    (None, Emit.FLOAT, [16], [], None),
379    (None, Emit.STRING, [16], [], None),
380    (None, Emit.DATA, [16], [], None),
381    (None, Emit.SHORT_ARRAY_IN, [16, 17], [], None),
382    (None, Emit.SHORT_MAP_IN, [16, 21], [], None),
383    (None, None, [19], [], None),
384    (None, None, [19, 0], [], None),
385    (None, None, [19, 5], [], None),
386    (None, None, [18], [], None),
387    (None, Emit.LONG_ARRAY_OUT, [], [], None),
388    (Error.MAP_END, None, [], [], None),
389    (None, None, [20, 22], [], None),
390    (None, Emit.SHORT_MAP_OUT, [], [], None),
391    (Error.MAP_KEY, None, [], [], None),
392    (None, None, [20, 7], [], Key.UNQUOTED),
393    (None, None, [20, 7], [], Key.QUOTED),
394    (None, None, [7], [], Key.UNQUOTED),
395    (None, None, [7], [], Key.QUOTED),
396    (None, None, [24], [], None),
397    (None, None, [24, 0], [], Key.UNQUOTED),
398    (None, None, [24, 0], [], Key.QUOTED),
399    (None, None, [24, 5], [], None),
400    (None, None, [23], [], None),
401    (None, Emit.LONG_MAP_OUT, [], [], None),
402]
403
404PARSE_TABLE = [
405    [PARSE_DEFS[1], PARSE_DEFS[0], PARSE_DEFS[0], PARSE_DEFS[0], PARSE_DEFS[12],
406     PARSE_DEFS[0], PARSE_DEFS[13], PARSE_DEFS[0], PARSE_DEFS[0], PARSE_DEFS[0],
407     PARSE_DEFS[0], PARSE_DEFS[0], PARSE_DEFS[2], PARSE_DEFS[3], PARSE_DEFS[4],
408     PARSE_DEFS[5], PARSE_DEFS[6], PARSE_DEFS[7], PARSE_DEFS[0], PARSE_DEFS[0],
409     PARSE_DEFS[8], PARSE_DEFS[9], PARSE_DEFS[11], PARSE_DEFS[10], PARSE_DEFS[0],
410     PARSE_DEFS[0], PARSE_DEFS[0]],
411    [PARSE_DEFS[0], PARSE_DEFS[0], PARSE_DEFS[0], PARSE_DEFS[29], PARSE_DEFS[28],
412     PARSE_DEFS[0], PARSE_DEFS[30], PARSE_DEFS[0], PARSE_DEFS[0], PARSE_DEFS[26],
413     PARSE_DEFS[26], PARSE_DEFS[27], PARSE_DEFS[15], PARSE_DEFS[16], PARSE_DEFS[17],
414     PARSE_DEFS[18], PARSE_DEFS[19], PARSE_DEFS[20], PARSE_DEFS[31], PARSE_DEFS[32],
415     PARSE_DEFS[21], PARSE_DEFS[22], PARSE_DEFS[24], PARSE_DEFS[23], PARSE_DEFS[25],
416     PARSE_DEFS[25], PARSE_DEFS[14]],
417    [PARSE_DEFS[34], PARSE_DEFS[1], PARSE_DEFS[0], PARSE_DEFS[33], PARSE_DEFS[33],
418     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
419     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
420     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
421     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
422     PARSE_DEFS[33], PARSE_DEFS[33]],
423    [PARSE_DEFS[35], PARSE_DEFS[36], PARSE_DEFS[37], PARSE_DEFS[33], PARSE_DEFS[33],
424     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
425     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
426     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
427     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
428     PARSE_DEFS[33], PARSE_DEFS[38]],
429    [PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[0], PARSE_DEFS[39], PARSE_DEFS[39],
430     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
431     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
432     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
433     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
434     PARSE_DEFS[39], PARSE_DEFS[38]],
435    [PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[0], PARSE_DEFS[40], PARSE_DEFS[40],
436     PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40],
437     PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40],
438     PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40],
439     PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40], PARSE_DEFS[40],
440     PARSE_DEFS[40], PARSE_DEFS[41]],
441    [PARSE_DEFS[42], PARSE_DEFS[43], PARSE_DEFS[37], PARSE_DEFS[33], PARSE_DEFS[33],
442     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
443     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
444     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
445     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
446     PARSE_DEFS[33], PARSE_DEFS[33]],
447    [PARSE_DEFS[44], PARSE_DEFS[44], PARSE_DEFS[44], PARSE_DEFS[44], PARSE_DEFS[12],
448     PARSE_DEFS[44], PARSE_DEFS[13], PARSE_DEFS[44], PARSE_DEFS[44], PARSE_DEFS[44],
449     PARSE_DEFS[44], PARSE_DEFS[44], PARSE_DEFS[2], PARSE_DEFS[3], PARSE_DEFS[4],
450     PARSE_DEFS[5], PARSE_DEFS[6], PARSE_DEFS[7], PARSE_DEFS[44], PARSE_DEFS[44],
451     PARSE_DEFS[8], PARSE_DEFS[9], PARSE_DEFS[11], PARSE_DEFS[10], PARSE_DEFS[44],
452     PARSE_DEFS[44], PARSE_DEFS[44]],
453    [PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
454     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
455     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
456     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
457     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[24], PARSE_DEFS[39], PARSE_DEFS[39],
458     PARSE_DEFS[39], PARSE_DEFS[45]],
459    [PARSE_DEFS[46], PARSE_DEFS[47], PARSE_DEFS[48], PARSE_DEFS[33], PARSE_DEFS[33],
460     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
461     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
462     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
463     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
464     PARSE_DEFS[33], PARSE_DEFS[45]],
465    [PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
466     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[50],
467     PARSE_DEFS[50], PARSE_DEFS[27], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
468     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
469     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[49],
470     PARSE_DEFS[49], PARSE_DEFS[26]],
471    [PARSE_DEFS[51], PARSE_DEFS[52], PARSE_DEFS[53], PARSE_DEFS[33], PARSE_DEFS[33],
472     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
473     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
474     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
475     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
476     PARSE_DEFS[33], PARSE_DEFS[33]],
477    [PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
478     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[50],
479     PARSE_DEFS[50], PARSE_DEFS[27], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
480     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
481     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[55],
482     PARSE_DEFS[49], PARSE_DEFS[54]],
483    [PARSE_DEFS[56], PARSE_DEFS[57], PARSE_DEFS[53], PARSE_DEFS[33], PARSE_DEFS[33],
484     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
485     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
486     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
487     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
488     PARSE_DEFS[33], PARSE_DEFS[33]],
489    [PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
490     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[58],
491     PARSE_DEFS[58], PARSE_DEFS[58], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
492     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
493     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[58],
494     PARSE_DEFS[58], PARSE_DEFS[27]],
495    [PARSE_DEFS[59], PARSE_DEFS[60], PARSE_DEFS[61], PARSE_DEFS[33], PARSE_DEFS[33],
496     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
497     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
498     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
499     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
500     PARSE_DEFS[33], PARSE_DEFS[33]],
501    [PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62],
502     PARSE_DEFS[64], PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[63], PARSE_DEFS[62],
503     PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62],
504     PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62],
505     PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62], PARSE_DEFS[62],
506     PARSE_DEFS[62], PARSE_DEFS[62]],
507    [PARSE_DEFS[44], PARSE_DEFS[44], PARSE_DEFS[44], PARSE_DEFS[44], PARSE_DEFS[75],
508     PARSE_DEFS[64], PARSE_DEFS[76], PARSE_DEFS[44], PARSE_DEFS[44], PARSE_DEFS[44],
509     PARSE_DEFS[44], PARSE_DEFS[44], PARSE_DEFS[65], PARSE_DEFS[66], PARSE_DEFS[67],
510     PARSE_DEFS[68], PARSE_DEFS[69], PARSE_DEFS[70], PARSE_DEFS[44], PARSE_DEFS[44],
511     PARSE_DEFS[71], PARSE_DEFS[72], PARSE_DEFS[74], PARSE_DEFS[73], PARSE_DEFS[44],
512     PARSE_DEFS[44], PARSE_DEFS[44]],
513    [PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[78], PARSE_DEFS[39],
514     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
515     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
516     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
517     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
518     PARSE_DEFS[39], PARSE_DEFS[77]],
519    [PARSE_DEFS[79], PARSE_DEFS[80], PARSE_DEFS[81], PARSE_DEFS[33], PARSE_DEFS[33],
520     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
521     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
522     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
523     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
524     PARSE_DEFS[33], PARSE_DEFS[77]],
525    [PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82],
526     PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[84], PARSE_DEFS[83], PARSE_DEFS[82],
527     PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82],
528     PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82],
529     PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82], PARSE_DEFS[82],
530     PARSE_DEFS[82], PARSE_DEFS[82]],
531    [PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85],
532     PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[84], PARSE_DEFS[85], PARSE_DEFS[85],
533     PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85],
534     PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[86], PARSE_DEFS[87],
535     PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85],
536     PARSE_DEFS[85], PARSE_DEFS[85]],
537    [PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85],
538     PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85],
539     PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85],
540     PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[88], PARSE_DEFS[89],
541     PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85], PARSE_DEFS[85],
542     PARSE_DEFS[85], PARSE_DEFS[85]],
543    [PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
544     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
545     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
546     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[91], PARSE_DEFS[92],
547     PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39], PARSE_DEFS[39],
548     PARSE_DEFS[39], PARSE_DEFS[90]],
549    [PARSE_DEFS[93], PARSE_DEFS[94], PARSE_DEFS[95], PARSE_DEFS[33], PARSE_DEFS[33],
550     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
551     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
552     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
553     PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33], PARSE_DEFS[33],
554     PARSE_DEFS[33], PARSE_DEFS[90]],
555]
556
Full Screen

test_parser_pddl_simple.py

Source: test_parser_pddl_simple.py Github

copy
1#!/usr/bin/python3
2from pddl.parser import *
3from pddl.lisp_parser import parse_lisp_iterator
4from pddl.errors import BraceError, ParseError
5
6from py.test import raises
7
8## helper functions
9
10
11def varListTest(varList):
12    assert  [k.name for k in varList] == ['?x', '?y', '?z']
13    assert  len([k for k in varList if k.typed]) == 3
14    assert  [k.types[0] for k in varList] == ['block', 'foo', 'block']
15
16
17def keywordListTest(keyList):
18    assert  [k.name for k in keyList] == ['name', 'parameters', 'foo']
19
20
21## the tests
22
23
24def test_parseKeywordSimple():
25    test = ['(:parameters )']
26    iter = parse_lisp_iterator(test)
27    key = parse_keyword(next(iter))
28    assert key.name == 'parameters'
29
30
31def test_parseKeywordComplex():
32    test = [' ( :name)']
33    iter = parse_lisp_iterator(test)
34    key = parse_keyword(next(iter))
35    assert key.name == 'name'
36
37
38def test_parseKeywordList():
39    test = ['(:name :parameters :foo )']
40    iter = parse_lisp_iterator(test)
41    keys = parse_keyword_list(iter)
42    assert iter.empty()
43    keywordListTest(keys)
44
45
46def test_parseRequirements():
47    test = ['(:requirements :name :parameters :foo )']
48    iter = parse_lisp_iterator(test)
49    req = parse_requirements_stmt(iter)
50    assert iter.empty()
51    keywordListTest(req.keywords)
52
53
54def test_parseRequirements2():
55    test = ['(:predicates :name :parameters :foo )']
56    iter = parse_lisp_iterator(test)
57    with raises(ValueError):
58        parse_requirements_stmt(iter)
59
60
61def test_parseVariableNoTyping():
62    test = [' ( ?x)']
63    iter = parse_lisp_iterator(test)
64    key = parse_variable(next(iter))
65    assert key.name == '?x'
66    assert key.typed == False
67    assert key.types == None
68
69
70def test_parseVariableTyping():
71    test = [' ( ?x - block)']
72    iter = parse_lisp_iterator(test)
73    vlist = parse_typed_var_list(iter)
74    assert len(vlist) == 1
75    assert vlist[0].name == '?x'
76    assert vlist[0].typed == True
77    assert vlist[0].types[0] == 'block'
78
79
80def test_parseVariableList():
81    test = [' ( ?x - block ?y - foo ?z - block  )']
82    iter = parse_lisp_iterator(test)
83    key = parse_typed_var_list(iter)
84    varListTest(key)
85
86
87def test_parseParameters():
88    test = ['(:parameters ( ?x - block ?y - foo ?z - block  ))']
89    iter = parse_lisp_iterator(test)
90    key = parse_parameters(iter)
91    varListTest(key)
92
93
94def test_parseParameters2():
95    test = ['(:predicates ( ?x - block ?y - foo ?z - block  ))']
96    iter = parse_lisp_iterator(test)
97    with raises(ValueError):
98        parse_parameters(iter)
99
100
101def test_parseTypes():
102    test = ['(:types block plane key)']
103    iter = parse_lisp_iterator(test)
104    tlist = parse_types_stmt(iter)
105    assert [t.name for t in tlist] == ['block', 'plane', 'key']
106
107
108def test_parseTypesFail():
109    test = ['(:types :block plane key)']
110    iter = parse_lisp_iterator(test)
111    with raises(ValueError):
112        parse_types_stmt(iter)
113
114
115def test_parseTypesFail2():
116    test = ['(:predicates :block plane key)']
117    iter = parse_lisp_iterator(test)
118    with raises(ValueError):
119        parse_types_stmt(iter)
120
121
122def test_parseDomainStatement():
123    test = ['(domain supertest-23-v0)']
124    iter = parse_lisp_iterator(test)
125    dom = parse_domain_stmt(iter)
126    assert dom.name == 'supertest-23-v0'
127
128
129def test_parseDomainStatementFail():
130    test = ['(domaiin supertest-23-v0)']
131    iter = parse_lisp_iterator(test)
132    with raises(ValueError):
133        parse_domain_stmt(iter)
134
135
136def test_parsePredicate():
137    test = ['(on ?x ?y)']
138    iter = parse_lisp_iterator(test)
139    pred = parse_predicate(iter)
140    assert pred.name == 'on'
141    assert [x.name for x in pred.parameters] == ['?x', '?y']
142
143
144def test_parsePredicateMixed():
145    test = ['(on ?x - block ?y)']
146    iter = parse_lisp_iterator(test)
147    pred = parse_predicate(iter)
148    assert pred.name == 'on'
149    assert [x.name for x in pred.parameters] == ['?x', '?y']
150    assert [x.types[0] for x in pred.parameters
151            if x.types != None] == ['block']
152
153
154def test_parsePredicateList():
155    test = ['((on ?x - block ?y) (put ?x ?z) (true))']
156    iter = parse_lisp_iterator(test)
157    predlist = parse_predicate_list(iter)
158    assert [x.name for x in predlist] == ['on', 'put', 'true']
159
160
161def test_parseFormula():
162    test = ['(and (on ?x table) (true) (free ?x))']
163    iter = parse_lisp_iterator(test)
164    print(iter)
165    formula = parse_formula(iter)
166    assert formula.key == 'and'
167    assert [c.key for c in formula.children] == ['on', 'true', 'free']
168    assert [c.key.name for c in formula.children[0].children
169            if c.type == TypeVariable] == ['?x']
170    assert [c.key for c in formula.children[0].children
171            if c.type == TypeConstant] == ['table']
172    assert [c.key.name for c in formula.children[2].children
173            if c.type == TypeVariable] == ['?x']
174    assert [c for c in formula.children[1].children] == []
175
176
177def test_parseFormulaFail():
178    test = ['(and (on ?x table) (:true) (free ?x))']
179    iter = parse_lisp_iterator(test)
180    with raises(ValueError):
181        parse_formula(iter)
182
183
184def test_parseFormulaLispFail2():
185    test = ['(and (on ?x table) (true) (free( ?x))']
186    with raises(ParseError):
187        iter = parse_lisp_iterator(test)
188
189
190def test_parse_variable():
191    test = ['(x)']
192    iter = parse_lisp_iterator(test)
193    with raises(ValueError):
194        parse_variable(next(iter))
195
196
197def test_lisp_parser_start_brace():
198    test = ['test string)']
199    with raises(ParseError):
200        iter = parse_lisp_iterator(test)
201
202
203def test_parse_keyword_raise():
204    test = ['(?test)']
205    iter = parse_lisp_iterator(test)
206    with raises(ValueError):
207        parse_keyword(next(iter))
208
209
210def test_parse_objects_stmt_fail():
211    test = ['(:predicates blubb blubb)']
212    iter = parse_lisp_iterator(test)
213    with raises(ValueError):
214        parse_objects_stmt(iter)
215
216
217def test_parse_constants_stmt_fail():
218    test = ['(:predicates blubb blubb)']
219    iter = parse_lisp_iterator(test)
220    with raises(ValueError):
221        parse_constants_stmt(iter)
222
223
224def test_parse_problem_domain_stmt_fail():
225    test = ['(:predicates blubb blubb)']
226    iter = parse_lisp_iterator(test)
227    with raises(ValueError):
228        parse_problem_domain_stmt(iter)
229
230
231def test_parse_precondition_stmt_fail():
232    test = ['(:predicates blubb blubb)']
233    iter = parse_lisp_iterator(test)
234    with raises(ValueError):
235        parse_precondition_stmt(iter)
236
237
238def test_parse_effect_stmt_fail():
239    test = ['(:predicates blubb blubb)']
240    iter = parse_lisp_iterator(test)
241    with raises(ValueError):
242        parse_effect_stmt(iter)
243
244
245def test_parse_action_stmt_fail():
246    test = ['(:predicates blubb blubb)']
247    iter = parse_lisp_iterator(test)
248    with raises(ValueError):
249        parse_action_stmt(iter)
250
251
252def test_parse_predicates_stmt_fail():
253    test = ['(:actions blubb blubb)']
254    iter = parse_lisp_iterator(test)
255    with raises(ValueError):
256        parse_predicates_stmt(iter)
257
258
259def test_parse_domain_def_fail():
260    test = ['(definiere (domain BLOCKS))']
261    iter = parse_lisp_iterator(test)
262    with raises(ValueError):
263        parse_domain_def(iter)
264
265
266def test_parse_problem_def_fail():
267    test = ['(definiere problem)']
268    iter = parse_lisp_iterator(test)
269    with raises(ValueError):
270        parse_problem_def(iter)
271
272
273def test_parse_problem_name_fail():
274    test = ['(domain test)']
275    iter = parse_lisp_iterator(test)
276    with raises(ValueError):
277        parse_problem_name(iter)
278
279
280def test_parse_init_stmt_fail():
281    test = ['(:goal ssdfsdf)']
282    iter = parse_lisp_iterator(test)
283    with raises(ValueError):
284        parse_init_stmt(iter)
285
286
287def test_parse_goal_stmt_fail():
288    test = ['(:init ssdfsdf)']
289    iter = parse_lisp_iterator(test)
290    with raises(ValueError):
291        parse_goal_stmt(iter)
292
Full Screen

autopart.py

Source: autopart.py Github

copy
1#
2# Chris Lumens <[email protected]>
3#
4# Copyright 2009 Red Hat, Inc.
5#
6# This copyrighted material is made available to anyone wishing to use, modify,
7# copy, or redistribute it subject to the terms and conditions of the GNU
8# General Public License v.2.  This program is distributed in the hope that it
9# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
10# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11# See the GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License along with
14# this program; if not, write to the Free Software Foundation, Inc., 51
15# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
16# trademarks that are incorporated in the source code or documentation are not
17# subject to the GNU General Public License and may only be used or replicated
18# with the express permission of Red Hat, Inc.
19#
20import unittest
21from tests.baseclass import CommandTest, CommandSequenceTest
22from pykickstart.commands.autopart import FC3_AutoPart, RHEL6_AutoPart, F16_AutoPart, F17_AutoPart, F18_AutoPart, F21_AutoPart
23from pykickstart.version import RHEL6, RHEL7, F21, F23
24from pykickstart.constants import AUTOPART_TYPE_PLAIN
25
26class AutoPart_TestCase(unittest.TestCase):
27    def runTest(self):
28        for cmd_class in [FC3_AutoPart, F16_AutoPart, F17_AutoPart, F18_AutoPart, F21_AutoPart]:
29            cmd = cmd_class()
30            self.assertEqual(cmd.__str__(), '')
31
32        # this is very artificial but covers the following snippet
33        # which never executes during normal operation
34        # because self.typeMap['plain'] will match first
35        #    263         if retval == "partition":
36        #    264             retval = "plain"
37
38        cmd = F17_AutoPart()
39        del cmd.typeMap['plain']
40        cmd.type = AUTOPART_TYPE_PLAIN
41        self.assertEqual(cmd._typeAsStr(), 'plain')
42
43class FC3_TestCase(CommandTest):
44    command = "autopart"
45
46    def runTest(self):
47        # pass
48        self.assert_parse("autopart", "autopart\n")
49
50        # fail - on FC3, autopart  took no options so this raises a different
51        # exception than later releases.
52        if self.__class__.__name__ == "FC3_TestCase":
53            self.assert_parse_error("autopart --blah")
54
55class F9_TestCase(FC3_TestCase):
56    def runTest(self):
57        FC3_TestCase.runTest(self)
58
59        # pass
60        self.assert_parse("autopart --passphrase=whatever", "autopart\n")
61        self.assert_parse("autopart --encrypted", "autopart --encrypted\n")
62        self.assert_parse("autopart --encrypted --passphrase=\"whatever\"",
63                          "autopart --encrypted --passphrase=\"whatever\"\n")
64        self.assert_parse("autopart --encrypted --passphrase=whatever",
65                          "autopart --encrypted --passphrase=\"whatever\"\n")
66
67        # fail
68        self.assert_parse_error("autopart --passphrase")
69        self.assert_parse_error("autopart --encrypted --passphrase")
70        self.assert_parse_error("autopart --encrypted=False")
71        self.assert_parse_error("autopart --encrypted=True")
72
73class F12_TestCase(F9_TestCase):
74    def runTest(self):
75        # Run F9 test case
76        F9_TestCase.runTest(self)
77
78        # pass
79        self.assert_parse("autopart --escrowcert=\"http://x/y\"", "autopart\n")
80        self.assert_parse("autopart --encrypted --backuppassphrase",
81                          "autopart --encrypted\n")
82        self.assert_parse("autopart --encrypted --escrowcert=\"http://x/y\"",
83                          "autopart --encrypted --escrowcert=\"http://x/y\"\n")
84        self.assert_parse("autopart --encrypted --escrowcert=\"http://x/y\" "
85                          "--backuppassphrase",
86                          "autopart --encrypted --escrowcert=\"http://x/y\" "
87                          "--backuppassphrase\n")
88        self.assert_parse("autopart --encrypted --escrowcert=http://x/y",
89                          "autopart --encrypted --escrowcert=\"http://x/y\"\n")
90
91        # fail
92        self.assert_parse_error("autopart --escrowcert")
93        self.assert_parse_error("autopart --escrowcert --backuppassphrase")
94        self.assert_parse_error("autopart --encrypted --escrowcert "
95                                "--backuppassphrase")
96        self.assert_parse_error("autopart --backuppassphrase=False")
97        self.assert_parse_error("autopart --backuppassphrase=True")
98
99class RHEL6_TestCase(F12_TestCase):
100    def runTest(self):
101        F12_TestCase.runTest(self)
102
103        # pass
104        self.assert_parse("autopart --cipher=foo", "autopart\n")
105        self.assert_parse("autopart --encrypted --cipher=3-rot13",
106                          "autopart --encrypted --cipher=\"3-rot13\"\n")
107
108        # fail
109        self.assert_parse_error("autopart --cipher")
110        self.assert_parse_error("autopart --encrypted --cipher")
111
112        # extra test coverage
113        cmd = RHEL6_AutoPart()
114        self.assertEqual(cmd.__str__(), '')
115
116class RHEL6_Conflict_TestCase(CommandSequenceTest):
117    def __init__(self, *args, **kwargs):
118        CommandSequenceTest.__init__(self, *args, **kwargs)
119        self.version = RHEL6
120
121    def runTest(self):
122        self.assert_parse_error("""
123part / --size=1024 --fstype=ext4
124autopart""")
125
126        self.assert_parse_error("""
127raid / --device=md0 --level=0 raid.01
128autopart""")
129
130        self.assert_parse_error("""
131volgroup vg.01 pv.01 --pesize=70000
132autopart""")
133
134        self.assert_parse_error("""
135logvol / --size=10240 --name=NAME --vgname=VGNAM
136autopart""")
137
138
139class F16_TestCase(F12_TestCase):
140    def runTest(self):
141        # Run F12 test case
142        F12_TestCase.runTest(self)
143
144        if "--type" not in self.optionList:
145            # pass
146            self.assert_parse("autopart --nolvm",
147                              "autopart --nolvm\n")
148
149            # fail
150            self.assert_parse_error("autopart --nolvm=asdf")
151            self.assert_parse_error("autopart --nolvm True")
152            self.assert_parse_error("autopart --nolvm=1")
153            self.assert_parse_error("autopart --nolvm 0")
154
155class F17_TestCase(F16_TestCase):
156    def runTest(self):
157        # Run F16 test case
158        F16_TestCase.runTest(self)
159
160        # pass
161        self.assert_parse("autopart --type=plain",
162                          "autopart --type=plain\n")
163        self.assert_parse("autopart --type=partition",
164                          "autopart --type=plain\n")
165        self.assert_parse("autopart --type=lvm",
166                          "autopart --type=lvm\n")
167
168        if self.__class__.__name__ != "RHEL8_TestCase":
169            self.assert_parse("autopart --type=btrfs",
170                              "autopart --type=btrfs\n")
171
172        self.assert_parse("autopart --nolvm",
173                          "autopart --type=plain\n")
174
175        # don't add --type= if none was specified
176        self.assert_parse("autopart",
177                          "autopart\n")
178
179        # fail
180        self.assert_parse_error("autopart --type")
181        self.assert_parse_error("autopart --type=blah")
182
183class F18_TestCase(F17_TestCase):
184    def runTest(self):
185        F17_TestCase.runTest(self)
186
187        # pass
188        self.assert_parse("autopart --cipher=foo", "autopart\n")
189        self.assert_parse("autopart --encrypted --cipher=3-rot13",
190                          "autopart --encrypted --cipher=\"3-rot13\"\n")
191
192        # fail
193        self.assert_parse_error("autopart --cipher")
194        self.assert_parse_error("autopart --encrypted --cipher")
195
196class F20_TestCase(F18_TestCase):
197    def runTest(self):
198        F18_TestCase.runTest(self)
199
200        self.assert_parse("autopart --type=thinp",
201                          "autopart --type=thinp\n")
202
203class F21_TestCase(F20_TestCase):
204    def runTest(self):
205        F20_TestCase.runTest(self)
206
207        # pass
208        self.assert_parse("autopart --fstype=ext4",
209                          'autopart --fstype=ext4\n')
210        self.assert_parse("autopart --encrypted --fstype=ext4",
211                          'autopart --encrypted --fstype=ext4\n')
212        self.assert_parse("autopart --type=lvm --fstype=xfs",
213                          "autopart --type=lvm --fstype=xfs\n")
214
215        # fail
216        self.assert_parse_error("autopart --fstype")
217        self.assert_parse_error("autopart --fstype=btrfs")
218        self.assert_parse_error("autopart --type=btrfs --fstype=xfs")
219
220
221class F21_Conflict_TestCase(CommandSequenceTest):
222    def __init__(self, *args, **kwargs):
223        CommandSequenceTest.__init__(self, *args, **kwargs)
224        self.version = F21
225
226    def runTest(self):
227        self.assert_parse_error("""
228part / --size=1024 --fstype=ext4
229autopart""")
230
231        self.assert_parse_error("""
232raid / --device=md0 --level=0 raid.01
233autopart""")
234
235        self.assert_parse_error("""
236volgroup vg.01 pv.01 --pesize=70000
237autopart""")
238
239        self.assert_parse_error("""
240logvol / --size=10240 --name=NAME --vgname=VGNAM
241autopart""")
242
243
244class F23_TestCase(F21_TestCase):
245    def runTest(self):
246        F21_TestCase.runTest(self)
247
248class F23_Conflict_TestCase(F21_Conflict_TestCase):
249    """
250        reqpart was added in Fedora 23 but the autopart handler
251        wasn't updated. Instead the changes were introduced into
252        F20_AutoPart, which wasn't the best thing to do.
253    """
254    def __init__(self, *args, **kwargs):
255        F21_Conflict_TestCase.__init__(self, *args, **kwargs)
256        self.version = F23
257
258    def runTest(self):
259        F21_Conflict_TestCase.runTest(self)
260
261        self.assert_parse_error("""
262reqpart
263autopart""")
264
265
266class RHEL7_TestCase(F21_TestCase):
267    def runTest(self):
268        F21_TestCase.runTest(self)
269
270        # pass
271        self.assert_parse("autopart --nohome",
272                          "autopart --nohome\n")
273
274        # fail
275        self.assert_parse_error("autopart --nohome=xxx")
276        self.assert_parse_error("autopart --nohome True")
277        self.assert_parse_error("autopart --nohome=1")
278        self.assert_parse_error("autopart --nohome 0")
279
280class RHEL7_Conflict_TestCase(CommandSequenceTest):
281    def __init__(self, *args, **kwargs):
282        CommandSequenceTest.__init__(self, *args, **kwargs)
283        self.version = RHEL7
284
285    def runTest(self):
286        self.assert_parse_error("""
287reqpart
288autopart""")
289
290
291class F26_TestCase(F23_TestCase):
292    def runTest(self):
293        F23_TestCase.runTest(self)
294
295        # pass
296        self.assert_parse("autopart --nohome",
297                          'autopart --nohome\n')
298        self.assert_parse("autopart --noboot",
299                          'autopart --noboot\n')
300        self.assert_parse("autopart --noswap",
301                          'autopart --noswap\n')
302        self.assert_parse("autopart --nohome --noboot --noswap",
303                          'autopart --nohome --noboot --noswap\n')
304
305        # fail
306        self.assert_parse_error("autopart --nohome=xxx")
307        self.assert_parse_error("autopart --nohome True")
308        self.assert_parse_error("autopart --nohome=1")
309        self.assert_parse_error("autopart --nohome 0")
310
311        self.assert_parse_error("autopart --noboot=xxx")
312        self.assert_parse_error("autopart --noboot True")
313        self.assert_parse_error("autopart --noboot=1")
314        self.assert_parse_error("autopart --noboot 0")
315
316        self.assert_parse_error("autopart --noswap=xxx")
317        self.assert_parse_error("autopart --noswap True")
318        self.assert_parse_error("autopart --noswap=1")
319        self.assert_parse_error("autopart --noswap 0")
320
321class F26_Conflict_TestCase(F23_Conflict_TestCase):
322    def runTest(self):
323        F23_Conflict_TestCase.runTest(self)
324
325class F29_TestCase(F26_TestCase):
326    def runTest(self):
327        F26_TestCase.runTest(self)
328
329        self.assert_parse("autopart --encrypted --luks-version=luks2",
330                          "autopart --encrypted --luks-version=luks2\n")
331
332        self.assert_parse("autopart --encrypted --pbkdf=argon2i",
333                          "autopart --encrypted --pbkdf=argon2i\n")
334
335        self.assert_parse("autopart --encrypted --pbkdf-memory=256",
336                          "autopart --encrypted --pbkdf-memory=256\n")
337
338        self.assert_parse("autopart --encrypted --pbkdf-time=100",
339                          "autopart --encrypted --pbkdf-time=100\n")
340
341        self.assert_parse("autopart --encrypted --pbkdf-iterations=1000",
342                          "autopart --encrypted --pbkdf-iterations=1000\n")
343
344        self.assert_parse_error("autopart --encrypted --pbkdf-time=100 --pbkdf-iterations=1000")
345
346class RHEL8_TestCase(F29_TestCase):
347    def runTest(self):
348        F29_TestCase.runTest(self)
349        self.assert_parse_error("autopart --type=btrfs")
350
351if __name__ == "__main__":
352    unittest.main()
353
Full Screen

15.1.2.3-1.js

Source: 15.1.2.3-1.js Github

copy
1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is Mozilla Communicator client code, released
16 * March 31, 1998.
17 *
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 1998
21 * the Initial Developer. All Rights Reserved.
22 *
23 * Contributor(s):
24 *
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
36 *
37 * ***** END LICENSE BLOCK ***** */
38
39gTestfile = '15.1.2.3-1.js';
40
41/**
42   File Name:          15.1.2.3.js
43   ECMA Section:       15.1.2.3 Function properties of the global object:
44   parseFloat( string )
45
46   Description:        The parseFloat function produces a number value dictated
47   by the interpretation of the contents of the string
48   argument defined as a decimal literal.
49
50   When the parseFloat function is called, the following
51   steps are taken:
52
53   1.  Call ToString( string ).
54   2.  Remove leading whitespace Result(1).
55   3.  If neither Result(2) nor any prefix of Result(2)
56   satisfies the syntax of a StrDecimalLiteral,
57   return NaN.
58   4.  Compute the longest prefix of Result(2) which might
59   be Resusult(2) itself, that satisfies the syntax of
60   a StrDecimalLiteral
61   5.  Return the number value for the MV of Result(4).
62
63   Note that parseFloate may interpret only a leading
64   portion of the string as a number value; it ignores any
65   characters that cannot be interpreted as part of the
66   notation of a decimal literal, and no indication is given
67   that such characters were ignored.
68
69   StrDecimalLiteral::
70   Infinity
71   DecimalDigits.DecimalDigits opt ExponentPart opt
72   .DecimalDigits ExponentPart opt
73   DecimalDigits ExponentPart opt
74
75   Author:             christine@netscape.com
76   Date:               28 october 1997
77
78*/
79
80var SECTION = "15.1.2.3-1";
81var VERSION = "ECMA_1";
82var TITLE   = "parseFloat(string)";
83var BUGNUMBER="none";
84
85startTest();
86writeHeaderToLog( SECTION + " "+ TITLE);
87
88new TestCase( SECTION, "parseFloat.length",     1,              parseFloat.length );
89
90new TestCase( SECTION, "parseFloat.length = null; parseFloat.length",   1,      eval("parseFloat.length = null; parseFloat.length") );
91new TestCase( SECTION, "delete parseFloat.length",                      false,  delete parseFloat.length );
92new TestCase( SECTION, "delete parseFloat.length; parseFloat.length",   1,      eval("delete parseFloat.length; parseFloat.length") );
93new TestCase( SECTION, "var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS", "prototype", eval("var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS") );
94
95new TestCase( SECTION, "parseFloat()",          Number.NaN,     parseFloat() );
96new TestCase( SECTION, "parseFloat('')",        Number.NaN,     parseFloat('') );
97
98new TestCase( SECTION, "parseFloat(' ')",       Number.NaN,     parseFloat(' ') );
99new TestCase( SECTION, "parseFloat(true)",      Number.NaN,     parseFloat(true) );
100new TestCase( SECTION, "parseFloat(false)",     Number.NaN,     parseFloat(false) );
101new TestCase( SECTION, "parseFloat('string')",  Number.NaN,     parseFloat("string") );
102
103new TestCase( SECTION, "parseFloat('  Infinity')",    Infinity,    parseFloat("Infinity") );
104new TestCase( SECTION, "parseFloat('  Infinity  ')",      Infinity,    parseFloat('  Infinity  ') );
105
106new TestCase( SECTION, "parseFloat('Infinity')",    Infinity,    parseFloat("Infinity") );
107new TestCase( SECTION, "parseFloat(Infinity)",      Infinity,    parseFloat(Infinity) );
108
109
110new TestCase( SECTION, "parseFloat('  +Infinity')",         +Infinity,    parseFloat("+Infinity") );
111new TestCase( SECTION, "parseFloat('  -Infinity  ')",      -Infinity,    parseFloat('  -Infinity  ') );
112
113new TestCase( SECTION, "parseFloat('+Infinity')",    +Infinity,    parseFloat("+Infinity") );
114new TestCase( SECTION, "parseFloat(-Infinity)",      -Infinity,    parseFloat(-Infinity) );
115
116new TestCase( SECTION,  "parseFloat('0')",          0,          parseFloat("0") );
117new TestCase( SECTION,  "parseFloat('-0')",         -0,         parseFloat("-0") );
118new TestCase( SECTION,  "parseFloat('+0')",          0,         parseFloat("+0") );
119
120new TestCase( SECTION,  "parseFloat('1')",          1,          parseFloat("1") );
121new TestCase( SECTION,  "parseFloat('-1')",         -1,         parseFloat("-1") );
122new TestCase( SECTION,  "parseFloat('+1')",          1,         parseFloat("+1") );
123
124new TestCase( SECTION,  "parseFloat('2')",          2,          parseFloat("2") );
125new TestCase( SECTION,  "parseFloat('-2')",         -2,         parseFloat("-2") );
126new TestCase( SECTION,  "parseFloat('+2')",          2,         parseFloat("+2") );
127
128new TestCase( SECTION,  "parseFloat('3')",          3,          parseFloat("3") );
129new TestCase( SECTION,  "parseFloat('-3')",         -3,         parseFloat("-3") );
130new TestCase( SECTION,  "parseFloat('+3')",          3,         parseFloat("+3") );
131
132new TestCase( SECTION,  "parseFloat('4')",          4,          parseFloat("4") );
133new TestCase( SECTION,  "parseFloat('-4')",         -4,         parseFloat("-4") );
134new TestCase( SECTION,  "parseFloat('+4')",          4,         parseFloat("+4") );
135
136new TestCase( SECTION,  "parseFloat('5')",          5,          parseFloat("5") );
137new TestCase( SECTION,  "parseFloat('-5')",         -5,         parseFloat("-5") );
138new TestCase( SECTION,  "parseFloat('+5')",          5,         parseFloat("+5") );
139
140new TestCase( SECTION,  "parseFloat('6')",          6,          parseFloat("6") );
141new TestCase( SECTION,  "parseFloat('-6')",         -6,         parseFloat("-6") );
142new TestCase( SECTION,  "parseFloat('+6')",          6,         parseFloat("+6") );
143
144new TestCase( SECTION,  "parseFloat('7')",          7,          parseFloat("7") );
145new TestCase( SECTION,  "parseFloat('-7')",         -7,         parseFloat("-7") );
146new TestCase( SECTION,  "parseFloat('+7')",          7,         parseFloat("+7") );
147
148new TestCase( SECTION,  "parseFloat('8')",          8,          parseFloat("8") );
149new TestCase( SECTION,  "parseFloat('-8')",         -8,         parseFloat("-8") );
150new TestCase( SECTION,  "parseFloat('+8')",          8,         parseFloat("+8") );
151
152new TestCase( SECTION,  "parseFloat('9')",          9,          parseFloat("9") );
153new TestCase( SECTION,  "parseFloat('-9')",         -9,         parseFloat("-9") );
154new TestCase( SECTION,  "parseFloat('+9')",          9,         parseFloat("+9") );
155
156new TestCase( SECTION,  "parseFloat('3.14159')",    3.14159,    parseFloat("3.14159") );
157new TestCase( SECTION,  "parseFloat('-3.14159')",   -3.14159,   parseFloat("-3.14159") );
158new TestCase( SECTION,  "parseFloat('+3.14159')",   3.14159,    parseFloat("+3.14159") );
159
160new TestCase( SECTION,  "parseFloat('3.')",         3,          parseFloat("3.") );
161new TestCase( SECTION,  "parseFloat('-3.')",        -3,         parseFloat("-3.") );
162new TestCase( SECTION,  "parseFloat('+3.')",        3,          parseFloat("+3.") );
163
164new TestCase( SECTION,  "parseFloat('3.e1')",       30,         parseFloat("3.e1") );
165new TestCase( SECTION,  "parseFloat('-3.e1')",      -30,        parseFloat("-3.e1") );
166new TestCase( SECTION,  "parseFloat('+3.e1')",      30,         parseFloat("+3.e1") );
167
168new TestCase( SECTION,  "parseFloat('3.e+1')",       30,         parseFloat("3.e+1") );
169new TestCase( SECTION,  "parseFloat('-3.e+1')",      -30,        parseFloat("-3.e+1") );
170new TestCase( SECTION,  "parseFloat('+3.e+1')",      30,         parseFloat("+3.e+1") );
171
172new TestCase( SECTION,  "parseFloat('3.e-1')",       .30,         parseFloat("3.e-1") );
173new TestCase( SECTION,  "parseFloat('-3.e-1')",      -.30,        parseFloat("-3.e-1") );
174new TestCase( SECTION,  "parseFloat('+3.e-1')",      .30,         parseFloat("+3.e-1") );
175
176// StrDecimalLiteral:::  .DecimalDigits ExponentPart opt
177
178new TestCase( SECTION,  "parseFloat('.00001')",     0.00001,    parseFloat(".00001") );
179new TestCase( SECTION,  "parseFloat('+.00001')",    0.00001,    parseFloat("+.00001") );
180new TestCase( SECTION,  "parseFloat('-0.0001')",    -0.00001,   parseFloat("-.00001") );
181
182new TestCase( SECTION,  "parseFloat('.01e2')",      1,          parseFloat(".01e2") );
183new TestCase( SECTION,  "parseFloat('+.01e2')",     1,          parseFloat("+.01e2") );
184new TestCase( SECTION,  "parseFloat('-.01e2')",     -1,         parseFloat("-.01e2") );
185
186new TestCase( SECTION,  "parseFloat('.01e+2')",      1,         parseFloat(".01e+2") );
187new TestCase( SECTION,  "parseFloat('+.01e+2')",     1,         parseFloat("+.01e+2") );
188new TestCase( SECTION,  "parseFloat('-.01e+2')",     -1,        parseFloat("-.01e+2") );
189
190new TestCase( SECTION,  "parseFloat('.01e-2')",      0.0001,    parseFloat(".01e-2") );
191new TestCase( SECTION,  "parseFloat('+.01e-2')",     0.0001,    parseFloat("+.01e-2") );
192new TestCase( SECTION,  "parseFloat('-.01e-2')",     -0.0001,   parseFloat("-.01e-2") );
193
194//  StrDecimalLiteral:::    DecimalDigits ExponentPart opt
195
196new TestCase( SECTION,  "parseFloat('1234e5')",     123400000,  parseFloat("1234e5") );
197new TestCase( SECTION,  "parseFloat('+1234e5')",    123400000,  parseFloat("+1234e5") );
198new TestCase( SECTION,  "parseFloat('-1234e5')",    -123400000, parseFloat("-1234e5") );
199
200new TestCase( SECTION,  "parseFloat('1234e+5')",    123400000,  parseFloat("1234e+5") );
201new TestCase( SECTION,  "parseFloat('+1234e+5')",   123400000,  parseFloat("+1234e+5") );
202new TestCase( SECTION,  "parseFloat('-1234e+5')",   -123400000, parseFloat("-1234e+5") );
203
204new TestCase( SECTION,  "parseFloat('1234e-5')",     0.01234,  parseFloat("1234e-5") );
205new TestCase( SECTION,  "parseFloat('+1234e-5')",    0.01234,  parseFloat("+1234e-5") );
206new TestCase( SECTION,  "parseFloat('-1234e-5')",    -0.01234, parseFloat("-1234e-5") );
207
208
209new TestCase( SECTION,  "parseFloat(0)",          0,          parseFloat(0) );
210new TestCase( SECTION,  "parseFloat(-0)",         -0,         parseFloat(-0) );
211
212new TestCase( SECTION,  "parseFloat(1)",          1,          parseFloat(1) );
213new TestCase( SECTION,  "parseFloat(-1)",         -1,         parseFloat(-1) );
214
215new TestCase( SECTION,  "parseFloat(2)",          2,          parseFloat(2) );
216new TestCase( SECTION,  "parseFloat(-2)",         -2,         parseFloat(-2) );
217
218new TestCase( SECTION,  "parseFloat(3)",          3,          parseFloat(3) );
219new TestCase( SECTION,  "parseFloat(-3)",         -3,         parseFloat(-3) );
220
221new TestCase( SECTION,  "parseFloat(4)",          4,          parseFloat(4) );
222new TestCase( SECTION,  "parseFloat(-4)",         -4,         parseFloat(-4) );
223
224new TestCase( SECTION,  "parseFloat(5)",          5,          parseFloat(5) );
225new TestCase( SECTION,  "parseFloat(-5)",         -5,         parseFloat(-5) );
226
227new TestCase( SECTION,  "parseFloat(6)",          6,          parseFloat(6) );
228new TestCase( SECTION,  "parseFloat(-6)",         -6,         parseFloat(-6) );
229
230new TestCase( SECTION,  "parseFloat(7)",          7,          parseFloat(7) );
231new TestCase( SECTION,  "parseFloat(-7)",         -7,         parseFloat(-7) );
232
233new TestCase( SECTION,  "parseFloat(8)",          8,          parseFloat(8) );
234new TestCase( SECTION,  "parseFloat(-8)",         -8,         parseFloat(-8) );
235
236new TestCase( SECTION,  "parseFloat(9)",          9,          parseFloat(9) );
237new TestCase( SECTION,  "parseFloat(-9)",         -9,         parseFloat(-9) );
238
239new TestCase( SECTION,  "parseFloat(3.14159)",    3.14159,    parseFloat(3.14159) );
240new TestCase( SECTION,  "parseFloat(-3.14159)",   -3.14159,   parseFloat(-3.14159) );
241
242new TestCase( SECTION,  "parseFloat(3.)",         3,          parseFloat(3.) );
243new TestCase( SECTION,  "parseFloat(-3.)",        -3,         parseFloat(-3.) );
244
245new TestCase( SECTION,  "parseFloat(3.e1)",       30,         parseFloat(3.e1) );
246new TestCase( SECTION,  "parseFloat(-3.e1)",      -30,        parseFloat(-3.e1) );
247
248new TestCase( SECTION,  "parseFloat(3.e+1)",       30,         parseFloat(3.e+1) );
249new TestCase( SECTION,  "parseFloat(-3.e+1)",      -30,        parseFloat(-3.e+1) );
250
251new TestCase( SECTION,  "parseFloat(3.e-1)",       .30,         parseFloat(3.e-1) );
252new TestCase( SECTION,  "parseFloat(-3.e-1)",      -.30,        parseFloat(-3.e-1) );
253
254
255new TestCase( SECTION,  "parseFloat(3.E1)",       30,         parseFloat(3.E1) );
256new TestCase( SECTION,  "parseFloat(-3.E1)",      -30,        parseFloat(-3.E1) );
257
258new TestCase( SECTION,  "parseFloat(3.E+1)",       30,         parseFloat(3.E+1) );
259new TestCase( SECTION,  "parseFloat(-3.E+1)",      -30,        parseFloat(-3.E+1) );
260
261new TestCase( SECTION,  "parseFloat(3.E-1)",       .30,         parseFloat(3.E-1) );
262new TestCase( SECTION,  "parseFloat(-3.E-1)",      -.30,        parseFloat(-3.E-1) );
263
264// StrDecimalLiteral:::  .DecimalDigits ExponentPart opt
265
266new TestCase( SECTION,  "parseFloat(.00001)",     0.00001,    parseFloat(.00001) );
267new TestCase( SECTION,  "parseFloat(-0.0001)",    -0.00001,   parseFloat(-.00001) );
268
269new TestCase( SECTION,  "parseFloat(.01e2)",      1,          parseFloat(.01e2) );
270new TestCase( SECTION,  "parseFloat(-.01e2)",     -1,         parseFloat(-.01e2) );
271
272new TestCase( SECTION,  "parseFloat(.01e+2)",      1,         parseFloat(.01e+2) );
273new TestCase( SECTION,  "parseFloat(-.01e+2)",     -1,        parseFloat(-.01e+2) );
274
275new TestCase( SECTION,  "parseFloat(.01e-2)",      0.0001,    parseFloat(.01e-2) );
276new TestCase( SECTION,  "parseFloat(-.01e-2)",     -0.0001,   parseFloat(-.01e-2) );
277
278//  StrDecimalLiteral:::    DecimalDigits ExponentPart opt
279
280new TestCase( SECTION,  "parseFloat(1234e5)",     123400000,  parseFloat(1234e5) );
281new TestCase( SECTION,  "parseFloat(-1234e5)",    -123400000, parseFloat(-1234e5) );
282
283new TestCase( SECTION,  "parseFloat(1234e+5)",    123400000,  parseFloat(1234e+5) );
284new TestCase( SECTION,  "parseFloat(-1234e+5)",   -123400000, parseFloat(-1234e+5) );
285
286new TestCase( SECTION,  "parseFloat(1234e-5)",     0.01234,  parseFloat(1234e-5) );
287new TestCase( SECTION,  "parseFloat(-1234e-5)",    -0.01234, parseFloat(-1234e-5) );
288
289// hex cases should all return 0  (0 is the longest string that satisfies a StringDecimalLiteral)
290
291new TestCase( SECTION,  "parseFloat('0x0')",        0,         parseFloat("0x0"));
292new TestCase( SECTION,  "parseFloat('0x1')",        0,         parseFloat("0x1"));
293new TestCase( SECTION,  "parseFloat('0x2')",        0,         parseFloat("0x2"));
294new TestCase( SECTION,  "parseFloat('0x3')",        0,         parseFloat("0x3"));
295new TestCase( SECTION,  "parseFloat('0x4')",        0,         parseFloat("0x4"));
296new TestCase( SECTION,  "parseFloat('0x5')",        0,         parseFloat("0x5"));
297new TestCase( SECTION,  "parseFloat('0x6')",        0,         parseFloat("0x6"));
298new TestCase( SECTION,  "parseFloat('0x7')",        0,         parseFloat("0x7"));
299new TestCase( SECTION,  "parseFloat('0x8')",        0,         parseFloat("0x8"));
300new TestCase( SECTION,  "parseFloat('0x9')",        0,         parseFloat("0x9"));
301new TestCase( SECTION,  "parseFloat('0xa')",        0,         parseFloat("0xa"));
302new TestCase( SECTION,  "parseFloat('0xb')",        0,         parseFloat("0xb"));
303new TestCase( SECTION,  "parseFloat('0xc')",        0,         parseFloat("0xc"));
304new TestCase( SECTION,  "parseFloat('0xd')",        0,         parseFloat("0xd"));
305new TestCase( SECTION,  "parseFloat('0xe')",        0,         parseFloat("0xe"));
306new TestCase( SECTION,  "parseFloat('0xf')",        0,         parseFloat("0xf"));
307new TestCase( SECTION,  "parseFloat('0xA')",        0,         parseFloat("0xA"));
308new TestCase( SECTION,  "parseFloat('0xB')",        0,         parseFloat("0xB"));
309new TestCase( SECTION,  "parseFloat('0xC')",        0,         parseFloat("0xC"));
310new TestCase( SECTION,  "parseFloat('0xD')",        0,         parseFloat("0xD"));
311new TestCase( SECTION,  "parseFloat('0xE')",        0,         parseFloat("0xE"));
312new TestCase( SECTION,  "parseFloat('0xF')",        0,         parseFloat("0xF"));
313
314new TestCase( SECTION,  "parseFloat('0X0')",        0,         parseFloat("0X0"));
315new TestCase( SECTION,  "parseFloat('0X1')",        0,         parseFloat("0X1"));
316new TestCase( SECTION,  "parseFloat('0X2')",        0,         parseFloat("0X2"));
317new TestCase( SECTION,  "parseFloat('0X3')",        0,         parseFloat("0X3"));
318new TestCase( SECTION,  "parseFloat('0X4')",        0,         parseFloat("0X4"));
319new TestCase( SECTION,  "parseFloat('0X5')",        0,         parseFloat("0X5"));
320new TestCase( SECTION,  "parseFloat('0X6')",        0,         parseFloat("0X6"));
321new TestCase( SECTION,  "parseFloat('0X7')",        0,         parseFloat("0X7"));
322new TestCase( SECTION,  "parseFloat('0X8')",        0,         parseFloat("0X8"));
323new TestCase( SECTION,  "parseFloat('0X9')",        0,         parseFloat("0X9"));
324new TestCase( SECTION,  "parseFloat('0Xa')",        0,         parseFloat("0Xa"));
325new TestCase( SECTION,  "parseFloat('0Xb')",        0,         parseFloat("0Xb"));
326new TestCase( SECTION,  "parseFloat('0Xc')",        0,         parseFloat("0Xc"));
327new TestCase( SECTION,  "parseFloat('0Xd')",        0,         parseFloat("0Xd"));
328new TestCase( SECTION,  "parseFloat('0Xe')",        0,         parseFloat("0Xe"));
329new TestCase( SECTION,  "parseFloat('0Xf')",        0,         parseFloat("0Xf"));
330new TestCase( SECTION,  "parseFloat('0XA')",        0,         parseFloat("0XA"));
331new TestCase( SECTION,  "parseFloat('0XB')",        0,         parseFloat("0XB"));
332new TestCase( SECTION,  "parseFloat('0XC')",        0,         parseFloat("0XC"));
333new TestCase( SECTION,  "parseFloat('0XD')",        0,         parseFloat("0XD"));
334new TestCase( SECTION,  "parseFloat('0XE')",        0,         parseFloat("0XE"));
335new TestCase( SECTION,  "parseFloat('0XF')",        0,         parseFloat("0XF"));
336new TestCase( SECTION,  "parseFloat('  0XF  ')",    0,         parseFloat("  0XF  "));
337
338// hex literals should still succeed
339
340new TestCase( SECTION,  "parseFloat(0x0)",        0,          parseFloat(0x0));
341new TestCase( SECTION,  "parseFloat(0x1)",        1,          parseFloat(0x1));
342new TestCase( SECTION,  "parseFloat(0x2)",        2,          parseFloat(0x2));
343new TestCase( SECTION,  "parseFloat(0x3)",        3,          parseFloat(0x3));
344new TestCase( SECTION,  "parseFloat(0x4)",        4,          parseFloat(0x4));
345new TestCase( SECTION,  "parseFloat(0x5)",        5,          parseFloat(0x5));
346new TestCase( SECTION,  "parseFloat(0x6)",        6,          parseFloat(0x6));
347new TestCase( SECTION,  "parseFloat(0x7)",        7,          parseFloat(0x7));
348new TestCase( SECTION,  "parseFloat(0x8)",        8,          parseFloat(0x8));
349new TestCase( SECTION,  "parseFloat(0x9)",        9,          parseFloat(0x9));
350new TestCase( SECTION,  "parseFloat(0xa)",        10,         parseFloat(0xa));
351new TestCase( SECTION,  "parseFloat(0xb)",        11,         parseFloat(0xb));
352new TestCase( SECTION,  "parseFloat(0xc)",        12,         parseFloat(0xc));
353new TestCase( SECTION,  "parseFloat(0xd)",        13,         parseFloat(0xd));
354new TestCase( SECTION,  "parseFloat(0xe)",        14,         parseFloat(0xe));
355new TestCase( SECTION,  "parseFloat(0xf)",        15,         parseFloat(0xf));
356new TestCase( SECTION,  "parseFloat(0xA)",        10,         parseFloat(0xA));
357new TestCase( SECTION,  "parseFloat(0xB)",        11,         parseFloat(0xB));
358new TestCase( SECTION,  "parseFloat(0xC)",        12,         parseFloat(0xC));
359new TestCase( SECTION,  "parseFloat(0xD)",        13,         parseFloat(0xD));
360new TestCase( SECTION,  "parseFloat(0xE)",        14,         parseFloat(0xE));
361new TestCase( SECTION,  "parseFloat(0xF)",        15,         parseFloat(0xF));
362
363new TestCase( SECTION,  "parseFloat(0X0)",        0,          parseFloat(0X0));
364new TestCase( SECTION,  "parseFloat(0X1)",        1,          parseFloat(0X1));
365new TestCase( SECTION,  "parseFloat(0X2)",        2,          parseFloat(0X2));
366new TestCase( SECTION,  "parseFloat(0X3)",        3,          parseFloat(0X3));
367new TestCase( SECTION,  "parseFloat(0X4)",        4,          parseFloat(0X4));
368new TestCase( SECTION,  "parseFloat(0X5)",        5,          parseFloat(0X5));
369new TestCase( SECTION,  "parseFloat(0X6)",        6,          parseFloat(0X6));
370new TestCase( SECTION,  "parseFloat(0X7)",        7,          parseFloat(0X7));
371new TestCase( SECTION,  "parseFloat(0X8)",        8,          parseFloat(0X8));
372new TestCase( SECTION,  "parseFloat(0X9)",        9,          parseFloat(0X9));
373new TestCase( SECTION,  "parseFloat(0Xa)",        10,         parseFloat(0Xa));
374new TestCase( SECTION,  "parseFloat(0Xb)",        11,         parseFloat(0Xb));
375new TestCase( SECTION,  "parseFloat(0Xc)",        12,         parseFloat(0Xc));
376new TestCase( SECTION,  "parseFloat(0Xd)",        13,         parseFloat(0Xd));
377new TestCase( SECTION,  "parseFloat(0Xe)",        14,         parseFloat(0Xe));
378new TestCase( SECTION,  "parseFloat(0Xf)",        15,         parseFloat(0Xf));
379new TestCase( SECTION,  "parseFloat(0XA)",        10,         parseFloat(0XA));
380new TestCase( SECTION,  "parseFloat(0XB)",        11,         parseFloat(0XB));
381new TestCase( SECTION,  "parseFloat(0XC)",        12,         parseFloat(0XC));
382new TestCase( SECTION,  "parseFloat(0XD)",        13,         parseFloat(0XD));
383new TestCase( SECTION,  "parseFloat(0XE)",        14,         parseFloat(0XE));
384new TestCase( SECTION,  "parseFloat(0XF)",        15,         parseFloat(0XF));
385
386
387// A StringNumericLiteral may not use octal notation
388
389new TestCase( SECTION,  "parseFloat('00')",        0,         parseFloat("00"));
390new TestCase( SECTION,  "parseFloat('01')",        1,         parseFloat("01"));
391new TestCase( SECTION,  "parseFloat('02')",        2,         parseFloat("02"));
392new TestCase( SECTION,  "parseFloat('03')",        3,         parseFloat("03"));
393new TestCase( SECTION,  "parseFloat('04')",        4,         parseFloat("04"));
394new TestCase( SECTION,  "parseFloat('05')",        5,         parseFloat("05"));
395new TestCase( SECTION,  "parseFloat('06')",        6,         parseFloat("06"));
396new TestCase( SECTION,  "parseFloat('07')",        7,         parseFloat("07"));
397new TestCase( SECTION,  "parseFloat('010')",       10,        parseFloat("010"));
398new TestCase( SECTION,  "parseFloat('011')",       11,        parseFloat("011"));
399
400// A StringNumericLIteral may have any number of leading 0 digits
401
402new TestCase( SECTION,  "parseFloat('001')",        1,         parseFloat("001"));
403new TestCase( SECTION,  "parseFloat('0001')",       1,         parseFloat("0001"));
404new TestCase( SECTION,  "parseFloat('  0001  ')",       1,         parseFloat("  0001  "));
405
406// an octal numeric literal should be treated as an octal
407
408new TestCase( SECTION,  "parseFloat(00)",        0,         parseFloat(00));
409new TestCase( SECTION,  "parseFloat(01)",        1,         parseFloat(01));
410new TestCase( SECTION,  "parseFloat(02)",        2,         parseFloat(02));
411new TestCase( SECTION,  "parseFloat(03)",        3,         parseFloat(03));
412new TestCase( SECTION,  "parseFloat(04)",        4,         parseFloat(04));
413new TestCase( SECTION,  "parseFloat(05)",        5,         parseFloat(05));
414new TestCase( SECTION,  "parseFloat(06)",        6,         parseFloat(06));
415new TestCase( SECTION,  "parseFloat(07)",        7,         parseFloat(07));
416new TestCase( SECTION,  "parseFloat(010)",       8,        parseFloat(010));
417new TestCase( SECTION,  "parseFloat(011)",       9,        parseFloat(011));
418
419// A StringNumericLIteral may have any number of leading 0 digits
420
421new TestCase( SECTION,  "parseFloat(001)",        1,         parseFloat(001));
422new TestCase( SECTION,  "parseFloat(0001)",       1,         parseFloat(0001));
423
424// make sure it's reflexive
425new TestCase( SECTION,  "parseFloat(Math.PI)",      Math.PI,        parseFloat(Math.PI));
426new TestCase( SECTION,  "parseFloat(Math.LN2)",     Math.LN2,       parseFloat(Math.LN2));
427new TestCase( SECTION,  "parseFloat(Math.LN10)",    Math.LN10,      parseFloat(Math.LN10));
428new TestCase( SECTION,  "parseFloat(Math.LOG2E)",   Math.LOG2E,     parseFloat(Math.LOG2E));
429new TestCase( SECTION,  "parseFloat(Math.LOG10E)",  Math.LOG10E,    parseFloat(Math.LOG10E));
430new TestCase( SECTION,  "parseFloat(Math.SQRT2)",   Math.SQRT2,     parseFloat(Math.SQRT2));
431new TestCase( SECTION,  "parseFloat(Math.SQRT1_2)", Math.SQRT1_2,   parseFloat(Math.SQRT1_2));
432
433new TestCase( SECTION,  "parseFloat(Math.PI+'')",      Math.PI,        parseFloat(Math.PI+''));
434new TestCase( SECTION,  "parseFloat(Math.LN2+'')",     Math.LN2,       parseFloat(Math.LN2+''));
435new TestCase( SECTION,  "parseFloat(Math.LN10+'')",    Math.LN10,      parseFloat(Math.LN10+''));
436new TestCase( SECTION,  "parseFloat(Math.LOG2E+'')",   Math.LOG2E,     parseFloat(Math.LOG2E+''));
437new TestCase( SECTION,  "parseFloat(Math.LOG10E+'')",  Math.LOG10E,    parseFloat(Math.LOG10E+''));
438new TestCase( SECTION,  "parseFloat(Math.SQRT2+'')",   Math.SQRT2,     parseFloat(Math.SQRT2+''));
439new TestCase( SECTION,  "parseFloat(Math.SQRT1_2+'')", Math.SQRT1_2,   parseFloat(Math.SQRT1_2+''));
440
441test();
442
Full Screen

15.1.2.3-2.js

Source: 15.1.2.3-2.js Github

copy
1/* The contents of this file are subject to the Netscape Public
2 * License Version 1.1 (the "License"); you may not use this file
3 * except in compliance with the License. You may obtain a copy of
4 * the License at http://www.mozilla.org/NPL/
5 *
6 * Software distributed under the License is distributed on an "AS
7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
8 * implied. See the License for the specific language governing
9 * rights and limitations under the License.
10 *
11 * The Original Code is Mozilla Communicator client code, released March
12 * 31, 1998.
13 *
14 * The Initial Developer of the Original Code is Netscape Communications
15 * Corporation. Portions created by Netscape are
16 * Copyright (C) 1998 Netscape Communications Corporation. All
17 * Rights Reserved.
18 *
19 * Contributor(s): 
20 * 
21 */
22/**
23    File Name:          15.1.2.3-2.js
24    ECMA Section:       15.1.2.3 Function properties of the global object:
25                        parseFloat( string )
26
27    Description:        The parseFloat function produces a number value dictated
28                        by the interpretation of the contents of the string
29                        argument defined as a decimal literal.
30
31                        When the parseFloat function is called, the following
32                        steps are taken:
33
34                        1.  Call ToString( string ).
35                        2.  Remove leading whitespace Result(1).
36                        3.  If neither Result(2) nor any prefix of Result(2)
37                            satisfies the syntax of a StrDecimalLiteral,
38                            return NaN.
39                        4.  Compute the longest prefix of Result(2) which might
40                            be Resusult(2) itself, that satisfies the syntax of
41                            a StrDecimalLiteral
42                        5.  Return the number value for the MV of Result(4).
43
44                        Note that parseFloate may interpret only a leading
45                        portion of the string as a number value; it ignores any
46                        characters that cannot be interpreted as part of the
47                        notation of a decimal literal, and no indication is given
48                        that such characters were ignored.
49
50                        StrDecimalLiteral::
51                        Infinity
52                        DecimalDigits.DecimalDigits opt ExponentPart opt
53                        .DecimalDigits ExponentPart opt
54                        DecimalDigits ExponentPart opt
55
56    Author:             christine@netscape.com
57    Date:               28 october 1997
58
59*/
60    var SECTION = "15.1.2.3-2";
61    var VERSION = "ECMA_1";
62    startTest();
63
64    var BUGNUMBER = "77391";
65
66    var testcases = getTestCases();
67
68    writeHeaderToLog( SECTION + " parseFloat(string)");
69    test();
70
71function getTestCases() {
72    var array = new Array();
73    var item = 0;
74
75    array[item++] = new TestCase( SECTION, "parseFloat(true)",      Number.NaN,     parseFloat(true) );
76    array[item++] = new TestCase( SECTION, "parseFloat(false)",     Number.NaN,     parseFloat(false) );
77    array[item++] = new TestCase( SECTION, "parseFloat('string')",  Number.NaN,     parseFloat("string") );
78
79    array[item++] = new TestCase( SECTION, "parseFloat('     Infinity')",      Number.POSITIVE_INFINITY,    parseFloat("Infinity") );
80//    array[item++] = new TestCase( SECTION, "parseFloat(Infinity)",      Number.POSITIVE_INFINITY,    parseFloat(Infinity) );
81
82    array[item++] = new TestCase( SECTION,  "parseFloat('          0')",          0,          parseFloat("          0") );
83    array[item++] = new TestCase( SECTION,  "parseFloat('          -0')",         -0,         parseFloat("          -0") );
84    array[item++] = new TestCase( SECTION,  "parseFloat('          +0')",          0,         parseFloat("          +0") );
85
86    array[item++] = new TestCase( SECTION,  "parseFloat('          1')",          1,          parseFloat("          1") );
87    array[item++] = new TestCase( SECTION,  "parseFloat('          -1')",         -1,         parseFloat("          -1") );
88    array[item++] = new TestCase( SECTION,  "parseFloat('          +1')",          1,         parseFloat("          +1") );
89
90    array[item++] = new TestCase( SECTION,  "parseFloat('          2')",          2,          parseFloat("          2") );
91    array[item++] = new TestCase( SECTION,  "parseFloat('          -2')",         -2,         parseFloat("          -2") );
92    array[item++] = new TestCase( SECTION,  "parseFloat('          +2')",          2,         parseFloat("          +2") );
93
94    array[item++] = new TestCase( SECTION,  "parseFloat('          3')",          3,          parseFloat("          3") );
95    array[item++] = new TestCase( SECTION,  "parseFloat('          -3')",         -3,         parseFloat("          -3") );
96    array[item++] = new TestCase( SECTION,  "parseFloat('          +3')",          3,         parseFloat("          +3") );
97
98    array[item++] = new TestCase( SECTION,  "parseFloat('          4')",          4,          parseFloat("          4") );
99    array[item++] = new TestCase( SECTION,  "parseFloat('          -4')",         -4,         parseFloat("          -4") );
100    array[item++] = new TestCase( SECTION,  "parseFloat('          +4')",          4,         parseFloat("          +4") );
101
102    array[item++] = new TestCase( SECTION,  "parseFloat('          5')",          5,          parseFloat("          5") );
103    array[item++] = new TestCase( SECTION,  "parseFloat('          -5')",         -5,         parseFloat("          -5") );
104    array[item++] = new TestCase( SECTION,  "parseFloat('          +5')",          5,         parseFloat("          +5") );
105
106    array[item++] = new TestCase( SECTION,  "parseFloat('          6')",          6,          parseFloat("          6") );
107    array[item++] = new TestCase( SECTION,  "parseFloat('          -6')",         -6,         parseFloat("          -6") );
108    array[item++] = new TestCase( SECTION,  "parseFloat('          +6')",          6,         parseFloat("          +6") );
109
110    array[item++] = new TestCase( SECTION,  "parseFloat('          7')",          7,          parseFloat("          7") );
111    array[item++] = new TestCase( SECTION,  "parseFloat('          -7')",         -7,         parseFloat("          -7") );
112    array[item++] = new TestCase( SECTION,  "parseFloat('          +7')",          7,         parseFloat("          +7") );
113
114    array[item++] = new TestCase( SECTION,  "parseFloat('          8')",          8,          parseFloat("          8") );
115    array[item++] = new TestCase( SECTION,  "parseFloat('          -8')",         -8,         parseFloat("          -8") );
116    array[item++] = new TestCase( SECTION,  "parseFloat('          +8')",          8,         parseFloat("          +8") );
117
118    array[item++] = new TestCase( SECTION,  "parseFloat('          9')",          9,          parseFloat("          9") );
119    array[item++] = new TestCase( SECTION,  "parseFloat('          -9')",         -9,         parseFloat("          -9") );
120    array[item++] = new TestCase( SECTION,  "parseFloat('          +9')",          9,         parseFloat("          +9") );
121
122    array[item++] = new TestCase( SECTION,  "parseFloat('          3.14159')",    3.14159,    parseFloat("          3.14159") );
123    array[item++] = new TestCase( SECTION,  "parseFloat('          -3.14159')",   -3.14159,   parseFloat("          -3.14159") );
124    array[item++] = new TestCase( SECTION,  "parseFloat('          +3.14159')",   3.14159,    parseFloat("          +3.14159") );
125
126    array[item++] = new TestCase( SECTION,  "parseFloat('          3.')",         3,          parseFloat("          3.") );
127    array[item++] = new TestCase( SECTION,  "parseFloat('          -3.')",        -3,         parseFloat("          -3.") );
128    array[item++] = new TestCase( SECTION,  "parseFloat('          +3.')",        3,          parseFloat("          +3.") );
129
130    array[item++] = new TestCase( SECTION,  "parseFloat('          3.e1')",       30,         parseFloat("          3.e1") );
131    array[item++] = new TestCase( SECTION,  "parseFloat('          -3.e1')",      -30,        parseFloat("          -3.e1") );
132    array[item++] = new TestCase( SECTION,  "parseFloat('          +3.e1')",      30,         parseFloat("          +3.e1") );
133
134    array[item++] = new TestCase( SECTION,  "parseFloat('          3.e+1')",       30,         parseFloat("          3.e+1") );
135    array[item++] = new TestCase( SECTION,  "parseFloat('          -3.e+1')",      -30,        parseFloat("          -3.e+1") );
136    array[item++] = new TestCase( SECTION,  "parseFloat('          +3.e+1')",      30,         parseFloat("          +3.e+1") );
137
138    array[item++] = new TestCase( SECTION,  "parseFloat('          3.e-1')",       .30,         parseFloat("          3.e-1") );
139    array[item++] = new TestCase( SECTION,  "parseFloat('          -3.e-1')",      -.30,        parseFloat("          -3.e-1") );
140    array[item++] = new TestCase( SECTION,  "parseFloat('          +3.e-1')",      .30,         parseFloat("          +3.e-1") );
141
142    // StrDecimalLiteral:::  .DecimalDigits ExponentPart opt
143
144    array[item++] = new TestCase( SECTION,  "parseFloat('          .00001')",     0.00001,    parseFloat("          .00001") );
145    array[item++] = new TestCase( SECTION,  "parseFloat('          +.00001')",    0.00001,    parseFloat("          +.00001") );
146    array[item++] = new TestCase( SECTION,  "parseFloat('          -0.0001')",    -0.00001,   parseFloat("          -.00001") );
147
148    array[item++] = new TestCase( SECTION,  "parseFloat('          .01e2')",      1,          parseFloat("          .01e2") );
149    array[item++] = new TestCase( SECTION,  "parseFloat('          +.01e2')",     1,          parseFloat("          +.01e2") );
150    array[item++] = new TestCase( SECTION,  "parseFloat('          -.01e2')",     -1,         parseFloat("          -.01e2") );
151
152    array[item++] = new TestCase( SECTION,  "parseFloat('          .01e+2')",      1,         parseFloat("          .01e+2") );
153    array[item++] = new TestCase( SECTION,  "parseFloat('          +.01e+2')",     1,         parseFloat("          +.01e+2") );
154    array[item++] = new TestCase( SECTION,  "parseFloat('          -.01e+2')",     -1,        parseFloat("          -.01e+2") );
155
156    array[item++] = new TestCase( SECTION,  "parseFloat('          .01e-2')",      0.0001,    parseFloat("          .01e-2") );
157    array[item++] = new TestCase( SECTION,  "parseFloat('          +.01e-2')",     0.0001,    parseFloat("          +.01e-2") );
158    array[item++] = new TestCase( SECTION,  "parseFloat('          -.01e-2')",     -0.0001,   parseFloat("          -.01e-2") );
159
160    //  StrDecimalLiteral:::    DecimalDigits ExponentPart opt
161
162    array[item++] = new TestCase( SECTION,  "parseFloat('          1234e5')",     123400000,  parseFloat("          1234e5") );
163    array[item++] = new TestCase( SECTION,  "parseFloat('          +1234e5')",    123400000,  parseFloat("          +1234e5") );
164    array[item++] = new TestCase( SECTION,  "parseFloat('          -1234e5')",    -123400000, parseFloat("          -1234e5") );
165
166    array[item++] = new TestCase( SECTION,  "parseFloat('          1234e+5')",    123400000,  parseFloat("          1234e+5") );
167    array[item++] = new TestCase( SECTION,  "parseFloat('          +1234e+5')",   123400000,  parseFloat("          +1234e+5") );
168    array[item++] = new TestCase( SECTION,  "parseFloat('          -1234e+5')",   -123400000, parseFloat("          -1234e+5") );
169
170    array[item++] = new TestCase( SECTION,  "parseFloat('          1234e-5')",     0.01234,  parseFloat("          1234e-5") );
171    array[item++] = new TestCase( SECTION,  "parseFloat('          +1234e-5')",    0.01234,  parseFloat("          +1234e-5") );
172    array[item++] = new TestCase( SECTION,  "parseFloat('          -1234e-5')",    -0.01234, parseFloat("          -1234e-5") );
173
174
175    array[item++] = new TestCase( SECTION,  "parseFloat('          .01E2')",      1,          parseFloat("          .01E2") );
176    array[item++] = new TestCase( SECTION,  "parseFloat('          +.01E2')",     1,          parseFloat("          +.01E2") );
177    array[item++] = new TestCase( SECTION,  "parseFloat('          -.01E2')",     -1,         parseFloat("          -.01E2") );
178
179    array[item++] = new TestCase( SECTION,  "parseFloat('          .01E+2')",      1,         parseFloat("          .01E+2") );
180    array[item++] = new TestCase( SECTION,  "parseFloat('          +.01E+2')",     1,         parseFloat("          +.01E+2") );
181    array[item++] = new TestCase( SECTION,  "parseFloat('          -.01E+2')",     -1,        parseFloat("          -.01E+2") );
182
183    array[item++] = new TestCase( SECTION,  "parseFloat('          .01E-2')",      0.0001,    parseFloat("          .01E-2") );
184    array[item++] = new TestCase( SECTION,  "parseFloat('          +.01E-2')",     0.0001,    parseFloat("          +.01E-2") );
185    array[item++] = new TestCase( SECTION,  "parseFloat('          -.01E-2')",     -0.0001,   parseFloat("          -.01E-2") );
186
187    //  StrDecimalLiteral:::    DecimalDigits ExponentPart opt
188    array[item++] = new TestCase( SECTION,  "parseFloat('          1234E5')",     123400000,  parseFloat("          1234E5") );
189    array[item++] = new TestCase( SECTION,  "parseFloat('          +1234E5')",    123400000,  parseFloat("          +1234E5") );
190    array[item++] = new TestCase( SECTION,  "parseFloat('          -1234E5')",    -123400000, parseFloat("          -1234E5") );
191
192    array[item++] = new TestCase( SECTION,  "parseFloat('          1234E+5')",    123400000,  parseFloat("          1234E+5") );
193    array[item++] = new TestCase( SECTION,  "parseFloat('          +1234E+5')",   123400000,  parseFloat("          +1234E+5") );
194    array[item++] = new TestCase( SECTION,  "parseFloat('          -1234E+5')",   -123400000, parseFloat("          -1234E+5") );
195
196    array[item++] = new TestCase( SECTION,  "parseFloat('          1234E-5')",     0.01234,  parseFloat("          1234E-5") );
197    array[item++] = new TestCase( SECTION,  "parseFloat('          +1234E-5')",    0.01234,  parseFloat("          +1234E-5") );
198    array[item++] = new TestCase( SECTION,  "parseFloat('          -1234E-5')",    -0.01234, parseFloat("          -1234E-5") );
199
200
201    // hex cases should all return NaN
202
203    array[item++] = new TestCase( SECTION,  "parseFloat('          0x0')",        0,         parseFloat("          0x0"));
204    array[item++] = new TestCase( SECTION,  "parseFloat('          0x1')",        0,         parseFloat("          0x1"));
205    array[item++] = new TestCase( SECTION,  "parseFloat('          0x2')",        0,         parseFloat("          0x2"));
206    array[item++] = new TestCase( SECTION,  "parseFloat('          0x3')",        0,         parseFloat("          0x3"));
207    array[item++] = new TestCase( SECTION,  "parseFloat('          0x4')",        0,         parseFloat("          0x4"));
208    array[item++] = new TestCase( SECTION,  "parseFloat('          0x5')",        0,         parseFloat("          0x5"));
209    array[item++] = new TestCase( SECTION,  "parseFloat('          0x6')",        0,         parseFloat("          0x6"));
210    array[item++] = new TestCase( SECTION,  "parseFloat('          0x7')",        0,         parseFloat("          0x7"));
211    array[item++] = new TestCase( SECTION,  "parseFloat('          0x8')",        0,         parseFloat("          0x8"));
212    array[item++] = new TestCase( SECTION,  "parseFloat('          0x9')",        0,         parseFloat("          0x9"));
213    array[item++] = new TestCase( SECTION,  "parseFloat('          0xa')",        0,         parseFloat("          0xa"));
214    array[item++] = new TestCase( SECTION,  "parseFloat('          0xb')",        0,         parseFloat("          0xb"));
215    array[item++] = new TestCase( SECTION,  "parseFloat('          0xc')",        0,         parseFloat("          0xc"));
216    array[item++] = new TestCase( SECTION,  "parseFloat('          0xd')",        0,         parseFloat("          0xd"));
217    array[item++] = new TestCase( SECTION,  "parseFloat('          0xe')",        0,         parseFloat("          0xe"));
218    array[item++] = new TestCase( SECTION,  "parseFloat('          0xf')",        0,         parseFloat("          0xf"));
219    array[item++] = new TestCase( SECTION,  "parseFloat('          0xA')",        0,         parseFloat("          0xA"));
220    array[item++] = new TestCase( SECTION,  "parseFloat('          0xB')",        0,         parseFloat("          0xB"));
221    array[item++] = new TestCase( SECTION,  "parseFloat('          0xC')",        0,         parseFloat("          0xC"));
222    array[item++] = new TestCase( SECTION,  "parseFloat('          0xD')",        0,         parseFloat("          0xD"));
223    array[item++] = new TestCase( SECTION,  "parseFloat('          0xE')",        0,         parseFloat("          0xE"));
224    array[item++] = new TestCase( SECTION,  "parseFloat('          0xF')",        0,         parseFloat("          0xF"));
225
226    array[item++] = new TestCase( SECTION,  "parseFloat('          0X0')",        0,         parseFloat("          0X0"));
227    array[item++] = new TestCase( SECTION,  "parseFloat('          0X1')",        0,         parseFloat("          0X1"));
228    array[item++] = new TestCase( SECTION,  "parseFloat('          0X2')",        0,         parseFloat("          0X2"));
229    array[item++] = new TestCase( SECTION,  "parseFloat('          0X3')",        0,         parseFloat("          0X3"));
230    array[item++] = new TestCase( SECTION,  "parseFloat('          0X4')",        0,         parseFloat("          0X4"));
231    array[item++] = new TestCase( SECTION,  "parseFloat('          0X5')",        0,         parseFloat("          0X5"));
232    array[item++] = new TestCase( SECTION,  "parseFloat('          0X6')",        0,         parseFloat("          0X6"));
233    array[item++] = new TestCase( SECTION,  "parseFloat('          0X7')",        0,         parseFloat("          0X7"));
234    array[item++] = new TestCase( SECTION,  "parseFloat('          0X8')",        0,         parseFloat("          0X8"));
235    array[item++] = new TestCase( SECTION,  "parseFloat('          0X9')",        0,         parseFloat("          0X9"));
236    array[item++] = new TestCase( SECTION,  "parseFloat('          0Xa')",        0,         parseFloat("          0Xa"));
237    array[item++] = new TestCase( SECTION,  "parseFloat('          0Xb')",        0,         parseFloat("          0Xb"));
238    array[item++] = new TestCase( SECTION,  "parseFloat('          0Xc')",        0,         parseFloat("          0Xc"));
239    array[item++] = new TestCase( SECTION,  "parseFloat('          0Xd')",        0,         parseFloat("          0Xd"));
240    array[item++] = new TestCase( SECTION,  "parseFloat('          0Xe')",        0,         parseFloat("          0Xe"));
241    array[item++] = new TestCase( SECTION,  "parseFloat('          0Xf')",        0,         parseFloat("          0Xf"));
242    array[item++] = new TestCase( SECTION,  "parseFloat('          0XA')",        0,         parseFloat("          0XA"));
243    array[item++] = new TestCase( SECTION,  "parseFloat('          0XB')",        0,         parseFloat("          0XB"));
244    array[item++] = new TestCase( SECTION,  "parseFloat('          0XC')",        0,         parseFloat("          0XC"));
245    array[item++] = new TestCase( SECTION,  "parseFloat('          0XD')",        0,         parseFloat("          0XD"));
246    array[item++] = new TestCase( SECTION,  "parseFloat('          0XE')",        0,         parseFloat("          0XE"));
247    array[item++] = new TestCase( SECTION,  "parseFloat('          0XF')",        0,         parseFloat("          0XF"));
248
249    // A StringNumericLiteral may not use octal notation
250
251    array[item++] = new TestCase( SECTION,  "parseFloat('          00')",        0,         parseFloat("          00"));
252    array[item++] = new TestCase( SECTION,  "parseFloat('          01')",        1,         parseFloat("          01"));
253    array[item++] = new TestCase( SECTION,  "parseFloat('          02')",        2,         parseFloat("          02"));
254    array[item++] = new TestCase( SECTION,  "parseFloat('          03')",        3,         parseFloat("          03"));
255    array[item++] = new TestCase( SECTION,  "parseFloat('          04')",        4,         parseFloat("          04"));
256    array[item++] = new TestCase( SECTION,  "parseFloat('          05')",        5,         parseFloat("          05"));
257    array[item++] = new TestCase( SECTION,  "parseFloat('          06')",        6,         parseFloat("          06"));
258    array[item++] = new TestCase( SECTION,  "parseFloat('          07')",        7,         parseFloat("          07"));
259    array[item++] = new TestCase( SECTION,  "parseFloat('          010')",       10,        parseFloat("          010"));
260    array[item++] = new TestCase( SECTION,  "parseFloat('          011')",       11,        parseFloat("          011"));
261
262    // A StringNumericLIteral may have any number of leading 0 digits
263
264    array[item++] = new TestCase( SECTION,  "parseFloat('          001')",        1,         parseFloat("          001"));
265    array[item++] = new TestCase( SECTION,  "parseFloat('          0001')",       1,         parseFloat("          0001"));
266
267    // A StringNumericLIteral may have any number of leading 0 digits
268
269    array[item++] = new TestCase( SECTION,  "parseFloat(001)",