mirror of
https://github.com/enzet/map-machine.git
synced 2025-05-22 13:36:26 +02:00
Issue #20: fix compass points parsing; refactor.
This commit is contained in:
parent
b443a59c49
commit
6d938a1248
13 changed files with 193 additions and 166 deletions
22
test/test_direction.py
Normal file
22
test/test_direction.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
"""
|
||||
Test direction processing.
|
||||
|
||||
Author: Sergey Vartanov (me@enzet.ru).
|
||||
"""
|
||||
import numpy as np
|
||||
|
||||
from roentgen.direction import parse_vector
|
||||
|
||||
|
||||
def test_compass_points_1():
|
||||
assert np.allclose(parse_vector("N"), np.array([0, -1]))
|
||||
|
||||
|
||||
def test_compass_points_2():
|
||||
root: np.float64 = -np.sqrt(2) / 2
|
||||
assert np.allclose(parse_vector("NW"), np.array([root, root]))
|
||||
|
||||
|
||||
def test_compass_points_3():
|
||||
assert np.allclose(
|
||||
parse_vector("SSW"), np.array([-0.38268343, 0.92387953]))
|
Loading…
Add table
Add a link
Reference in a new issue