From e45fb4d04bf1b432c87e945faf3e68eac1e3b001 Mon Sep 17 00:00:00 2001 From: Norbu Tsering Date: Sun, 7 Apr 2019 03:25:00 +0000 Subject: [PATCH 1/2] Added test for cube_round --- test/test_rounding.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/test_rounding.py diff --git a/test/test_rounding.py b/test/test_rounding.py new file mode 100644 index 0000000..05aff2d --- /dev/null +++ b/test/test_rounding.py @@ -0,0 +1,15 @@ +import numpy as np +import hexy as hx + +def test_cube_round(): + test_coords = np.array([ + [1.1, -1.4, 0.3], + [3.3, 2.3, -5.4], + ]); + + expected_coords = np.array([ + [1, -1, 0], + [3, 2, -5], + ]); + + assert(np.array_equal(hx.cube_round(test_coords), expected_coords)) From be003b52f67fa12a6200ca7e0c50be1097beb517 Mon Sep 17 00:00:00 2001 From: Norbu Tsering Date: Sun, 7 Apr 2019 03:35:30 +0000 Subject: [PATCH 2/2] axial_round test --- test/test_rounding.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/test_rounding.py b/test/test_rounding.py index 05aff2d..7db7298 100644 --- a/test/test_rounding.py +++ b/test/test_rounding.py @@ -9,7 +9,20 @@ def test_cube_round(): expected_coords = np.array([ [1, -1, 0], - [3, 2, -5], + [3, 2, -5], ]); assert(np.array_equal(hx.cube_round(test_coords), expected_coords)) + +def test_axial_round(): + test_coords = np.array([ + [1.1, -1.4], + [3.3, 2.3], + ]); + + expected_coords = np.array([ + [1, -1], + [3, 2], + ]); + + assert(np.array_equal(hx.axial_round(test_coords), expected_coords))