-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Add unit tests for A* path planner (PythonRobotics #123) #1234
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,53 @@ | ||||||||||||||||||||||||||||||||||||||||
| import unittest | ||||||||||||||||||||||||||||||||||||||||
| from PathPlanning.AStar.a_star import AStarPlanner | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| class TestAStar(unittest.TestCase): | ||||||||||||||||||||||||||||||||||||||||
| def test_basic_path(self): | ||||||||||||||||||||||||||||||||||||||||
| # create simple U-shaped obstacle walls | ||||||||||||||||||||||||||||||||||||||||
| ox = [i for i in range(60)] # bottom wall | ||||||||||||||||||||||||||||||||||||||||
| oy = [0 for _ in range(60)] | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| for i in range(60): # right wall | ||||||||||||||||||||||||||||||||||||||||
| ox.append(60) | ||||||||||||||||||||||||||||||||||||||||
| oy.append(i) | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+6
to
+14
|
||||||||||||||||||||||||||||||||||||||||
| def test_basic_path(self): | |
| # create simple U-shaped obstacle walls | |
| ox = [i for i in range(60)] # bottom wall | |
| oy = [0 for _ in range(60)] | |
| for i in range(60): # right wall | |
| ox.append(60) | |
| oy.append(i) | |
| def generate_u_shaped_obstacles(self): | |
| ox = [i for i in range(60)] # bottom wall | |
| oy = [0 for _ in range(60)] | |
| for i in range(60): # right wall | |
| ox.append(60) | |
| oy.append(i) | |
| return ox, oy | |
| def test_basic_path(self): | |
| # create simple U-shaped obstacle walls | |
| ox, oy = self.generate_u_shaped_obstacles() |
Check notice
Code scanning / CodeQL
Imprecise assert Note test
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rsleiti There is already test file for AStar code. Please move this test code into this file.
https://github.com/AtsushiSakai/PythonRobotics/blob/master/tests/test_a_star.py