Implement AXIS parity UI and execution baseline
This commit is contained in:
36
scripts/test_full_simulation_s4_report.py
Normal file
36
scripts/test_full_simulation_s4_report.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import hashlib
|
||||
import json
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
import generate_full_simulation_s4_report
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
class FullSimulationS4ReportTests(unittest.TestCase):
|
||||
def test_contract(self):
|
||||
report = json.loads((ROOT / "coverage/full-simulation-s4.report.json").read_text(encoding="utf-8"))
|
||||
self.assertEqual(report["schema"], "full-simulation-s4-report.v1")
|
||||
self.assertEqual(report["task_id"], "S4-01")
|
||||
self.assertEqual(report["status"], "verified")
|
||||
self.assertEqual(report["domain_report_count"], 30)
|
||||
self.assertTrue(report["parity"]["one_x_fast_equal"])
|
||||
|
||||
def test_self_hash(self):
|
||||
report = json.loads((ROOT / "coverage/full-simulation-s4.report.json").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(json.dumps(unsigned, ensure_ascii=False, sort_keys=True, separators=(",", ":")).encode()).hexdigest())
|
||||
|
||||
def test_deterministic(self):
|
||||
first = ROOT / "coverage/.full-simulation-s4-one.json"
|
||||
second = ROOT / "coverage/.full-simulation-s4-two.json"
|
||||
try:
|
||||
self.assertEqual(generate_full_simulation_s4_report.generate(first), generate_full_simulation_s4_report.generate(second))
|
||||
finally:
|
||||
first.unlink(missing_ok=True)
|
||||
second.unlink(missing_ok=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user