| 12345678910111213141516171819202122232425262728 |
- from pathlib import Path
- import pytest
- from tools.encode_6400_hex import Encoder
- ROOT = Path(__file__).resolve().parents[2]
- def test_set_all_pid_and_get_match_generated_golden_vectors() -> None:
- encoder = Encoder()
- golden = encoder.contract["golden_vectors"]["frames"]
- assert encoder.set_all("6400-front-rear", [0] * 24, [20] * 4, [20] * 4).hex().upper() == golden["set_all_safe"]
- assert encoder.set_pid_target("6400-front-rear", 70).hex().upper() == golden["set_pid_target_70"]
- assert encoder.get_snapshot("6400-front-rear").hex().upper() == golden["get_snapshot"]
- def test_single_product_rejects_reserved_stimulus() -> None:
- encoder = Encoder()
- with pytest.raises(ValueError, match="not supported"):
- encoder.set_stimulus("6400-front-rear", 1, [0] * 24, [0] * 4, [0] * 4)
- def test_only_canonical_profile_names_are_accepted() -> None:
- encoder = Encoder()
- with pytest.raises(ValueError, match="unknown canonical profile"):
- encoder.get_snapshot("production")
|