Harden API wrapper error paths and water bindings

This commit is contained in:
Codex
2026-07-02 23:47:53 +08:00
parent b38b18d409
commit a750dc9e39
5 changed files with 124 additions and 37 deletions
+9 -1
View File
@@ -19,6 +19,8 @@ def main() -> int:
solver = SPHLite(args.library)
if PHASE_SOLID != 4 or STATUS_ACTIVE != 0:
raise AssertionError("Python constants are not locked")
if not hasattr(solver.lib, "sphlite_get_water_summary"):
raise AssertionError("Python wrapper is not using the C ABI library")
if solver.version() != (0, 2, 1):
raise AssertionError("Python version mismatch")
@@ -53,7 +55,13 @@ def main() -> int:
raise AssertionError("water inspect particle count mismatch")
if water_summary["water_mass"] <= 0.0:
raise AssertionError("water summary mass mismatch")
if water_summary["dt_cfl"] <= 0.0 or water_summary["dt_viscous"] <= 0.0:
if len(water_summary["water_momentum"]) != 3:
raise AssertionError("water summary momentum shape mismatch")
if (
water_summary["dt_cfl"] <= 0.0
or water_summary["dt_accel"] <= 0.0
or water_summary["dt_viscous"] <= 0.0
):
raise AssertionError("water dt limits mismatch")
water_state = water.particle_state()
if water_state["phase"][0] != PHASE_WATER: