1
0
Files
h8-536-decoder/tests/test_consistency.py
2026-05-25 21:00:25 +10:00

37 lines
1.2 KiB
Python

import unittest
from h8536.consistency import analyze_decompiler_consistency, format_consistency_report
class ConsistencyTest(unittest.TestCase):
def test_flags_byte_immediate_word_destination_cases(self):
payload = {
"instructions": [
{
"address": 0x4067,
"text": "MOV:G.W #H'00, @(-H'0790,R2)",
"mnemonic": "MOV:G.W",
"operands": "#H'00, @(-H'0790,R2)",
},
{
"address": 0x5000,
"text": "MOV:I.W #H'1234, R0",
"mnemonic": "MOV:I.W",
"operands": "#H'1234, R0",
},
],
}
analysis = analyze_decompiler_consistency(payload)
self.assertEqual(len(analysis["checks"]), 1)
check = analysis["checks"][0]
self.assertEqual(check["address"], 0x4067)
self.assertEqual(check["zero_extended_value_hex"], "0x0000")
self.assertIn("zero-extended word", check["summary"])
self.assertIn("H'4067", format_consistency_report(analysis))
if __name__ == "__main__":
unittest.main()