Skip to content

Commit 070d223

Browse files
committed
test: add test for the dimensions checking
1 parent 291929c commit 070d223

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

unittest/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ ENDIF()
3636
ADD_PYTHON_UNIT_TEST("py-matrix" "unittest/python/test_matrix.py" "unittest")
3737
ADD_PYTHON_UNIT_TEST("py-geometry" "unittest/python/test_geometry.py" "unittest")
3838
ADD_PYTHON_UNIT_TEST("py-switch" "unittest/python/test_switch.py" "python/eigenpy")
39+
ADD_PYTHON_UNIT_TEST("py-dimensions" "unittest/python/test_dimensions.py" "python/eigenpy")

unittest/python/test_dimensions.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from __future__ import print_function
2+
3+
import eigenpy
4+
import numpy as np
5+
6+
quat = eigenpy.Quaternion()
7+
# By default, we convert as numpy.matrix
8+
coeffs_vector = quat.coeffs()
9+
assert len(coeffs_vector.shape) == 2
10+
11+
# Switch to numpy.array
12+
eigenpy.switchToNumpyArray()
13+
coeffs_vector = quat.coeffs()
14+
assert len(coeffs_vector.shape) == 1

0 commit comments

Comments
 (0)