Complete 3axis tutorial native and Web/WASM parity tools
This commit is contained in:
33
scripts/test_panel_03_source_gate_matrix.py
Normal file
33
scripts/test_panel_03_source_gate_matrix.py
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import sys
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
from generate_panel_03_source_gate_matrix import canonical, OUTPUT
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
class Panel03SourceGateMatrixTests(unittest.TestCase):
|
||||
def test_contract(self) -> None:
|
||||
report = json.loads((ROOT / OUTPUT).read_text(encoding="utf-8"))
|
||||
self.assertEqual(report["schema"], "panel-03-source-gate-matrix.v1")
|
||||
self.assertEqual(report["status"], "verified")
|
||||
self.assertEqual(report["authority"], "worker_axis_gate")
|
||||
self.assertGreaterEqual(len(report["commands"]), 10)
|
||||
self.assertTrue(all(item["status"] == "verified" for item in report["checks"].values()))
|
||||
|
||||
def test_self_hash(self) -> None:
|
||||
report = json.loads((ROOT / OUTPUT).read_text(encoding="utf-8"))
|
||||
unsigned = {key: value for key, value in report.items() if key != "report_sha256"}
|
||||
self.assertEqual(report["report_sha256"], hashlib.sha256(canonical(unsigned).encode()).hexdigest())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user