36 lines
1.5 KiB
Python
36 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
from __future__ import annotations
|
|
|
|
import hashlib
|
|
import json
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
REPORT = ROOT / "coverage/axis3-tutorial-web-wasm-complete-parity.report.json"
|
|
|
|
|
|
class Axis3TutorialCompleteParityTests(unittest.TestCase):
|
|
def test_contract(self) -> None:
|
|
report = json.loads(REPORT.read_text(encoding="utf-8"))
|
|
self.assertEqual(report["schema"], "axis3-tutorial-web-wasm-complete-parity.v2")
|
|
self.assertEqual(report["task_id"], "PANEL-15-SELECTED-CASE-ACCEPTANCE")
|
|
self.assertEqual(report["status"], "verified")
|
|
self.assertTrue(report["candidate_eligible"])
|
|
self.assertEqual(report["release_action"], "ALLOW_RELEASE")
|
|
self.assertEqual(report["passed_command_count"], report["required_command_count"])
|
|
self.assertEqual(report["failure_samples"], [])
|
|
self.assertIn("wasm_core", report["authority_chain"])
|
|
self.assertIn("real hardware and realtime kernel remain REAL-EXCLUDED", report["boundaries"])
|
|
|
|
def test_self_hash(self) -> None:
|
|
report = json.loads(REPORT.read_text(encoding="utf-8"))
|
|
unsigned = {key: value for key, value in report.items() if key != "report_sha256"}
|
|
expected = hashlib.sha256(json.dumps(unsigned, ensure_ascii=False, sort_keys=True, separators=(",", ":")).encode()).hexdigest()
|
|
self.assertEqual(report["report_sha256"], expected)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|