Skip to content

Commit

Permalink
update AdmDwt2CyTest to use actual expected values rather than partic…
Browse files Browse the repository at this point in the history
…ular floating point rounding errors
  • Loading branch information
cosmin committed Jan 24, 2024
1 parent 91fee56 commit 2918ff2
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions python/test/cy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down

0 comments on commit 2918ff2

Please sign in to comment.