mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-08-19 18:03:46 +08:00
23 lines
741 B
Python
23 lines
741 B
Python
import subprocess
|
|
import tempfile
|
|
|
|
from openpilot.common.test import OpenpilotTestCase
|
|
from openpilot.common.parameterized import parameterized
|
|
|
|
import openpilot.cereal.services as services
|
|
from openpilot.cereal.services import SERVICE_LIST
|
|
|
|
|
|
class TestServices(OpenpilotTestCase):
|
|
|
|
@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 = subprocess.run(f"python3 {services.__file__} > {f.name} && clang++ {f.name} -std=c++11", shell=True).returncode
|
|
assert ret == 0, "generated services header is not valid C"
|