forked from aimacode/aima-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request aimacode#121 from Chipe1/test
Created test_search.py
- Loading branch information
Showing
3 changed files
with
72 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pytest | ||
from search import * | ||
|
||
|
||
romania = GraphProblem('Arad', 'Bucharest', Fig[3, 2]) | ||
|
||
def test_breadth_first_tree_search(): | ||
assert breadth_first_tree_search(romania).solution() == ['Sibiu', 'Fagaras', 'Bucharest'] | ||
|
||
def test_breadth_first_search(): | ||
assert breadth_first_search(romania).solution() == ['Sibiu', 'Fagaras', 'Bucharest'] | ||
|
||
def test_uniform_cost_search(): | ||
assert uniform_cost_search(romania).solution() == ['Sibiu', 'Rimnicu', 'Pitesti', 'Bucharest'] | ||
|
||
def test_depth_first_graph_search(): | ||
solution = depth_first_graph_search(romania).solution() | ||
assert solution[-1] == 'Bucharest' | ||
|
||
def test_iterative_deepening_search(): | ||
assert iterative_deepening_search(romania).solution() == ['Sibiu', 'Fagaras', 'Bucharest'] | ||
|
||
if __name__ == '__main__': | ||
pytest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters