forked from AtsushiSakai/PythonRobotics
-
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.
Test code clean up (AtsushiSakai#456)
* Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up * Test code clean up
- Loading branch information
1 parent
8861977
commit 67d7d5c
Showing
88 changed files
with
850 additions
and
1,310 deletions.
There are no files selected for viewing
File renamed without changes.
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,4 @@ | ||
import os | ||
import sys | ||
|
||
sys.path.append(os.path.dirname(os.path.abspath(__file__))) |
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,3 @@ | ||
import sys | ||
import os | ||
sys.path.append(os.path.dirname(os.path.abspath(__file__))) |
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
File renamed without changes.
File renamed without changes.
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
Empty file.
Empty file.
Empty file.
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,4 @@ | ||
import os | ||
import sys | ||
|
||
sys.path.append(os.path.dirname(os.path.abspath(__file__))) |
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,8 @@ | ||
import os | ||
import sys | ||
|
||
sys.path.append(os.path.dirname(os.path.abspath(__file__))) | ||
sys.path.append(os.path.dirname( | ||
os.path.abspath(__file__)) + "/../ReedsSheppPath/") | ||
sys.path.append(os.path.dirname( | ||
os.path.abspath(__file__)) + "/../RRTStarReedsShepp/") |
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,7 @@ | ||
import os | ||
import sys | ||
|
||
GRID_MAP_LIB = os.path.dirname(os.path.abspath(__file__)) + \ | ||
"/../../Mapping/" | ||
|
||
sys.path.append(GRID_MAP_LIB) |
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,4 @@ | ||
import os | ||
import sys | ||
|
||
sys.path.append(os.path.dirname(os.path.abspath(__file__))) |
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,4 @@ | ||
import os | ||
import sys | ||
|
||
sys.path.append(os.path.dirname(os.path.abspath(__file__))) |
Empty file.
Empty file.
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
#!/usr/bin/env bash | ||
echo "Run test suites! " | ||
# tests: include unittest based tests | ||
|
||
# === pytest based test runner === | ||
# -Werror: warning as error | ||
# --durations=0: show ranking of test durations | ||
pytest tests -Werror --durations=0 | ||
# -l (--showlocals); show local variables when test failed | ||
pytest tests -l -Werror --durations=0 |
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,13 @@ | ||
"""Path hack to make tests work.""" | ||
import sys | ||
import os | ||
import pytest | ||
|
||
TEST_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
sys.path.append(TEST_DIR) # to import this file from test code. | ||
ROOT_DIR = os.path.dirname(TEST_DIR) | ||
sys.path.append(ROOT_DIR) | ||
|
||
|
||
def run_this_test(file): | ||
pytest.main([os.path.abspath(file)]) |
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 |
---|---|---|
@@ -1,15 +1,11 @@ | ||
import sys | ||
from unittest import TestCase | ||
|
||
sys.path.append("./PathPlanning/LQRPlanner") | ||
|
||
import conftest # Add root path to sys.path | ||
from PathPlanning.LQRPlanner import LQRplanner as m | ||
|
||
print(__file__) | ||
|
||
def test_1(): | ||
m.SHOW_ANIMATION = False | ||
m.main() | ||
|
||
class Test(TestCase): | ||
|
||
def test1(self): | ||
m.SHOW_ANIMATION = False | ||
m.main() | ||
if __name__ == '__main__': | ||
conftest.run_this_test(__file__) |
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 |
---|---|---|
@@ -1,20 +1,11 @@ | ||
from unittest import TestCase | ||
import sys | ||
import os | ||
sys.path.append(os.path.dirname(__file__) + "/../") | ||
try: | ||
from PathPlanning.AStar import a_star as m | ||
except: | ||
raise | ||
import conftest | ||
from PathPlanning.AStar import a_star as m | ||
|
||
|
||
class Test(TestCase): | ||
def test_1(): | ||
m.show_animation = False | ||
m.main() | ||
|
||
def test1(self): | ||
m.show_animation = False | ||
m.main() | ||
|
||
|
||
if __name__ == '__main__': # pragma: no cover | ||
test = Test() | ||
test.test1() | ||
if __name__ == '__main__': | ||
conftest.run_this_test(__file__) |
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 |
---|---|---|
@@ -1,27 +1,16 @@ | ||
from unittest import TestCase | ||
import os | ||
import sys | ||
import conftest | ||
from PathPlanning.AStar import a_star_searching_from_two_side as m | ||
|
||
sys.path.append(os.path.dirname(__file__) + '/../') | ||
|
||
try: | ||
from PathPlanning.AStar import a_star_searching_from_two_side as m | ||
except ImportError: | ||
raise | ||
def test1(): | ||
m.show_animation = False | ||
m.main(800) | ||
|
||
|
||
class Test(TestCase): | ||
|
||
def test1(self): | ||
m.show_animation = False | ||
m.main(800) | ||
|
||
def test2(self): | ||
m.show_animation = False | ||
m.main(5000) # increase obstacle number, block path | ||
def test2(): | ||
m.show_animation = False | ||
m.main(5000) # increase obstacle number, block path | ||
|
||
|
||
if __name__ == '__main__': | ||
test = Test() | ||
test.test1() | ||
test.test2() | ||
conftest.run_this_test(__file__) |
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 |
---|---|---|
@@ -1,50 +1,44 @@ | ||
import PathPlanning.AStar.a_star_variants as astar | ||
from unittest import TestCase | ||
import sys | ||
import os | ||
sys.path.append(os.path.dirname(__file__) + "/../") | ||
|
||
|
||
class Test(TestCase): | ||
|
||
def test(self): | ||
# A* with beam search | ||
astar.show_animation = False | ||
|
||
astar.use_beam_search = True | ||
astar.main() | ||
self.reset_all() | ||
|
||
# A* with iterative deepening | ||
astar.use_iterative_deepening = True | ||
astar.main() | ||
self.reset_all() | ||
|
||
# A* with dynamic weighting | ||
astar.use_dynamic_weighting = True | ||
astar.main() | ||
self.reset_all() | ||
|
||
# theta* | ||
astar.use_theta_star = True | ||
astar.main() | ||
self.reset_all() | ||
|
||
# A* with jump point | ||
astar.use_jump_point = True | ||
astar.main() | ||
self.reset_all() | ||
|
||
@staticmethod | ||
def reset_all(): | ||
astar.show_animation = False | ||
astar.use_beam_search = False | ||
astar.use_iterative_deepening = False | ||
astar.use_dynamic_weighting = False | ||
astar.use_theta_star = False | ||
astar.use_jump_point = False | ||
|
||
|
||
if __name__ == '__main__': # pragma: no cover | ||
test = Test() | ||
test.test() | ||
import PathPlanning.AStar.a_star_variants as a_star | ||
import conftest | ||
|
||
|
||
def test_1(): | ||
# A* with beam search | ||
a_star.show_animation = False | ||
|
||
a_star.use_beam_search = True | ||
a_star.main() | ||
reset_all() | ||
|
||
# A* with iterative deepening | ||
a_star.use_iterative_deepening = True | ||
a_star.main() | ||
reset_all() | ||
|
||
# A* with dynamic weighting | ||
a_star.use_dynamic_weighting = True | ||
a_star.main() | ||
reset_all() | ||
|
||
# theta* | ||
a_star.use_theta_star = True | ||
a_star.main() | ||
reset_all() | ||
|
||
# A* with jump point | ||
a_star.use_jump_point = True | ||
a_star.main() | ||
reset_all() | ||
|
||
|
||
def reset_all(): | ||
a_star.show_animation = False | ||
a_star.use_beam_search = False | ||
a_star.use_iterative_deepening = False | ||
a_star.use_dynamic_weighting = False | ||
a_star.use_theta_star = False | ||
a_star.use_jump_point = False | ||
|
||
|
||
if __name__ == '__main__': | ||
conftest.run_this_test(__file__) |
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 |
---|---|---|
@@ -1,25 +1,14 @@ | ||
from unittest import TestCase | ||
import sys | ||
import os | ||
import random | ||
sys.path.append(os.path.dirname(__file__) + "/../") | ||
try: | ||
from PathPlanning.BatchInformedRRTStar import batch_informed_rrtstar as m | ||
except ImportError: | ||
raise | ||
|
||
print(__file__) | ||
import conftest | ||
from PathPlanning.BatchInformedRRTStar import batch_informed_rrtstar as m | ||
|
||
random.seed(12345) | ||
|
||
def test_1(): | ||
m.show_animation = False | ||
random.seed(12345) | ||
m.main(maxIter=10) | ||
|
||
class Test(TestCase): | ||
|
||
def test1(self): | ||
m.show_animation = False | ||
m.main(maxIter=10) | ||
|
||
|
||
if __name__ == '__main__': # pragma: no cover | ||
test = Test() | ||
test.test1() | ||
if __name__ == '__main__': | ||
conftest.run_this_test(__file__) |
Oops, something went wrong.