Skip to content

Commit 8246809

Browse files
committed
Add NaN comparison test
1 parent cb6d7c4 commit 8246809

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

quaddtype/tests/test_quaddtype.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ def test_binary_ops(op, other):
3333

3434

3535
@pytest.mark.parametrize("op", ["eq", "ne", "le", "lt", "ge", "gt"])
36-
@pytest.mark.parametrize("other", ["3.0", "12.5", "100.0"])
37-
def test_comparisons(op, other):
36+
@pytest.mark.parametrize("a", ["3.0", "12.5", "100.0", "inf", "-inf", "nan", "-nan"])
37+
@pytest.mark.parametrize("b", ["3.0", "12.5", "100.0", "inf", "-inf", "nan", "-nan"])
38+
def test_comparisons(op, a, b):
3839
op_func = getattr(operator, op)
39-
quad_a = QuadPrecision("12.5")
40-
quad_b = QuadPrecision(other)
41-
float_a = 12.5
42-
float_b = float(other)
40+
quad_a = QuadPrecision(a)
41+
quad_b = QuadPrecision(b)
42+
float_a = float(a)
43+
float_b = float(b)
4344

4445
assert op_func(quad_a, quad_b) == op_func(float_a, float_b)
4546

0 commit comments

Comments
 (0)