From 6946ce9957b36bfd662516291b9c417b07733888 Mon Sep 17 00:00:00 2001 From: DuSack1220 Date: Sat, 1 Oct 2022 16:50:49 +0200 Subject: [PATCH] added unittest for seeding gamestate generation fixed bug in gamestate.get_logistic_plan --- client_s2/compLib/Seeding.py | 2 ++ client_s2/test.py | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 client_s2/test.py diff --git a/client_s2/compLib/Seeding.py b/client_s2/compLib/Seeding.py index e3affc3..ab49a21 100644 --- a/client_s2/compLib/Seeding.py +++ b/client_s2/compLib/Seeding.py @@ -77,6 +77,8 @@ Logistic Centers: {self.logistic_center}""" for i in range(0, len(self.logistic_plan) - 1): self.logistic_center[self.logistic_plan[i]][self.logistic_plan[i + 1]] += 1 + self.logistic_plan = [x + 10 for x in self.logistic_plan] + def get_heuballen(self) -> int: return self.heu_color diff --git a/client_s2/test.py b/client_s2/test.py new file mode 100644 index 0000000..9d4b99c --- /dev/null +++ b/client_s2/test.py @@ -0,0 +1,17 @@ +import unittest +import compLib.Seeding as Seeding + + +class SeedingTest(unittest.TestCase): + def test_basic_seed(self): + gamestate = Seeding.Gamestate(0) + self.assertEqual(gamestate.seed, 0) + self.assertEqual(gamestate.heu_color, 1) + self.assertEqual(gamestate.get_heuballen(), 1) + self.assertEqual(gamestate.get_logistic_plan(), + [12, 13, 10, 13, 12, 10, 11, 10, 12, 11, 12, 13, 10, 12, 10, 11, 13, 11, 13, 11, 12]) + self.assertEqual(gamestate.get_material_deliveries(), [[3, 1], [0, 3], [3, 1], [3, 1]]) + + +if __name__ == '__main__': + unittest.main()