From 7922ab570aa2051ff11279e1477679efc5b23482 Mon Sep 17 00:00:00 2001 From: Sarah Laplante Date: Fri, 9 May 2025 13:06:11 +0200 Subject: [PATCH] add floating point stability test --- test/test_generation.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/test_generation.py b/test/test_generation.py index 95ec61d..86dc508 100644 --- a/test/test_generation.py +++ b/test/test_generation.py @@ -82,6 +82,12 @@ def test_normalizing(self): psf = 'M 0.0,0.0 L 340.0,-10.0 L 100.0,100.0 L 200.0,0.0' self.assertTrue(parse_path(path).d() in (ps, psf)) + def test_floating_point_stability(self): + # Check that reading and then outputting a d-string + # does not introduce floating point error noise. + path = "M 70.63,10.42 C 0.11,0.33 -0.89,2.09 -1.54,2.45 C -4.95,2.73 -17.52,7.24 -39.46,11.04" + self.assertEqual(parse_path(path).d(), path) + if __name__ == '__main__': unittest.main()