diff options
author | Damien George <damien.p.george@gmail.com> | 2015-03-14 22:56:02 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-03-14 22:56:02 +0000 |
commit | f256cfef4f67c0a79141194b0a28dfa2a21b1110 (patch) | |
tree | 2bbf38e88a62351f4ec42c2e428ae63e78eedf4d | |
parent | fa1edff006ced6f2e4b4ba4f899809c0d2a63de0 (diff) | |
download | micropython-f256cfef4f67c0a79141194b0a28dfa2a21b1110.tar.gz micropython-f256cfef4f67c0a79141194b0a28dfa2a21b1110.zip |
tests: Add some more tests for complex numbers and ure module.
-rw-r--r-- | tests/extmod/ure1.py | 6 | ||||
-rw-r--r-- | tests/float/complex1.py | 10 |
2 files changed, 11 insertions, 5 deletions
diff --git a/tests/extmod/ure1.py b/tests/extmod/ure1.py index 1501a5264e..39e84d51ea 100644 --- a/tests/extmod/ure1.py +++ b/tests/extmod/ure1.py @@ -56,3 +56,9 @@ print(m.group(0)) m = re.search("w.r", "hello world") print(m.group(0)) + +m = re.match('a+?', 'ab'); print(m.group(0)) +m = re.match('a*?', 'ab'); print(m.group(0)) +m = re.match('^ab$', 'ab'); print(m.group(0)) +m = re.match('a|b', 'b'); print(m.group(0)) +m = re.match('a|b|c', 'c'); print(m.group(0)) diff --git a/tests/float/complex1.py b/tests/float/complex1.py index 4cf7a25f6d..6cfbff61bc 100644 --- a/tests/float/complex1.py +++ b/tests/float/complex1.py @@ -13,7 +13,7 @@ print(complex(1j, 2j)) # unary ops print(bool(1j)) print(+(1j)) -#print(-(1j)) uPy doesn't print correctly +print(-(1 + 2j)) # binary ops print(1j + 2) @@ -23,10 +23,10 @@ print(1j - 2j) print(1j * 2) print(1j * 2j) print(1j / 2) -#print(1j / 2j) uPy doesn't print correctly -#print(1j ** 2) uPy doesn't print correctly -#print(1j ** 2j) uPy doesn't print correctly +print(1j / (1 + 2j)) +ans = 1j ** 2.5; print("%.5g %.5g" % (ans.real, ans.imag)) +ans = 1j ** 2.5j; print("%.5g %.5g" % (ans.real, ans.imag)) # builtin abs print(abs(1j)) -print(abs(1j + 2)) +print("%.5g" % abs(1j + 2)) |