38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
import unittest
|
|
|
|
from h8536.serial_scenario_compare import format_comparison
|
|
|
|
|
|
class SerialScenarioCompareTest(unittest.TestCase):
|
|
def test_comparison_reports_extra_selector_and_value(self):
|
|
baseline = {
|
|
"_path": "baseline.json",
|
|
"log": "baseline.txt",
|
|
"rx_frames": 10,
|
|
"ack_sent": 2,
|
|
"ack_targets": {
|
|
"01 00 02 00 00 59": 1,
|
|
},
|
|
}
|
|
candidate = {
|
|
"_path": "candidate.json",
|
|
"log": "candidate.txt",
|
|
"rx_frames": 12,
|
|
"ack_sent": 3,
|
|
"ack_targets": {
|
|
"01 00 02 00 00 59": 1,
|
|
"01 01 0F 80 00 D5": 1,
|
|
},
|
|
}
|
|
|
|
report = format_comparison(baseline, candidate)
|
|
|
|
self.assertIn("extra ACK-target frames in candidate", report)
|
|
self.assertIn("01 01 0F 80 00 D5", report)
|
|
self.assertIn("selector=0x008F", report)
|
|
self.assertIn("value=0x8000", report)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|