44 lines
2.1 KiB
Plaintext
44 lines
2.1 KiB
Plaintext
Make sure that we correctly handle binary literals
|
|
|
|
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
|
|
|
|
|
|
PASS 0b0 is 0
|
|
PASS 0b1 is 1
|
|
PASS 0B1 is 1
|
|
PASS 0b00000000000000000000000000000000 is 0
|
|
PASS 0B2 threw exception SyntaxError: No binary digits after '0b'.
|
|
PASS 0ba threw exception SyntaxError: No binary digits after '0b'.
|
|
PASS 0b0.0 threw exception SyntaxError: Unexpected number '.0'. Parse error..
|
|
PASS x=0b1y=42 threw exception SyntaxError: No space between binary literal and identifier.
|
|
PASS 0b1010 is 0xa
|
|
PASS 0b00000001001000110100010101100111 is 0x01234567
|
|
PASS 0b10001001101010111100110111101111 is 0x89abcdef
|
|
PASS 0o100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 is 3.00300673152188e+256
|
|
PASS 0b11111111111111111111111111111111111111111111111111110 is 9007199254740990
|
|
PASS 0b11111111111111111111111111111111111111111111111111111 is 9007199254740991
|
|
PASS 0b111111111111111111111111111111111111111111111111111110 is 18014398509481982
|
|
PASS 0b111111111111111111111111111111111111111111111111111111 is 18014398509481984
|
|
PASS !!0b1 is true
|
|
PASS !!0b0 is false
|
|
PASS Number('0b0') is 0
|
|
PASS Number('0b1') is 1
|
|
PASS Number('0B1') is 1
|
|
PASS Number('0b00000000000000000000000000000000') is 0
|
|
PASS Number('0B2') is NaN
|
|
PASS Number('0ba') is NaN
|
|
PASS Number('0b0.0') is NaN
|
|
PASS Number('0b1010') is 0xa
|
|
PASS Number('0b00000001001000110100010101100111') is 0x01234567
|
|
PASS Number('0b10001001101010111100110111101111') is 0x89abcdef
|
|
PASS Number('0b11111111111111111111111111111111111111111111111111110') is 9007199254740990
|
|
PASS Number('0b11111111111111111111111111111111111111111111111111111') is 9007199254740991
|
|
PASS Number('0b111111111111111111111111111111111111111111111111111110') is 18014398509481982
|
|
PASS Number('0b111111111111111111111111111111111111111111111111111111') is 18014398509481984
|
|
PASS !!Number('0b1') is true
|
|
PASS !!Number('0b0') is false
|
|
PASS successfullyParsed is true
|
|
|
|
TEST COMPLETE
|
|
|