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

@@ -19,9 +19,19 @@ class PosemathRuntimeTests(unittest.TestCase):
if not module.is_file():
self.skipTest("WASM build has not been generated")
text = module.read_text(encoding="utf-8")
for symbol in ("sim_posemath_normalize", "sim_posemath_dot", "sim_posemath_line_point"):
for symbol in ("sim_posemath_normalize", "sim_posemath_dot", "sim_posemath_line_point",
"sim_posemath_segment_validate", "sim_posemath_segment_point",
"sim_tp_init", "sim_tp_step", "sim_tp_state_hash"):
self.assertIn(symbol, text)
def test_report_records_inputs_outputs_and_determinism(self):
report = __import__("json").loads((ROOT / "coverage/posemath-runtime.report.json").read_text(encoding="utf-8"))
self.assertEqual(report["schema"], "posemath-runtime-report.v2")
self.assertGreater(report["inputs"]["file_count"], 0)
self.assertGreater(report["outputs"]["file_count"], 0)
self.assertTrue(report["determinism"]["byte_identical"])
self.assertTrue(report["determinism"]["state_hash_identical"])
def test_posemath_source_is_linked(self):
cmake = (ROOT / "wasm-core/CMakeLists.txt").read_text(encoding="utf-8")
self.assertIn("posemath.cc", cmake)