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
+4 -6
View File
@@ -1,12 +1,10 @@
System.print(0 & 0) // expect: 0
System.print(2863311530 & 1431655765) // expect: 0
System.print(4042322160 & 1010580540) // expect: 808464432
System.print(0xaaaaaaaa & 0x55555555) // expect: 0
System.print(0xf0f0f0f0 & 0x3c3c3c3c) // expect: 808464432
// Max u32 value.
System.print(4294967295 & 4294967295) // expect: 4294967295
// Past max u32 value.
System.print(4294967296 & 4294967296) // expect: 0
System.print(0xffffffff & 0xffffffff) // expect: 4294967295
// TODO: Negative numbers.
// TODO: Floating-point numbers.
// TODO: Numbers that don't fit in u32.