Complete 3axis tutorial native and Web/WASM parity tools

This commit is contained in:
2026-08-24 14:01:30 +08:00
parent 938654b19d
commit 7e90142b63
147 changed files with 17639 additions and 557 deletions

View File

@@ -0,0 +1,33 @@
#!/usr/bin/env python3
from __future__ import annotations
import hashlib
import json
import unittest
from pathlib import Path
import sys
sys.path.insert(0, str(Path(__file__).resolve().parent))
from generate_panel_02_snapshot_projection import canonical, OUTPUT
ROOT = Path(__file__).resolve().parents[1]
class Panel02SnapshotProjectionTests(unittest.TestCase):
def test_contract(self) -> None:
report = json.loads((ROOT / OUTPUT).read_text(encoding="utf-8"))
self.assertEqual(report["schema"], "panel-02-snapshot-projection.v1")
self.assertEqual(report["status"], "verified")
self.assertEqual(report["projection_schema"], "axis-panel-snapshot.v1")
self.assertIn("gates", report["fields"])
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()