Browse Source

tests: Add some more tests for complex numbers and ure module.

pull/1157/head
Damien George 10 years ago
parent
commit
f256cfef4f
  1. 6
      tests/extmod/ure1.py
  2. 10
      tests/float/complex1.py

6
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))

10
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))

Loading…
Cancel
Save