From 8189e74c7538dfd8d94c0e4994cfce3e2455dfb1 Mon Sep 17 00:00:00 2001 From: articuno12 Date: Wed, 22 Mar 2017 04:43:05 +0530 Subject: [PATCH 1/2] Added testcase for agents.py --- tests/test_agents.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/test_agents.py b/tests/test_agents.py index 89ee3fcf3..bbd165d90 100644 --- a/tests/test_agents.py +++ b/tests/test_agents.py @@ -1,4 +1,5 @@ from agents import Direction +from agents import ReflexVacuumAgent , ModelBasedVacuumAgent ,TrivialVacuumEnvironment def test_move_forward(): d = Direction("up") @@ -38,3 +39,26 @@ def test_add(): assert l1.direction == Direction.U assert l2.direction == Direction.D #fixed +def test_ReflexVacuumAgent() : + # create an object of the ReflexVacuumAgent + agent = ReflexVacuumAgent() + # create an object of TrivialVacuumEnvironment + environment = TrivialVacuumEnvironment() + # add agent to the environment + environment.add_thing(agent) + # run the environment + environment.run() + # check final status of the environment + assert environment.status == {(1,0):'Clean' , (0,0) : 'Clean'} + +def test_ModelBasedVacuumAgent() : + # create an object of the ModelBasedVacuumAgent + agent = ModelBasedVacuumAgent() + # create an object of TrivialVacuumEnvironment + environment = TrivialVacuumEnvironment() + # add agent to the environment + environment.add_thing(agent) + # run the environment + environment.run() + # check final status of the environment + assert environment.status == {(1,0):'Clean' , (0,0) : 'Clean'} From fa229713c176467a34a51503df5ec200a7a09e57 Mon Sep 17 00:00:00 2001 From: Peter Norvig Date: Tue, 21 Mar 2017 23:50:15 -0700 Subject: [PATCH 2/2] spacing around commas was wrong --- tests/test_agents.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_agents.py b/tests/test_agents.py index bbd165d90..77421c2c7 100644 --- a/tests/test_agents.py +++ b/tests/test_agents.py @@ -1,5 +1,5 @@ from agents import Direction -from agents import ReflexVacuumAgent , ModelBasedVacuumAgent ,TrivialVacuumEnvironment +from agents import ReflexVacuumAgent, ModelBasedVacuumAgent, TrivialVacuumEnvironment def test_move_forward(): d = Direction("up")