Skip to content

Commit adf6b8e

Browse files
committed
Add IMU tests
1 parent 8fed4e3 commit adf6b8e

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
"""
2+
imu_manager_test.py:
3+
4+
Simple integration tests for the Watchdog component.
5+
Tests are ordered so that stop tests run last.
6+
"""
7+
8+
import pytest
9+
10+
11+
@pytest.fixture(autouse=True)
12+
def send_packet(fprime_test_api):
13+
"""Fixture to clear histories and send the IMU packet before each test"""
14+
fprime_test_api.clear_histories()
15+
fprime_test_api.send_and_assert_command("CdhCore.tlmSend.SEND_PKT", ["6"], max_delay=2)
16+
17+
18+
def test_01_acceleration_telemetry(fprime_test_api):
19+
"""Test that we can get Acceleration telemetry"""
20+
result = fprime_test_api.assert_telemetry(
21+
"ReferenceDeployment.lsm6dsoManager.Acceleration",
22+
start="NOW", timeout=3
23+
)
24+
25+
reading = result.get_val()
26+
assert all(reading[k] != 0 for k in ("x", "y", "z")), f"Acceleration values should be non-zero, got {reading}"
27+
28+
29+
def test_02_angular_velocity_telemetry(fprime_test_api):
30+
"""Test that we can get AngularVelocity telemetry"""
31+
result = fprime_test_api.assert_telemetry(
32+
"ReferenceDeployment.lsm6dsoManager.AngularVelocity",
33+
start="NOW", timeout=3
34+
)
35+
36+
reading = result.get_val()
37+
assert all(reading[k] != 0 for k in ("x", "y", "z")), f"Acceleration values should be non-zero, got {reading}"
38+
39+
40+
def test_03_temperature_telemetry(fprime_test_api):
41+
"""Test that we can get Temperature telemetry"""
42+
result = fprime_test_api.assert_telemetry(
43+
"ReferenceDeployment.lsm6dsoManager.Temperature",
44+
start="NOW", timeout=3
45+
)
46+
47+
reading = result.get_val()
48+
assert result.get_val() != 0, f"Temperature reading should be non-zero"
49+
50+
51+
def test_04_magnetic_field_telemetry(fprime_test_api):
52+
"""Test that we can get MagneticField telemetry"""
53+
result = fprime_test_api.assert_telemetry(
54+
"ReferenceDeployment.lis2mdlManager.MagneticField",
55+
start="NOW", timeout=3
56+
)
57+
58+
reading = result.get_val()
59+
assert all(reading[k] != 0 for k in ("x", "y", "z")), f"Acceleration values should be non-zero, got {reading}"

0 commit comments

Comments
 (0)