mirror of
https://github.com/enzet/map-machine.git
synced 2025-06-11 23:31:49 +02:00
Add test for main direction.
This commit is contained in:
parent
0747f279c8
commit
172b48af53
1 changed files with 14 additions and 6 deletions
|
@ -3,7 +3,7 @@ Test direction processing.
|
||||||
"""
|
"""
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from roentgen.direction import parse_vector
|
from roentgen.direction import parse_vector, DirectionSet
|
||||||
|
|
||||||
__author__ = "Sergey Vartanov"
|
__author__ = "Sergey Vartanov"
|
||||||
__email__ = "me@enzet.ru"
|
__email__ = "me@enzet.ru"
|
||||||
|
@ -33,3 +33,11 @@ def test_invalid() -> None:
|
||||||
def test_degree() -> None:
|
def test_degree() -> None:
|
||||||
"""Test east direction."""
|
"""Test east direction."""
|
||||||
assert np.allclose(parse_vector("90"), np.array([1, 0]))
|
assert np.allclose(parse_vector("90"), np.array([1, 0]))
|
||||||
|
|
||||||
|
|
||||||
|
def test_main_direction() -> None:
|
||||||
|
"""Test main direction computing."""
|
||||||
|
assert DirectionSet("0").is_right() is None
|
||||||
|
assert DirectionSet("70").is_right() is True
|
||||||
|
assert DirectionSet("270").is_right() is False
|
||||||
|
assert DirectionSet("180").is_right() is None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue