Skip to content
Snippets Groups Projects
Commit a43e2927 authored by Malte Nyhuis's avatar Malte Nyhuis
Browse files

fix tests for unitvector computations

parent 4b0802e5
No related branches found
No related tags found
1 merge request!10Merge recent changes in master to we_ahrens
Pipeline #8319 passed
import numpy as np import numpy as np
from ntrfc.math.vectorcalc import unitvec_list
def test_absVec(): def test_absVec():
import numpy as np import numpy as np
...@@ -90,15 +88,20 @@ def test_vecAbs_list(): ...@@ -90,15 +88,20 @@ def test_vecAbs_list():
def test_unitvec_list(): def test_unitvec_list():
from ntrfc.math.vectorcalc import unitvec_list
a = np.array([1,0,0]) a = np.array([1,0,0])
b = np.array([0,0,9]) b = np.array([0,0,9])
c = np.stack([a,b]) c = np.stack([a,b])
directions = unitvec_list(c) directions = unitvec_list(c)
assert directions[0] == np.array([1,0,0]) assert all(np.equal(directions[0],np.array([1,0,0])))
assert directions[1] == np.array([0,0,1]) assert all(np.equal(directions[1],np.array([0,0,1])))
def test_unitvec(): def test_unitvec():
from ntrfc.math.vectorcalc import unitvec
a = np.array([9,0,0]) a = np.array([9,0,0])
am = unitvec(a) am = unitvec(a)
assert all(np.equal(am,np.array([1,0,0])))
b = np.array([0,0,-9]) b = np.array([0,0,-9])
bm = unitvec(b)
assert all(np.equal(bm,np.array([0,0,-1])))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment