From 9f035f88ce1f00d30479d84519866bec1f15e29f Mon Sep 17 00:00:00 2001 From: "Egli Adrian (IT-SCI-API-PFI)" <adrian.egli@sbb.ch> Date: Thu, 19 Sep 2019 08:01:34 +0200 Subject: [PATCH] vec2d testing --- tests/test_flatland_core_grid_grid_utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_flatland_core_grid_grid_utils.py b/tests/test_flatland_core_grid_grid_utils.py index f4995cc9..c2ca47eb 100644 --- a/tests/test_flatland_core_grid_grid_utils.py +++ b/tests/test_flatland_core_grid_grid_utils.py @@ -62,3 +62,13 @@ def test_vec2d_bound(): res_2 = Vec2d.bound(node_b, 2, 2.2) assert res_1 == (-1, -1) assert res_2 == (2, 2.2) + + +def test_vec2d_normalize(): + node_a = (1, 2) + node_b = (4, 12) + res_1 = Vec2d.normalize(node_a) + res_2 = Vec2d.normalize(node_b) + eps = 0.000000000001 + assert 1.0 - Vec2d.get_norm(res_1) < eps + assert 1.0 - Vec2d.get_norm(res_2) < eps -- GitLab