From 2918ff2fd4eb3a8f0a451ec83a30a0ef6950120f Mon Sep 17 00:00:00 2001 From: Cosmin Stejerean Date: Tue, 23 Jan 2024 18:14:42 -0800 Subject: [PATCH] update AdmDwt2CyTest to use actual expected values rather than particular floating point rounding errors --- python/test/cy_test.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/python/test/cy_test.py b/python/test/cy_test.py index 983f95e8a..63a0c2435 100644 --- a/python/test/cy_test.py +++ b/python/test/cy_test.py @@ -87,15 +87,15 @@ def test_adm_dwt2_cy_xsmallP_dc(self): self.assertEqual(h.shape, (9, 11)) self.assertEqual(d.shape, (9, 11)) - self.assertAlmostEqual(float(np.max(a)), 109.99999999999997, places=16) - self.assertAlmostEqual(float(np.max(v)), 8.526512829121202e-14, places=16) - self.assertAlmostEqual(float(np.max(h)), 8.038873388460928e-14, places=16) - self.assertAlmostEqual(float(np.max(d)), 0.0, places=16) + self.assertAlmostEqual(float(np.max(a)), 110.0, places=12) + self.assertAlmostEqual(float(np.max(v)), 0.0, places=12) + self.assertAlmostEqual(float(np.max(h)), 0.0, places=12) + self.assertAlmostEqual(float(np.max(d)), 0.0, places=12) - self.assertAlmostEqual(float(np.min(a)), 109.99999999999997, places=16) - self.assertAlmostEqual(float(np.min(v)), 8.526512829121202e-14, places=16) - self.assertAlmostEqual(float(np.min(h)), 8.038873388460928e-14, places=16) - self.assertAlmostEqual(float(np.min(d)), 0.0, places=16) + self.assertAlmostEqual(float(np.min(a)), 110.0, places=12) + self.assertAlmostEqual(float(np.min(v)), 0.0, places=12) + self.assertAlmostEqual(float(np.min(h)), 0.0, places=12) + self.assertAlmostEqual(float(np.min(d)), 0.0, places=12) def test_adm_dwt2_cy_dc(self): x = (55 * np.ones([324, 576])).astype(np.float64) @@ -106,15 +106,15 @@ def test_adm_dwt2_cy_dc(self): self.assertEqual(h.shape, (162, 288)) self.assertEqual(d.shape, (162, 288)) - self.assertAlmostEqual(float(np.max(a)), 109.99999999999999, places=8) - self.assertAlmostEqual(float(np.max(v)), 8.526512829121202e-14, places=16) - self.assertAlmostEqual(float(np.max(h)), 8.038873388460928e-14, places=16) - self.assertAlmostEqual(float(np.max(d)), 0.0, places=16) + self.assertAlmostEqual(float(np.max(a)), 110.0, places=12) + self.assertAlmostEqual(float(np.max(v)), 0.0, places=12) + self.assertAlmostEqual(float(np.max(h)), 0.0, places=12) + self.assertAlmostEqual(float(np.max(d)), 0.0, places=12) - self.assertAlmostEqual(float(np.min(a)), 109.99999999999997, places=16) - self.assertAlmostEqual(float(np.min(v)), 8.526512829121202e-14, places=16) - self.assertAlmostEqual(float(np.min(h)), 8.038873388460928e-14, places=16) - self.assertAlmostEqual(float(np.min(d)), 0.0, places=16) + self.assertAlmostEqual(float(np.min(a)), 110.0, places=12) + self.assertAlmostEqual(float(np.min(v)), 0.0, places=12) + self.assertAlmostEqual(float(np.min(h)), 0.0, places=12) + self.assertAlmostEqual(float(np.min(d)), 0.0, places=12) class AdmDwt2CyTestOnAkiyo(unittest.TestCase):