@@@ BROKEN wip
[mLib] / test / tests.at
index 30c898a..d823872 100644 (file)
@@ -85,31 +85,48 @@ test_parse([int], [4], [4 ; = 0x04 = '\x04'])
 test_parse([int], [ 17; comment], [17 ; = 0x11 = '\x11'])
 
 test_parse([int], [0x234], [564 ; = 0x0234])
-test_parse([int], [033], [27 ; = 0x1b = '\e'])
+test_parse([int], [0o33], [27 ; = 0x1b = '\e'])
 
 test_parse([int], [ +192], [192 ; = 0xc0 = '\xc0'])
 test_parse([int], [ -192], [-192 ; = -0xc0])
 
-test_parserr([int], [17 : badness], [3],
-       [syntax error: expected end-of-line but found `:'])
-test_parserr([int], [17: badness], [3],
-       [syntax error: expected end-of-line but found `:'])
-
-test_parserr([int], [xyzzy], [3],
-       [syntax error: expected signed integer but found `x'])
-test_parserr([int], [-splat], [3],
-       [syntax error: expected signed integer but found `s'])
-
-test_parserr([int], [0xq], [3],
-       [syntax error: expected end-of-line but found `x'])
-test_parserr([int], [0x], [3],
-       [syntax error: expected end-of-line but found `x'])
-
-test_parserr([int], [], [3],
-       [syntax error: expected signed integer but found @%:@<eol>])
-
-test_parserr([int], [123456], [3],
-       [integer 123456 out of range (must be in @<:@-32768 .. 32767@:>@)])
+test_parserr([int], [17 : badness],
+       [3], [syntax error: expected end-of-line but found `:'])
+test_parserr([int], [17: badness],
+       [3], [syntax error: expected end-of-line but found `:'])
+
+test_parserr([int], [-_1],
+       [3], [invalid signed integer `-_1'])
+test_parserr([int], [+1234_],
+       [3], [syntax error: expected end-of-line but found `_'])
+test_parse([int], [-1234_5], [-12345 ; = -0x3039])
+test_parserr([int], [+0x_abc],
+       [3], [syntax error: expected end-of-line but found `x'])
+test_parse([int], [-0xa_bc], [-2748 ; = -0x0abc])
+test_parserr([int], [-0xab__c],
+       [3], [syntax error: expected end-of-line but found `_'])
+test_parserr([int], [+010r1234],
+       [3], [syntax error: expected end-of-line but found `r'])
+test_parserr([int], [-1_0r1234],
+       [3], [syntax error: expected end-of-line but found `r'])
+
+test_parserr([int], [xyzzy],
+       [3], [invalid signed integer `xyzzy'])
+test_parserr([int], [-splat],
+       [3], [invalid signed integer `-splat'])
+test_parserr([int], [- 1],
+       [3], [invalid signed integer `-'])
+
+test_parserr([int], [0xq],
+       [3], [syntax error: expected end-of-line but found `x'])
+test_parserr([int], [0x],
+       [3], [syntax error: expected end-of-line but found `x'])
+
+test_parserr([int], [],
+       [3], [syntax error: expected signed integer but found @%:@<eol>])
+
+test_parserr([int], [123456],
+       [3], [integer 123456 out of range (must be in @<:@-32768 .. 32767@:>@)])
 
 AT_CLEANUP
 
@@ -119,38 +136,59 @@ AT_SETUP(tvec type-uint)
 test_parse([uint], [4], [4 ; = 0x04 = '\x04'])
 test_parse([uint], [ 17; comment], [17 ; = 0x11 = '\x11'])
 
+test_parse([uint], [012345], [12345 ; = 0x3039])
 test_parse([uint], [0x234], [564 ; = 0x0234])
-test_parse([uint], [033], [27 ; = 0x1b = '\e'])
-
-test_parserr([uint], [17 : badness], [3],
-       [syntax error: expected end-of-line but found `:'])
-test_parserr([uint], [17: badness], [3],
-       [syntax error: expected end-of-line but found `:'])
-
-test_parserr([uint], [ +192], [3],
-       [syntax error: expected unsigned integer but found `+'])
-test_parserr([uint], [ -192], [3],
-       [syntax error: expected unsigned integer but found `-'])
-
-test_parserr([uint], [xyzzy], [3],
-       [syntax error: expected unsigned integer but found `x'])
-
-test_parserr([uint], [0xq], [3],
-       [syntax error: expected end-of-line but found `x'])
-test_parserr([uint], [0x], [3],
-       [syntax error: expected end-of-line but found `x'])
-
-test_parserr([uint], [], [3],
-       [syntax error: expected unsigned integer but found @%:@<eol>])
-
-test_parserr([uint], [123456], [3],
-       [integer 123456 out of range (must be in @<:@0 .. 65535@:>@)])
+test_parse([uint], [0o33], [27 ; = 0x1b = '\e'])
+test_parse([uint], [0b1011_1101], [189 ; = 0xbd = '\xbd'])
+test_parse([uint], [12r123], [171 ; = 0xab = '\xab'])
+
+test_parserr([uint], [17 : badness],
+       [3], [syntax error: expected end-of-line but found `:'])
+test_parserr([uint], [17: badness],
+       [3], [syntax error: expected end-of-line but found `:'])
+
+test_parserr([uint], [_1],
+       [3], [invalid unsigned integer `_1'])
+test_parserr([uint], [1234_],
+       [3], [syntax error: expected end-of-line but found `_'])
+test_parse([uint], [1234_5], [12345 ; = 0x3039])
+test_parserr([uint], [0x_abcd],
+       [3], [syntax error: expected end-of-line but found `x'])
+test_parse([uint], [0xa_bcd], [43981 ; = 0xabcd])
+test_parserr([uint], [0xab__cd],
+       [3], [syntax error: expected end-of-line but found `_'])
+test_parserr([uint], [010r1234],
+       [3], [syntax error: expected end-of-line but found `r'])
+test_parserr([uint], [1_0r1234],
+       [3], [syntax error: expected end-of-line but found `r'])
+
+test_parserr([uint], [ +192],
+       [3], [invalid unsigned integer `+192'])
+test_parserr([uint], [ -192],
+       [3], [invalid unsigned integer `-192'])
+
+test_parserr([uint], [xyzzy],
+       [3], [invalid unsigned integer `xyzzy'])
+
+test_parserr([uint], [0xq],
+       [3], [syntax error: expected end-of-line but found `x'])
+test_parserr([uint], [0x],
+       [3], [syntax error: expected end-of-line but found `x'])
+
+test_parserr([uint], [],
+       [3], [syntax error: expected unsigned integer but found @%:@<eol>])
+
+test_parserr([uint], [123456],
+       [3], [integer 123456 out of range (must be in @<:@0 .. 65535@:>@)])
 
 AT_CLEANUP
 
 ###--------------------------------------------------------------------------
 AT_SETUP([tvec type-float])
 
+test_parse([float], [0.0], [0])
+test_parse([float], [-0.0], [-0])
+
 test_parse([float], [1.234], [1.234])
 
 AT_CLEANUP
@@ -180,7 +218,7 @@ AT_DATA([tv],
 
 int = -2
 uint = 7
-float = 6.28
+float = @%:@nan
 fltish = 0.1
 char = x
 ienum = greater
@@ -198,6 +236,7 @@ bytes =
        ad4f14f2 444066d0 6bc430b7 323ba122
        f622919d e18b1fda b0ca9902 b9729d49
        2c807ec5 99d5e980 b2eac9cc 53bf67d6
+@show = t
 ])
 AT_CHECK([BUILDDIR/t/tvec.t -fh tv], [0], [ignore])