tests/vectors: OTA test vectors for other implementations (meshcore-open)
ota_vectors.py writes ota_vectors.json from the Python code: package manifests and picks, crc16, the binary write payload, the replies, presets, airtime and frame lengths. meshcore-open's Dart port tests against a copy; test_ota_vectors.py fails when the JSON drifts from the code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
185470de08
commit
10f9dbe9f7
3 files changed
+448
No files matched your search
@@ -0,0 +1,17 @@
|
||||
"""tests/vectors/ota_vectors.json, which other implementations (meshcore-open)
|
||||
test against, must match the Python code -- regenerate it when this fails."""
|
||||
|
||||
import importlib.util
|
||||
import json
|
||||
import os
|
||||
|
||||
VECTORS = os.path.join(os.path.dirname(__file__), "..", "..", "..", "vectors")
|
||||
|
||||
|
||||
def test_vectors_match_the_code():
|
||||
spec = importlib.util.spec_from_file_location("ota_vectors", os.path.join(VECTORS, "ota_vectors.py"))
|
||||
gen = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(gen)
|
||||
with open(os.path.join(VECTORS, "ota_vectors.json")) as f:
|
||||
stored = json.load(f)
|
||||
assert stored == json.loads(json.dumps(gen.build())), "regenerate: python3 tests/vectors/ota_vectors.py"
|
||||
Reference in new issue
Block a user