Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for TableDrivenAgentProgram. #749

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tests/test_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,20 @@ def test_compare_agents() :
assert performance_ReflexVacummAgent <= performance_ModelBasedVacummAgent


def test_TableDrivenAgentProgram():
table = {(('foo', 1),): 'action1',
(('foo', 2),): 'action2',
(('bar', 1),): 'action3',
(('bar', 2),): 'action1',
(('foo', 1), ('foo', 1),): 'action2',
(('foo', 1), ('foo', 2),): 'action3',
}
agent_program = TableDrivenAgentProgram(table)
assert agent_program(('foo', 1)) == 'action1'
assert agent_program(('foo', 2)) == 'action3'
assert agent_program(('invalid percept',)) == None


def test_Agent():
def constant_prog(percept):
return percept
Expand Down