mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 11:40:18 +01:00
tests: Add tests for op special meths, ubinascii, complex.
This commit is contained in:
28
tests/float/complex1.py
Normal file
28
tests/float/complex1.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# test basic complex number functionality
|
||||
|
||||
# constructor
|
||||
print(complex(1))
|
||||
print(complex(1.2))
|
||||
print(complex(1.2j))
|
||||
print(complex("1"))
|
||||
print(complex("1.2"))
|
||||
print(complex("1.2j"))
|
||||
print(complex(1, 2))
|
||||
print(complex(1j, 2j))
|
||||
|
||||
# unary ops
|
||||
print(bool(1j))
|
||||
print(+(1j))
|
||||
#print(-(1j)) uPy doesn't print correctly
|
||||
|
||||
# binary ops
|
||||
print(1j + 2)
|
||||
print(1j + 2j)
|
||||
print(1j - 2)
|
||||
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
|
||||
Reference in New Issue
Block a user