More complex complex test

This commit is contained in:
rocky
2020-01-05 11:54:41 -05:00
parent 716e097654
commit 6646d18c7a
4 changed files with 8 additions and 4 deletions

1
test/.gitignore vendored
View File

@@ -1 +1,2 @@
/.coverage
/nohup.out /nohup.out

Binary file not shown.

Binary file not shown.

View File

@@ -1,4 +1,5 @@
# Greatly simplified from from 3.3 test_complex.py # Greatly simplified from from 3.3 test_complex.py
from math import atan2
# RUNNABLE! # RUNNABLE!
def assertCloseAbs(x, y, eps=1e-09): def assertCloseAbs(x, y, eps=1e-09):
@@ -38,14 +39,16 @@ def test_truediv():
check_div(x, y) check_div(x, y)
def test_plus_minus_0j(): def test_plus_minus_0j():
z1, z2 = (0j, (-0 - 0j)) assert -0j == -0j == complex(0.0, 0.0)
assert -0-0j == -0j == complex(0.0, 0.0)
z1, z2 = (0j, -0j)
assert atan2(z1.imag, -1.0) == atan2(0.0, -1.0) assert atan2(z1.imag, -1.0) == atan2(0.0, -1.0)
assert atan2(z2.imag, -1.0), atan2(-0.0, -1.0) # assert atan2(z2.imag, -1.0), atan2(-0.0, -1.0)
# Check that we can handle -inf, and inf as a complex numbers. # Check that we can handle -inf, and inf as a complex numbers.
# And put it in a tuple and a list to make it harder. # And put it in a tuple and a list to make it harder.
z1, z2 = (-1e1000j, 1e1000j) z1, z2 = (-1e1000j, 1e1000j)
assert z1 in [-1e1000j, 1e1000j] assert z1 in [-1e1000j, 1e1000j]
assert z1 == z2 assert z1 != z2
test_truediv() test_truediv()
test_plus_minus0j() test_plus_minus_0j()