My favorites | Sign in
Project Home Downloads Wiki Issues Source
Repository:
Checkout   Browse   Changes   Clones  
Changes to /src/lepl/matchers/_test/derived.py
57940ef47cbb vs. 38467dd25c24 Compare: vs.  Format:
Revision 38467dd25c24
Go to: 
Project members, sign in to write a code review
/src/lepl/matchers/_test/derived.py   57940ef47cbb /src/lepl/matchers/_test/derived.py   38467dd25c24
1 from lepl.stream.core import s_next 1 from lepl.stream.core import s_next
2 2
3 # The contents of this file are subject to the Mozilla Public License 3 # The contents of this file are subject to the Mozilla Public License
4 # (MPL) Version 1.1 (the "License"); you may not use this file except 4 # (MPL) Version 1.1 (the "License"); you may not use this file except
5 # in compliance with the License. You may obtain a copy of the License 5 # in compliance with the License. You may obtain a copy of the License
6 # at http://www.mozilla.org/MPL/ 6 # at http://www.mozilla.org/MPL/
7 # 7 #
8 # Software distributed under the License is distributed on an "AS IS" 8 # Software distributed under the License is distributed on an "AS IS"
9 # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 9 # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
10 # the License for the specific language governing rights and 10 # the License for the specific language governing rights and
11 # limitations under the License. 11 # limitations under the License.
12 #LogMixin 12 #LogMixin
13 # The Original Code is LEPL (http://www.acooke.org/lepl) 13 # The Original Code is LEPL (http://www.acooke.org/lepl)
14 # The Initial Developer of the Original Code is Andrew Cooke. 14 # The Initial Developer of the Original Code is Andrew Cooke.
15 # Portions created by the Initial Developer are Copyright (C) 2009-2010 15 # Portions created by the Initial Developer are Copyright (C) 2009-2010
16 # Andrew Cooke (andrew@acooke.org). All Rights Reserved. 16 # Andrew Cooke (andrew@acooke.org). All Rights Reserved.
17 # 17 #
18 # Alternatively, the contents of this file may be used under the terms 18 # Alternatively, the contents of this file may be used under the terms
19 # of the LGPL license (the GNU Lesser General Public License, 19 # of the LGPL license (the GNU Lesser General Public License,
20 # http://www.gnu.org/licenses/lgpl.html), in which case the provisions 20 # http://www.gnu.org/licenses/lgpl.html), in which case the provisions
21 # of the LGPL License are applicable instead of those above. 21 # of the LGPL License are applicable instead of those above.
22 # 22 #
23 # If you wish to allow use of your version of this file only under the 23 # If you wish to allow use of your version of this file only under the
24 # terms of the LGPL License and not to allow others to use your version 24 # terms of the LGPL License and not to allow others to use your version
25 # of this file under the MPL, indicate your decision by deleting the 25 # of this file under the MPL, indicate your decision by deleting the
26 # provisions above and replace them with the notice and other provisions 26 # provisions above and replace them with the notice and other provisions
27 # required by the LGPL License. If you do not delete the provisions 27 # required by the LGPL License. If you do not delete the provisions
28 # above, a recipient may use your version of this file under either the 28 # above, a recipient may use your version of this file under either the
29 # MPL or the LGPL License. 29 # MPL or the LGPL License.
30 30
31 ''' 31 '''
32 Tests for the lepl.matchers.derived module. 32 Tests for the lepl.matchers.derived module.
33 ''' 33 '''
34 34
35 #from logging import basicConfig, DEBUG 35 #from logging import basicConfig, DEBUG
36 from unittest import TestCase 36 from unittest import TestCase
37 37
38 from lepl.matchers.monitor import Trace 38 from lepl.matchers.monitor import Trace
39 from lepl.matchers.derived import Repeat, Space, SkipTo, Newline, String, \ 39 from lepl.matchers.derived import Repeat, Space, SkipTo, Newline, String, \
40 SkipString, SingleLineString, UnsignedInteger, SignedInteger, \ 40 SkipString, SingleLineString, UnsignedInteger, SignedInteger, \
41 UnsignedReal, SignedReal, UnsignedEReal, SignedEReal, UnsignedFloat, \ 41 UnsignedReal, SignedReal, UnsignedEReal, SignedEReal, UnsignedFloat, \
42 SignedFloat, UnsignedEFloat, SignedEFloat, Optional 42 SignedFloat, UnsignedEFloat, SignedEFloat, Optional
43 from lepl.stream.maxdepth import FullFirstMatchException 43 from lepl.stream.maxdepth import FullFirstMatchException
44 from lepl.matchers.core import Any 44 from lepl.matchers.core import Any
45 from lepl._test.base import BaseTest 45 from lepl._test.base import BaseTest
46 from lepl.matchers.support import OperatorMatcher 46 from lepl.matchers.support import OperatorMatcher
47 from lepl.core.parser import tagged 47 from lepl.core.parser import tagged
48 from lepl.support.warn import silence 48 from lepl.support.warn import silence
49 49
50 silence('UnsignedFloat') 50 silence('UnsignedFloat')
51 silence('SignedFloat') 51 silence('SignedFloat')
52 silence('UnsignedEFloat') 52 silence('UnsignedEFloat')
53 silence('SignedEFloat') 53 silence('SignedEFloat')
54 54
55 # pylint: disable-msg=C0103, C0111, C0301, W0702, C0324, C0102, C0321, W0141, R0201, R0913, R0901, R0904 55 # pylint: disable-msg=C0103, C0111, C0301, W0702, C0324, C0102, C0321, W0141, R0201, R0913, R0901, R0904
56 # (dude this is just a test) 56 # (dude this is just a test)
57 57
58 class RepeatTest(TestCase): 58 class RepeatTest(TestCase):
59 59
60 def test_simple(self): 60 def test_simple(self):
61 #basicConfig(level=DEBUG) 61 #basicConfig(level=DEBUG)
62 self.assert_simple([1], 1, 1, 'd', ['0']) 62 self.assert_simple([1], 1, 1, 'd', ['0'])
63 self.assert_simple([1], 1, 2, 'd', ['0']) 63 self.assert_simple([1], 1, 2, 'd', ['0'])
64 self.assert_simple([2], 1, 1, 'd', ['0','1']) 64 self.assert_simple([2], 1, 1, 'd', ['0','1'])
65 self.assert_simple([2], 1, 2, 'd', ['0','1']) 65 self.assert_simple([2], 1, 2, 'd', ['0','1'])
66 self.assert_simple([2], 0, 2, 'd', ['0','1', '']) 66 self.assert_simple([2], 0, 2, 'd', ['0','1', ''])
67 self.assert_simple([1,2], 1, 1, 'd', ['0']) 67 self.assert_simple([1,2], 1, 1, 'd', ['0'])
68 self.assert_simple([1,2], 1, 2, 'd', ['00','01', '0']) 68 self.assert_simple([1,2], 1, 2, 'd', ['00','01', '0'])
69 self.assert_simple([1,2], 2, 2, 'd', ['00','01']) 69 self.assert_simple([1,2], 2, 2, 'd', ['00','01'])
70 self.assert_simple([1,2], 1, 2, 'b', ['0', '00','01']) 70 self.assert_simple([1,2], 1, 2, 'b', ['0', '00','01'])
71 self.assert_simple([1,2], 1, 2, 'g', ['00', '01','0']) 71 self.assert_simple([1,2], 1, 2, 'g', ['00', '01','0'])
72 72
73 def assert_simple(self, stream, start, stop, algorithm, target): 73 def assert_simple(self, stream, start, stop, algorithm, target):
74 matcher = Repeat(RangeMatch(), start, stop, algorithm=algorithm) 74 matcher = Repeat(RangeMatch(), start, stop, algorithm=algorithm)
75 matcher.config.no_full_first_match() 75 matcher.config.no_full_first_match()
76 result = list(matcher.match_list(stream)) 76 result = list(matcher.match_list(stream))
77 #print(result) 77 #print(result)
78 result = [''.join(map(str, l)) for (l, _s) in result] 78 result = [''.join(map(str, l)) for (l, _s) in result]
79 assert target == result, result 79 assert target == result, result
80 80
81 def test_mixin(self): 81 def test_mixin(self):
82 #basicConfig(level=DEBUG) 82 #basicConfig(level=DEBUG)
83 r = RangeMatch() 83 r = RangeMatch()
84 self.assert_mixin(r[1:1], [1], ['0']) 84 self.assert_mixin(r[1:1], [1], ['0'])
85 self.assert_mixin(r[1:2], [1], ['0']) 85 self.assert_mixin(r[1:2], [1], ['0'])
86 self.assert_mixin(r[1:1], [2], ['0','1']) 86 self.assert_mixin(r[1:1], [2], ['0','1'])
87 self.assert_mixin(r[1:2], [2], ['0','1']) 87 self.assert_mixin(r[1:2], [2], ['0','1'])
88 self.assert_mixin(r[0:], [2], ['0','1', '']) 88 self.assert_mixin(r[0:], [2], ['0','1', ''])
89 self.assert_mixin(r[:], [2], ['0','1', '']) 89 self.assert_mixin(r[:], [2], ['0','1', ''])
90 self.assert_mixin(r[0:2], [2], ['0','1', '']) 90 self.assert_mixin(r[0:2], [2], ['0','1', ''])
91 self.assert_mixin(r[1], [1,2], ['0']) 91 self.assert_mixin(r[1], [1,2], ['0'])
92 self.assert_mixin(r[1:2], [1,2], ['00','01', '0']) 92 self.assert_mixin(r[1:2], [1,2], ['00','01', '0'])
93 self.assert_mixin(r[2], [1,2], ['00','01']) 93 self.assert_mixin(r[2], [1,2], ['00','01'])
94 self.assert_mixin(r[1:2:'b'], [1,2], ['0', '00','01']) 94 self.assert_mixin(r[1:2:'b'], [1,2], ['0', '00','01'])
95 self.assert_mixin(r[1:2:'d'], [1,2], ['00', '01','0']) 95 self.assert_mixin(r[1:2:'d'], [1,2], ['00', '01','0'])
96 try: 96 try:
97 self.assert_mixin(r[1::'x'], [1,2,3], []) 97 self.assert_mixin(r[1::'x'], [1,2,3], [])
98 assert False, 'expected error' 98 assert False, 'expected error'
99 except ValueError: 99 except ValueError:
100 pass 100 pass
101 101
102 def assert_mixin(self, match, stream, target): 102 def assert_mixin(self, match, stream, target):
103 match.config.no_full_first_match() 103 match.config.no_full_first_match()
104 result = [''.join(map(str, l)) 104 result = [''.join(map(str, l))
105 for (l, _s) in match.match_list(stream)] 105 for (l, _s) in match.match_list(stream)]
106 assert target == result, result 106 assert target == result, result
107 107
108 def test_separator(self): 108 def test_separator(self):
109 #basicConfig(level=DEBUG) 109 #basicConfig(level=DEBUG)
110 self.assert_separator('a', 1, 1, 'd', ['a']) 110 self.assert_separator('a', 1, 1, 'd', ['a'])
111 self.assert_separator('a', 1, 1, 'b', ['a']) 111 self.assert_separator('a', 1, 1, 'b', ['a'])
112 self.assert_separator('a,a', 1, 2, 'd', ['a,a', 'a']) 112 self.assert_separator('a,a', 1, 2, 'd', ['a,a', 'a'])
113 self.assert_separator('a,a', 1, 2, 'b', ['a', 'a,a']) 113 self.assert_separator('a,a', 1, 2, 'b', ['a', 'a,a'])
114 self.assert_separator('a,a,a,a', 2, 3, 'd', ['a,a,a', 'a,a']) 114 self.assert_separator('a,a,a,a', 2, 3, 'd', ['a,a,a', 'a,a'])
115 self.assert_separator('a,a,a,a', 2, 3, 'b', ['a,a', 'a,a,a']) 115 self.assert_separator('a,a,a,a', 2, 3, 'b', ['a,a', 'a,a,a'])
116 116
117 def assert_separator(self, stream, start, stop, algorithm, target): 117 def assert_separator(self, stream, start, stop, algorithm, target):
118 matcher = Repeat(Any('abc'), start, stop, 118 matcher = Repeat(Any('abc'), start, stop,
119 algorithm=algorithm, separator=Any(',')) 119 algorithm=algorithm, separator=Any(','))
120 matcher.config.no_full_first_match() 120 matcher.config.no_full_first_match()
121 result = [''.join(l) 121 result = [''.join(l)
122 for (l, _s) in matcher.match_string(stream)] 122 for (l, _s) in matcher.match_string(stream)]
123 assert target == result, result 123 assert target == result, result
124 124
125 def test_separator_mixin(self): 125 def test_separator_mixin(self):
126 #basicConfig(level=DEBUG) 126 #basicConfig(level=DEBUG)
127 abc = Any('abc') 127 abc = Any('abc')
128 self.assert_separator_mixin(abc[1:1:'d',','], 'a', ['a']) 128 self.assert_separator_mixin(abc[1:1:'d',','], 'a', ['a'])
129 self.assert_separator_mixin(abc[1:1:'b',','], 'a', ['a']) 129 self.assert_separator_mixin(abc[1:1:'b',','], 'a', ['a'])
130 self.assert_separator_mixin(abc[1:2:'d',','], 'a,b', ['a,b', 'a']) 130 self.assert_separator_mixin(abc[1:2:'d',','], 'a,b', ['a,b', 'a'])
131 self.assert_separator_mixin(abc[1:2:'b',','], 'a,b', ['a', 'a,b']) 131 self.assert_separator_mixin(abc[1:2:'b',','], 'a,b', ['a', 'a,b'])
132 self.assert_separator_mixin(abc[2:3:'d',','], 'a,b,c,a', ['a,b,c', 'a,b']) 132 self.assert_separator_mixin(abc[2:3:'d',','], 'a,b,c,a', ['a,b,c', 'a,b'])
133 self.assert_separator_mixin(abc[2:3:'b',','], 'a,b,c,a', ['a,b', 'a,b,c']) 133 self.assert_separator_mixin(abc[2:3:'b',','], 'a,b,c,a', ['a,b', 'a,b,c'])
134 134
135 def assert_separator_mixin(self, matcher, stream, target): 135 def assert_separator_mixin(self, matcher, stream, target):
136 matcher.config.no_full_first_match() 136 matcher.config.no_full_first_match()
137 result = [''.join(map(str, l)) for (l, _s) in matcher.match_string(stream)] 137 result = [''.join(map(str, l)) for (l, _s) in matcher.match_string(stream)]
138 assert target == result, result 138 assert target == result, result
139 139
140 140
141 class RangeMatch(OperatorMatcher): 141 class RangeMatch(OperatorMatcher):
142 ''' 142 '''
143 We test repetition by looking at "strings" of integers, where the 143 We test repetition by looking at "strings" of integers, where the
144 matcher for any particular value returns all values less than the 144 matcher for any particular value returns all values less than the
145 current value. 145 current value.
146 ''' 146 '''
147 147
148 def __init__(self): 148 def __init__(self):
149 super(RangeMatch, self).__init__() 149 super(RangeMatch, self).__init__()
150 150
151 @tagged 151 @tagged
152 def _match(self, stream): 152 def _match(self, stream):
153 (value, next_stream) = s_next(stream) 153 (value, next_stream) = s_next(stream)
154 for i in range(value): 154 for i in range(value[0]):
155 yield ([i], next_stream) 155 yield ([i], next_stream)
156 156
157 157
158 class SpaceTest(BaseTest): 158 class SpaceTest(BaseTest):
159 159
160 def test_space(self): 160 def test_space(self):
161 self.assert_direct(' ', Space(), [[' ']]) 161 self.assert_direct(' ', Space(), [[' ']])
162 self.assert_direct(' ', Space()[0:], [[' ', ' '], [' '], []]) 162 self.assert_direct(' ', Space()[0:], [[' ', ' '], [' '], []])
163 self.assert_direct(' ', Space()[0:,...], [[' '], [' '], []]) 163 self.assert_direct(' ', Space()[0:,...], [[' '], [' '], []])
164 164
165 def test_slash(self): 165 def test_slash(self):
166 ab = Any('ab') 166 ab = Any('ab')
167 self.assert_direct('ab', ab / ab, [['a', 'b']]) 167 self.assert_direct('ab', ab / ab, [['a', 'b']])
168 self.assert_direct('a b', ab / ab, [['a', ' ', 'b']]) 168 self.assert_direct('a b', ab / ab, [['a', ' ', 'b']])
169 self.assert_direct('a b', ab / ab, [['a', ' ', 'b']]) 169 self.assert_direct('a b', ab / ab, [['a', ' ', 'b']])
170 self.assert_direct('ab', ab // ab, []) 170 self.assert_direct('ab', ab // ab, [])
171 self.assert_direct('a b', ab // ab, [['a', ' ', 'b']]) 171 self.assert_direct('a b', ab // ab, [['a', ' ', 'b']])
172 self.assert_direct('a b', ab // ab, [['a', ' ', 'b']]) 172 self.assert_direct('a b', ab // ab, [['a', ' ', 'b']])
173 173
174 174
175 class SkipToTest(BaseTest): 175 class SkipToTest(BaseTest):
176 176
177 def test_skip(self): 177 def test_skip(self):
178 self.assert_direct('aabcc', SkipTo('b'), [['aab']]) 178 self.assert_direct('aabcc', SkipTo('b'), [['aab']])
179 self.assert_direct('aabcc', SkipTo('b', False), [['aa']]) 179 self.assert_direct('aabcc', SkipTo('b', False), [['aa']])
180 180
181 def test_next_line(self): 181 def test_next_line(self):
182 #basicConfig(level=DEBUG) 182 #basicConfig(level=DEBUG)
183 self.assert_direct('''abc 183 self.assert_direct('''abc
184 d''', Trace(~SkipTo(Newline()) + 'd'), [['d']]) 184 d''', Trace(~SkipTo(Newline()) + 'd'), [['d']])
185 185
186 186
187 class StringTest(BaseTest): 187 class StringTest(BaseTest):
188 188
189 def test_simple(self): 189 def test_simple(self):
190 self.assert_direct('"abc"', String(), [['abc']]) 190 self.assert_direct('"abc"', String(), [['abc']])
191 self.assert_direct('"abc"d', String(), [['abc']]) 191 self.assert_direct('"abc"d', String(), [['abc']])
192 self.assert_direct('"abc"', SingleLineString(), [['abc']]) 192 self.assert_direct('"abc"', SingleLineString(), [['abc']])
193 self.assert_direct('"abc"d', SingleLineString(), [['abc']]) 193 self.assert_direct('"abc"d', SingleLineString(), [['abc']])
194 self.assert_direct('"abc"', SkipString(), [['abc']]) 194 self.assert_direct('"abc"', SkipString(), [['abc']])
195 self.assert_direct('"abc"d', SkipString(), [['abc']]) 195 self.assert_direct('"abc"d', SkipString(), [['abc']])
196 196
197 def test_escape(self): 197 def test_escape(self):
198 self.assert_direct('"ab\\"c"', String(), [['ab"c'], ['ab\\']]) 198 self.assert_direct('"ab\\"c"', String(), [['ab"c'], ['ab\\']])
199 199
200 def test_multiple_lines(self): 200 def test_multiple_lines(self):
201 self.assert_direct('"ab\nc"', String(), [['ab\nc']]) 201 self.assert_direct('"ab\nc"', String(), [['ab\nc']])
202 self.assert_direct('"ab\nc"', SingleLineString(), []) 202 self.assert_direct('"ab\nc"', SingleLineString(), [])
203 self.assert_direct('"ab\nc"', SkipString(), [['abc']]) 203 self.assert_direct('"ab\nc"', SkipString(), [['abc']])
204 204
205 205
206 class OptionalTest(BaseTest): 206 class OptionalTest(BaseTest):
207 207
208 def test_optional(self): 208 def test_optional(self):
209 self.assert_direct('a', Optional('a'), [['a'], []]) 209 self.assert_direct('a', Optional('a'), [['a'], []])
210 210
211 211
212 class NumberTest(BaseTest): 212 class NumberTest(BaseTest):
213 213
214 def do_test(self, matcher, good, bad): 214 def do_test(self, matcher, good, bad):
215 def test(value, ok): 215 def test(value, ok):
216 try: 216 try:
217 matcher.parse(value) 217 matcher.parse(value)
218 assert ok, value 218 assert ok, value
219 except FullFirstMatchException: 219 except FullFirstMatchException:
220 assert not ok, value 220 assert not ok, value
221 for value in good: test(value, True) 221 for value in good: test(value, True)
222 for value in bad: test(value, False) 222 for value in bad: test(value, False)
223 223
224 def test_numbers(self): 224 def test_numbers(self):
225 self.do_test(UnsignedInteger(), 225 self.do_test(UnsignedInteger(),
226 ['1'], 226 ['1'],
227 ['-1', 227 ['-1',
228 '1.', '-1.', 228 '1.', '-1.',
229 '1.2', '-1.2', 229 '1.2', '-1.2',
230 '1e3', '-1e3', '1e-3', '-1e-3', 230 '1e3', '-1e3', '1e-3', '-1e-3',
231 '1.e3', '-1.e3', '1.e-3', '-1.e-3', 231 '1.e3', '-1.e3', '1.e-3', '-1.e-3',
232 '1.2e3', '-1.2e3', '1.2e-3', '-1.2e-3']) 232 '1.2e3', '-1.2e3', '1.2e-3', '-1.2e-3'])
233 self.do_test(SignedInteger(), 233 self.do_test(SignedInteger(),
234 ['1', '-1'], 234 ['1', '-1'],
235 ['1.', '-1.', 235 ['1.', '-1.',
236 '1.2', '-1.2', 236 '1.2', '-1.2',
237 '1e3', '-1e3', '1e-3', '-1e-3', 237 '1e3', '-1e3', '1e-3', '-1e-3',
238 '1.e3', '-1.e3', '1.e-3', '-1.e-3', 238 '1.e3', '-1.e3', '1.e-3', '-1.e-3',
239 '1.2e3', '-1.2e3', '1.2e-3', '-1.2e-3']) 239 '1.2e3', '-1.2e3', '1.2e-3', '-1.2e-3'])
240 self.do_test(UnsignedReal(), 240 self.do_test(UnsignedReal(),
241 ['1', '1.', '1.2'], 241 ['1', '1.', '1.2'],
242 ['-1', '-1.', '-1.2', 242 ['-1', '-1.', '-1.2',
243 '1e3', '-1e3', '1e-3', '-1e-3', 243 '1e3', '-1e3', '1e-3', '-1e-3',
244 '1.e3', '-1.e3', '1.e-3', '-1.e-3', 244 '1.e3', '-1.e3', '1.e-3', '-1.e-3',
245 '1.2e3', '-1.2e3', '1.2e-3', '-1.2e-3']) 245 '1.2e3', '-1.2e3', '1.2e-3', '-1.2e-3'])
246 self.do_test(SignedReal(), 246 self.do_test(SignedReal(),
247 ['1', '-1', 247 ['1', '-1',
248 '1.', '-1.', 248 '1.', '-1.',
249 '1.2', '-1.2'], 249 '1.2', '-1.2'],
250 ['1e3', '-1e3', '1e-3', '-1e-3', 250 ['1e3', '-1e3', '1e-3', '-1e-3',
251 '1.e3', '-1.e3', '1.e-3', '-1.e-3', 251 '1.e3', '-1.e3', '1.e-3', '-1.e-3',
252 '1.2e3', '-1.2e3', '1.2e-3', '-1.2e-3']) 252 '1.2e3', '-1.2e3', '1.2e-3', '-1.2e-3'])
253 self.do_test(UnsignedEReal(), 253 self.do_test(UnsignedEReal(),
254 ['1', '1.', '1.2', 254 ['1', '1.', '1.2',
255 '1e3', '1e-3', '1.e3', '1.e-3', 255 '1e3', '1e-3', '1.e3', '1.e-3',
256 '1.2e3', '1.2e-3'], 256 '1.2e3', '1.2e-3'],
257 ['-1', '-1.', '-1.2', 257 ['-1', '-1.', '-1.2',
258 '-1e3', '-1e-3', '-1.e3', '-1.e-3', 258 '-1e3', '-1e-3', '-1.e3', '-1.e-3',
259 '-1.2e3', '-1.2e-3']) 259 '-1.2e3', '-1.2e-3'])
260 self.do_test(SignedEReal(), 260 self.do_test(SignedEReal(),
261 ['1', '1.', '1.2', 261 ['1', '1.', '1.2',
262 '1e3', '1e-3', '1.e3', '1.e-3', 262 '1e3', '1e-3', '1.e3', '1.e-3',
263 '1.2e3', '1.2e-3', 263 '1.2e3', '1.2e-3',
264 '-1', '-1.', '-1.2', 264 '-1', '-1.', '-1.2',
265 '-1e3', '-1e-3', '-1.e3', '-1.e-3', 265 '-1e3', '-1e-3', '-1.e3', '-1.e-3',
266 '-1.2e3', '-1.2e-3'], 266 '-1.2e3', '-1.2e-3'],
267 []) 267 [])
268 self.do_test(UnsignedFloat(), 268 self.do_test(UnsignedFloat(),
269 ['1.', '1.2'], 269 ['1.', '1.2'],
270 ['1', '-1', '-1.', '-1.2', 270 ['1', '-1', '-1.', '-1.2',
271 '1e3', '-1e3', '1e-3', '-1e-3', 271 '1e3', '-1e3', '1e-3', '-1e-3',
272 '1.e3', '-1.e3', '1.e-3', '-1.e-3', 272 '1.e3', '-1.e3', '1.e-3', '-1.e-3',
273 '1.2e3', '-1.2e3', '1.2e-3', '-1.2e-3']) 273 '1.2e3', '-1.2e3', '1.2e-3', '-1.2e-3'])
274 self.do_test(SignedFloat(), 274 self.do_test(SignedFloat(),
275 ['1.', '-1.', 275 ['1.', '-1.',
276 '1.2', '-1.2'], 276 '1.2', '-1.2'],
277 ['1', '-1', 277 ['1', '-1',
278 '1e3', '-1e3', '1e-3', '-1e-3', 278 '1e3', '-1e3', '1e-3', '-1e-3',
279 '1.e3', '-1.e3', '1.e-3', '-1.e-3', 279 '1.e3', '-1.e3', '1.e-3', '-1.e-3',
280 '1.2e3', '-1.2e3', '1.2e-3', '-1.2e-3']) 280 '1.2e3', '-1.2e3', '1.2e-3', '-1.2e-3'])
281 self.do_test(UnsignedEFloat(), 281 self.do_test(UnsignedEFloat(),
282 ['1.', '1.2', 282 ['1.', '1.2',
283 '1e3', '1e-3', '1.e3', '1.e-3', 283 '1e3', '1e-3', '1.e3', '1.e-3',
284 '1.2e3', '1.2e-3'], 284 '1.2e3', '1.2e-3'],
285 ['1', '-1', '-1.', '-1.2', 285 ['1', '-1', '-1.', '-1.2',
286 '-1e3', '-1e-3', '-1.e3', '-1.e-3', 286 '-1e3', '-1e-3', '-1.e3', '-1.e-3',
287 '-1.2e3', '-1.2e-3']) 287 '-1.2e3', '-1.2e-3'])
288 self.do_test(SignedEFloat(), 288 self.do_test(SignedEFloat(),
289 ['1.', '1.2', 289 ['1.', '1.2',
290 '1e3', '1e-3', '1.e3', '1.e-3', 290 '1e3', '1e-3', '1.e3', '1.e-3',
291 '1.2e3', '1.2e-3', 291 '1.2e3', '1.2e-3',
292 '-1.', '-1.2', 292 '-1.', '-1.2',
293 '-1e3', '-1e-3', '-1.e3', '-1.e-3', 293 '-1e3', '-1e-3', '-1.e3', '-1.e-3',
294 '-1.2e3', '-1.2e-3'], 294 '-1.2e3', '-1.2e-3'],
295 ['1', '-1']) 295 ['1', '-1'])
296 296
Powered by Google Project Hosting