From e3da29f62b25aec170a91ddd8022f676728bb5d4 Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Tue, 9 Jan 2024 20:22:32 +0200 Subject: [PATCH] tests(ai): add heuristic tests --- tests/ai/test_heuristics.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/ai/test_heuristics.py b/tests/ai/test_heuristics.py index d58d483..268aecf 100644 --- a/tests/ai/test_heuristics.py +++ b/tests/ai/test_heuristics.py @@ -1,6 +1,7 @@ import unittest import numpy as np +from ai.heuristics import aggregate_height, bumpiness, complete_lines, holes class TestHeuristics(unittest.TestCase): @@ -15,3 +16,15 @@ class TestHeuristics(unittest.TestCase): [1, 1, 1, 1, 1, 1, 1, 1, 1, 1], ] ) + + def test_aggregate_height(self) -> None: + self.assertEqual(aggregate_height(self.field), 48) + + def test_complete_lines(self) -> None: + self.assertEqual(complete_lines(self.field), 2) + + def test_holes(self) -> None: + self.assertEqual(holes(self.field), 2) + + def test_bumpiness(self) -> None: + self.assertEqual(bumpiness(self.field), 6)