Skip to content

Commit

Permalink
test: Ensure states are float as per 683a12e
Browse files Browse the repository at this point in the history
  • Loading branch information
iwishiwasaneagle committed Mar 2, 2023
1 parent 8aeba67 commit ab208fd
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions tests/test_data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from scipy.spatial.transform import Rotation as R


@pytest.fixture(params=[(0,) * 20])
@pytest.fixture(params=[(0.0,) * 20])
def state(request):
return State(request.param)

Expand Down Expand Up @@ -52,7 +52,30 @@ def test_state_to_x_to_state(s):


def test_state_to_x():
state = State([1, 2, 3, 0, 0, 0, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 0, 0, 0])
state = State(
[
1.0,
2.0,
3.0,
0.0,
0.0,
0.0,
0.0,
4.0,
5.0,
6.0,
7.0,
8.0,
9.0,
10.0,
11.0,
12.0,
0.0,
0.0,
0.0,
0.0,
]
)
state_to_x = state.to_x()
assert np.allclose(state_to_x[:3], (1, 2, 3))
assert np.allclose(state_to_x[3:6], (7, 8, 9))
Expand All @@ -61,7 +84,7 @@ def test_state_to_x():


def test_x_to_state():
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
x = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0]
x_to_state = State.from_x(x)
assert np.allclose(x_to_state.pos, (1, 2, 3))
assert np.allclose(x_to_state.vel, (4, 5, 6))
Expand Down

0 comments on commit ab208fd

Please sign in to comment.