diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-27 23:16:20 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-27 23:16:20 +0000 |
commit | c7aa9fcae571a442a50c90409396788dd0b28c24 (patch) | |
tree | 8959e333f1d9183fbfb781ed974a17f1e27d71c7 /tests | |
parent | 4e8dc8c41b6f68269571fe218f7292fc86cf3ddb (diff) | |
parent | 9b00dad7bb0125a3459ca4f9c939c7510bd2f77f (diff) | |
download | micropython-c7aa9fcae571a442a50c90409396788dd0b28c24.tar.gz micropython-c7aa9fcae571a442a50c90409396788dd0b28c24.zip |
Merge branch 'master' of github.com:micropython/micropython
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basics/generator_send.py | 22 | ||||
-rw-r--r-- | tests/basics/int-long.py | 39 |
2 files changed, 61 insertions, 0 deletions
diff --git a/tests/basics/generator_send.py b/tests/basics/generator_send.py index 4158478cac..c472c31ba9 100644 --- a/tests/basics/generator_send.py +++ b/tests/basics/generator_send.py @@ -13,3 +13,25 @@ except TypeError: print(g.send(None)) print(g.send(100)) print(g.send(200)) + + +def f2(): + print("entering") + for i in range(3): + print(i) + yield + print("returning 1") + print("returning 2") + +g = f2() +g.send(None) +g.send(1) +g.send(1) +try: + g.send(1) +except StopIteration: + print("caught") +try: + g.send(1) +except StopIteration: + print("caught") diff --git a/tests/basics/int-long.py b/tests/basics/int-long.py new file mode 100644 index 0000000000..f867d8037d --- /dev/null +++ b/tests/basics/int-long.py @@ -0,0 +1,39 @@ +# This tests long ints for 32-bit machine + +a = 0x1ffffffff +b = 0x100000000 +print(a) +print(b) +print(a + b) +print(a - b) +print(b - a) +# overflows long long implementation +#print(a * b) +print(a // b) +print(a % b) +print(a & b) +print(a | b) +print(a ^ b) +print(a << 3) +print(a >> 1) + +a += b +print(a) +a -= 123456 +print(a) +a *= 257 +print(a) +a //= 257 +print(a) +a %= b +print(a) +a ^= b +print(a) +a |= b +print(a) +a &= b +print(a) +a <<= 5 +print(a) +a >>= 1 +print(a) |