IQ.Pilot Prebuilt Release @ 27f668a
This commit is contained in:
27
iqpilot/cereal/messaging/tests/test_services.py
Normal file
27
iqpilot/cereal/messaging/tests/test_services.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import os
|
||||
import tempfile
|
||||
from typing import Dict
|
||||
from parameterized import parameterized
|
||||
|
||||
from iqpilot.cereal import log
|
||||
import iqpilot.cereal.services as services
|
||||
from iqpilot.cereal.services import SERVICE_LIST
|
||||
|
||||
|
||||
class TestServices:
|
||||
|
||||
@parameterized.expand(SERVICE_LIST.keys())
|
||||
def test_services(self, s):
|
||||
service = SERVICE_LIST[s]
|
||||
assert service.frequency <= 104
|
||||
assert service.decimation != 0
|
||||
|
||||
def test_generated_header(self):
|
||||
with tempfile.NamedTemporaryFile(suffix=".h") as f:
|
||||
ret = os.system(f"python3 {services.__file__} > {f.name} && clang++ {f.name} -std=c++11")
|
||||
assert ret == 0, "generated services header is not valid C"
|
||||
|
||||
def test_all_services_exist_in_log_union(self):
|
||||
event_fields = set(log.Event.schema.union_fields)
|
||||
missing = sorted(s for s in SERVICE_LIST if s not in event_fields)
|
||||
assert not missing, f"services missing from log.capnp Event union: {missing}"
|
||||
Reference in New Issue
Block a user