Prepare SPHLite 0.2.0 development baseline
This commit is contained in:
@@ -14,9 +14,12 @@ def main() -> int:
|
||||
root = Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0, str(root / "Python"))
|
||||
|
||||
from sphlite_debug import SPHLite
|
||||
from sphlite_debug import PHASE_SOLID, STATUS_ACTIVE, SPHLite, SPHLiteError
|
||||
|
||||
solver = SPHLite(args.library)
|
||||
if PHASE_SOLID != 4 or STATUS_ACTIVE != 0:
|
||||
raise AssertionError("Python constants are not locked")
|
||||
|
||||
solver.initialize()
|
||||
try:
|
||||
solver.read_inp(args.input)
|
||||
@@ -24,9 +27,29 @@ def main() -> int:
|
||||
count = solver.particle_count()
|
||||
if count != 4:
|
||||
raise AssertionError(f"expected 4 particles, got {count}")
|
||||
state = solver.particle_state()
|
||||
if state["phase"][0] != PHASE_SOLID:
|
||||
raise AssertionError("unexpected particle phase")
|
||||
solver.set_output_directory(root / "build-codex-unix")
|
||||
solver.write_output(0, 0.0)
|
||||
restart = root / "build-codex-unix" / "python_restart.tmp"
|
||||
solver.write_restart(restart)
|
||||
solver.read_restart(restart)
|
||||
solver.run_explicit()
|
||||
finally:
|
||||
solver.finalize()
|
||||
|
||||
missing = SPHLite(args.library)
|
||||
missing.initialize()
|
||||
try:
|
||||
try:
|
||||
missing.read_inp(root / "tests" / "data" / "does_not_exist.inp")
|
||||
except SPHLiteError:
|
||||
pass
|
||||
else:
|
||||
raise AssertionError("missing input did not raise")
|
||||
finally:
|
||||
missing.finalize()
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user