from pathlib import Path import sys def main() -> int: if len(sys.argv) != 4: print("usage: test_python_debug.py ") return 2 repo_root = Path(sys.argv[1]).resolve() femlite_exe = Path(sys.argv[2]).resolve() build_dir = Path(sys.argv[3]).resolve() sys.path.insert(0, str(repo_root / "Python")) from femlite_debug import FemLiteRunner runner = FemLiteRunner(femlite_exe) summary = runner.inspect_model(repo_root / "examples" / "c3d4_one_element.inp") summary.check() fields = summary.fields() if int(fields["nodes"]) != 4: return 10 if int(fields["elements"]) != 1: return 11 if int(fields["dofs"]) != 12: return 12 solved = runner.solve_implicit_linear( repo_root / "tests" / "data" / "c3d4_implicit_pull.inp" ) solved.check() if solved.int_field("steps") != 1: return 20 if solved.float_field("residual") > 1.0e-8: return 21 marker = build_dir / "python_debug_checked.txt" marker.write_text("python debug interface ok\n", encoding="utf-8") return 0 if __name__ == "__main__": raise SystemExit(main())