From bbf379e3ab2a0705ff28cb97c0486b5c0987b3b0 Mon Sep 17 00:00:00 2001 From: Christian Reksten-Monsen Date: Sun, 15 Apr 2018 18:20:20 +0800 Subject: [PATCH] Add test case for floating point representation error in angle2() fixed in 2dd5bb. See also: #28, #19, 2dd5bb --- tests/test_pvg.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_pvg.py b/tests/test_pvg.py index 0f6e036..7362a3f 100644 --- a/tests/test_pvg.py +++ b/tests/test_pvg.py @@ -83,6 +83,28 @@ def test_angle_function(): assert degrees(angle(center, point_f)) == 225 +"""This tests for floating point representation errors""" +def test_angle2_function(): + polys = [[Point(353.6790486272709, 400.99387840984855), + Point(351.1303807396073, 398.8696192603927), + Point(349.5795890382704, 397.8537806679034), + Point(957.1067811865476, -207.10678118654744), + Point(-457.10678118654766, -207.10678118654744), + Point(-457.10678118654744, 1207.1067811865476), + Point(957.1067811865476, 1207.1067811865473), + Point(353.52994294901674, 606.0798841165788), + Point(354.0988628008279, 604.098862800828), + Point(354.52550331744527, 601.3462324760635), + Point(352.6969055662087, 602.6943209889012), + Point(351.22198101804634, 603.781672670995), + Point(247.0, 500.0), + Point(341.8964635104416, 405.50444716676054), + Point(349.24224903733045, 410.671256247085), + Point(350.84395848060774, 407.17766877398697)]] + v = vg.VisGraph() + v.build(polys) + + def test_edge_intersect_function(): point_a = Point(3.0, 5.0) point_b = Point(5.0, 3.0)