-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Benjamin Becker
committed
Jul 29, 2021
1 parent
43a6b5f
commit a8004a0
Showing
2 changed files
with
52 additions
and
22 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,40 @@ | ||
import unittest | ||
from reeds_shepp import PathElement, Steering, Gear, path_length | ||
|
||
|
||
class TestPathElement(unittest.TestCase): | ||
def setUp(self) -> None: | ||
self.element = PathElement(13, Steering.LEFT, Gear.FORWARD) | ||
|
||
def test_repr(self): | ||
self.assertEqual( | ||
repr(self.element), | ||
"{ Steering: LEFT Gear: FORWARD distance: 13 }" | ||
) | ||
|
||
def test_reverse_gear(self): | ||
self.element.reverse_gear() | ||
self.assertEqual( | ||
self.element.gear, | ||
Gear.BACKWARD | ||
) | ||
|
||
def test_reverse_steering(self): | ||
self.element.reverse_steering() | ||
self.assertEqual( | ||
self.element.steering, | ||
Steering.RIGHT | ||
) | ||
|
||
|
||
class TestPathLength(unittest.TestCase): | ||
def test_with_positive_path_elements(self): | ||
path = [PathElement(1, Steering.LEFT, Gear.FORWARD) for _ in range(2)] | ||
self.assertEqual( | ||
path_length(path), | ||
2 | ||
) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |