diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-12 16:32:21 -0800 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-12 16:32:21 -0800 |
commit | ec3e14e2af48432a406d840896ae4551ddff0b7f (patch) | |
tree | aa885d4d1d6840c3ecfa08ecaea5cfdc6dd0c251 /tests/basics | |
parent | 45eb6eaa547384b595b8ef489bd5feb36e9c8ef1 (diff) | |
parent | 48b3572f7eb70a1af97f008d342ee266fdfc0717 (diff) | |
download | micropython-ec3e14e2af48432a406d840896ae4551ddff0b7f.tar.gz micropython-ec3e14e2af48432a406d840896ae4551ddff0b7f.zip |
Merge pull request #160 from pfalcon/elaborate-int
Elaborate small-int/long-int
Diffstat (limited to 'tests/basics')
-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 0000000000..be338c4a4c --- /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 |