Implement WebAssembly runtime and kinematics coverage

This commit is contained in:
2026-08-21 06:04:48 +08:00
parent 5dd614c335
commit 554b72dae8
112 changed files with 47148 additions and 807 deletions

View File

@@ -0,0 +1,29 @@
import hashlib
import json
import tempfile
import unittest
from pathlib import Path
try:
import generate_posemath_report
except ModuleNotFoundError: # Supports both discovery and direct module execution.
from scripts import generate_posemath_report
class PosemathReportTests(unittest.TestCase):
def test_report_is_deterministic(self):
root = Path(__file__).resolve().parents[1]
with tempfile.TemporaryDirectory() as directory:
report_path = Path(directory) / "report.json"
first = generate_posemath_report.generate(root, report_path)
first_bytes = report_path.read_bytes()
second = generate_posemath_report.generate(root, report_path)
self.assertEqual(first, second)
self.assertEqual(first_bytes, report_path.read_bytes())
self.assertEqual(hashlib.sha256(first_bytes).hexdigest(), hashlib.sha256(report_path.read_bytes()).hexdigest())
self.assertGreater(first["inputs"]["file_count"], 0)
self.assertEqual(first["outputs"]["file_count"], len(generate_posemath_report.OUTPUTS))
if __name__ == "__main__":
unittest.main()