remove duplicated tests from tests/stdlib_math.py

This commit is contained in:
Jeong YunWon
2023-02-13 21:17:36 +09:00
parent 4192e5de2d
commit 2fc0edf85b

View File

@@ -291,94 +291,3 @@ assert math.fmod(3.0, NINF) == 3.0
assert math.fmod(-3.0, NINF) == -3.0
assert math.fmod(0.0, 3.0) == 0.0
assert math.fmod(0.0, NINF) == 0.0
"""
TODO: math.remainder was added to CPython in 3.7 and RustPython CI runs on 3.6.
So put the tests of math.remainder in a comment for now.
https://github.com/RustPython/RustPython/pull/1589#issuecomment-551424940
"""
# testcases = [
# # Remainders modulo 1, showing the ties-to-even behaviour.
# '-4.0 1 -0.0',
# '-3.8 1 0.8',
# '-3.0 1 -0.0',
# '-2.8 1 -0.8',
# '-2.0 1 -0.0',
# '-1.8 1 0.8',
# '-1.0 1 -0.0',
# '-0.8 1 -0.8',
# '-0.0 1 -0.0',
# ' 0.0 1 0.0',
# ' 0.8 1 0.8',
# ' 1.0 1 0.0',
# ' 1.8 1 -0.8',
# ' 2.0 1 0.0',
# ' 2.8 1 0.8',
# ' 3.0 1 0.0',
# ' 3.8 1 -0.8',
# ' 4.0 1 0.0',
# # Reductions modulo 2*pi
# '0x0.0p+0 0x1.921fb54442d18p+2 0x0.0p+0',
# '0x1.921fb54442d18p+0 0x1.921fb54442d18p+2 0x1.921fb54442d18p+0',
# '0x1.921fb54442d17p+1 0x1.921fb54442d18p+2 0x1.921fb54442d17p+1',
# '0x1.921fb54442d18p+1 0x1.921fb54442d18p+2 0x1.921fb54442d18p+1',
# '0x1.921fb54442d19p+1 0x1.921fb54442d18p+2 -0x1.921fb54442d17p+1',
# '0x1.921fb54442d17p+2 0x1.921fb54442d18p+2 -0x0.0000000000001p+2',
# '0x1.921fb54442d18p+2 0x1.921fb54442d18p+2 0x0p0',
# '0x1.921fb54442d19p+2 0x1.921fb54442d18p+2 0x0.0000000000001p+2',
# '0x1.2d97c7f3321d1p+3 0x1.921fb54442d18p+2 0x1.921fb54442d14p+1',
# '0x1.2d97c7f3321d2p+3 0x1.921fb54442d18p+2 -0x1.921fb54442d18p+1',
# '0x1.2d97c7f3321d3p+3 0x1.921fb54442d18p+2 -0x1.921fb54442d14p+1',
# '0x1.921fb54442d17p+3 0x1.921fb54442d18p+2 -0x0.0000000000001p+3',
# '0x1.921fb54442d18p+3 0x1.921fb54442d18p+2 0x0p0',
# '0x1.921fb54442d19p+3 0x1.921fb54442d18p+2 0x0.0000000000001p+3',
# '0x1.f6a7a2955385dp+3 0x1.921fb54442d18p+2 0x1.921fb54442d14p+1',
# '0x1.f6a7a2955385ep+3 0x1.921fb54442d18p+2 0x1.921fb54442d18p+1',
# '0x1.f6a7a2955385fp+3 0x1.921fb54442d18p+2 -0x1.921fb54442d14p+1',
# '0x1.1475cc9eedf00p+5 0x1.921fb54442d18p+2 0x1.921fb54442d10p+1',
# '0x1.1475cc9eedf01p+5 0x1.921fb54442d18p+2 -0x1.921fb54442d10p+1',
# # Symmetry with respect to signs.
# ' 1 0.c 0.4',
# '-1 0.c -0.4',
# ' 1 -0.c 0.4',
# '-1 -0.c -0.4',
# ' 1.4 0.c -0.4',
# '-1.4 0.c 0.4',
# ' 1.4 -0.c -0.4',
# '-1.4 -0.c 0.4',
# # Huge modulus, to check that the underlying algorithm doesn't
# # rely on 2.0 * modulus being representable.
# '0x1.dp+1023 0x1.4p+1023 0x0.9p+1023',
# '0x1.ep+1023 0x1.4p+1023 -0x0.ap+1023',
# '0x1.fp+1023 0x1.4p+1023 -0x0.9p+1023',
# ]
# for case in testcases:
# x_hex, y_hex, expected_hex = case.split()
# # print(x_hex, y_hex, expected_hex)
# x = float.fromhex(x_hex)
# y = float.fromhex(y_hex)
# expected = float.fromhex(expected_hex)
# actual = math.remainder(x, y)
# # Cheap way of checking that the floats are
# # as identical as we need them to be.
# assert actual.hex() == expected.hex()
# # self.assertEqual(actual.hex(), expected.hex())
# # Test tiny subnormal modulus: there's potential for
# # getting the implementation wrong here (for example,
# # by assuming that modulus/2 is exactly representable).
# tiny = float.fromhex('1p-1074') # min +ve subnormal
# for n in range(-25, 25):
# if n == 0:
# continue
# y = n * tiny
# for m in range(100):
# x = m * tiny
# actual = math.remainder(x, y)
# actual = math.remainder(-x, y)