From 3b74d1fdf7e50ccc78ecae70de4da7f26e36437a Mon Sep 17 00:00:00 2001 From: fheinrich <fheinrich@techfak.uni-bielefeld.de> Date: Tue, 5 Dec 2023 09:42:11 +0100 Subject: [PATCH] Added testing for world bounds --- tests/test_start.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/test_start.py b/tests/test_start.py index 839b4cb1..d37a7e87 100644 --- a/tests/test_start.py +++ b/tests/test_start.py @@ -35,8 +35,8 @@ def test_simulator_frequency(): def step(self): self.c += 1 - frequency = 1000 - running_time_seconds = 8 + frequency = 2000 + running_time_seconds = 4 sim = Simulator(TestEnv, frequency) @@ -53,11 +53,11 @@ def test_simulator_frequency(): def test_collision_detection(): sim = Simulator(Environment, 200) - counter_pos = np.array([0, 100]) + counter_pos = np.array([50, 100]) counter = Counter(counter_pos) sim.env.counters = [counter] - player1 = Player("p1", np.array([0, 0])) - player2 = Player("p2", np.array([0, 200])) + player1 = Player("p1", np.array([50, 50])) + player2 = Player("p2", np.array([50, 200])) sim.register_player(player1) sim.register_player(player2) # same player name @@ -72,4 +72,7 @@ def test_collision_detection(): player2.move_abs(counter_pos) assert sim.env.detect_player_collision(player1), "Players at same pos. Not detected." + player1.move_abs(np.array([0, 0])) + assert sim.env.detect_collision_world_bounds(player1), "Player collides with world bounds." + sim.stop() -- GitLab