Don't test bitwise operations on operands that don't fit in u32.

The current behavior is undefined in C when converting the double to a
u32, so the tests fail on some compilers. For now, I'm just removing
those parts of the tests because I'm not sure what I want the behavior
to be. Modulo? Truncate? Runtime error?
This commit is contained in:
Bob Nystrom
2017-01-12 21:32:50 -08:00
parent 252265c80b
commit e8dfb1bf10
8 changed files with 32 additions and 44 deletions
+5 -7
View File
@@ -3,20 +3,18 @@ System.print(~1) // expect: 4294967294
System.print(~23) // expect: 4294967272
// Max u32 value.
System.print(~4294967295) // expect: 0
// Past max u32 value.
System.print(~4294967296) // expect: 4294967295
System.print(~0xffffffff) // expect: 0
// Negative numbers.
System.print(~-1) // expect: 0
System.print(~-123) // expect: 122
System.print(~-4294967294) // expect: 4294967293
System.print(~-4294967295) // expect: 4294967294
System.print(~-4294967296) // expect: 4294967295
System.print(~-0xfffffffe) // expect: 4294967293
System.print(~-0xffffffff) // expect: 4294967294
// Floating point values.
System.print(~1.23) // expect: 4294967294
System.print(~0.00123) // expect: 4294967295
System.print(~345.67) // expect: 4294966950
System.print(~-12.34) // expect: 11
// TODO: Numbers that don't fit in u32.