From 757faf0f93f2dcec05ea3433ad626139dc4c1551 Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Sun, 14 Jan 2024 19:53:55 +0200 Subject: [PATCH] tests: add additional field --- tests/ai/test_heuristics.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/ai/test_heuristics.py b/tests/ai/test_heuristics.py index 6490ffc..dafda31 100644 --- a/tests/ai/test_heuristics.py +++ b/tests/ai/test_heuristics.py @@ -29,19 +29,37 @@ class TestHeuristics(unittest.TestCase): [1, 1, 0, 1, 1, 0, 0, 0, 0, 1], ] ) + self.field3 = np.array( + [ + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 1, 0, 0, 0, 0, 0, 0, 0, 0], + [0, 1, 1, 0, 0, 0, 0, 0, 0, 1], + [1, 1, 1, 0, 0, 0, 0, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 0, 0, 1, 1], + ] + ) def test_aggregate_height(self) -> None: self.assertEqual(aggregate_height(self.field), 48) self.assertEqual(aggregate_height(self.field2), 12) + self.assertEqual(aggregate_height(self.field3), 30) def test_complete_lines(self) -> None: self.assertEqual(complete_lines(self.field), 2) self.assertEqual(complete_lines(self.field2), 0) + self.assertEqual(complete_lines(self.field3), 1) def test_holes(self) -> None: self.assertEqual(count_holes(self.field), 2) self.assertEqual(count_holes(self.field2), 0) + self.assertEqual(count_holes(self.field3), 2) def test_bumpiness(self) -> None: self.assertEqual(get_bumpiness(self.field), 6) self.assertEqual(get_bumpiness(self.field2), 11) + self.assertEqual(get_bumpiness(self.field3), 7)