diff options
| author | Paul Sokolovsky | 2014-01-12 17:06:25 +0200 |
|---|---|---|
| committer | Paul Sokolovsky | 2014-01-12 22:04:21 +0200 |
| commit | 757ac81a69cc2143a6b170367b18c75ac60249e4 (patch) | |
| tree | 13302ead4c84e367f99435c067a5a96c41e11091 /tests | |
| parent | c260bc58e66f5fefc03b59c80c91a550282fb47c (diff) | |
Add proper checks for fits-in-small-int. Make it reusable.
We likely should make mp_obj_new_int() inline, and rely on its
encapsulated check rather than inline checks everywhere explicitly.
Also, parser for big small int values is still broken.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/basics/tests/int-small.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/basics/tests/int-small.py b/tests/basics/tests/int-small.py new file mode 100644 index 000000000..be338c4a4 --- /dev/null +++ b/tests/basics/tests/int-small.py @@ -0,0 +1,26 @@ +# This test small int range for 32-bit machine + +a = 0x3fffff +print(a) +a *= 0x10 +print(a) +a *= 0x10 +print(a) +a += 0xff +print(a) +# This would overflow +#a += 1 + +a = -0x3fffff +print(a) +a *= 0x10 +print(a) +a *= 0x10 +print(a) +a -= 0xff +print(a) +# This still doesn't overflow +a -= 1 +print(a) +# This would overflow +#a -= 1 |
