From a3860a4cd6ca6a1ee664634ea472b5487535b2b5 Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Wed, 24 Oct 2012 10:34:15 +1100 Subject: Add a fix for mutually-recursive infinite things So now it will solve correctly for x = y + 1 y = max(0, x + 1) I also added in tests for this (and a slightly different form with `x` going through another variable, `z`, for indirection). The tests will also stop now after five seconds of execution. If they can't be solved in five seconds then they're considered a failure. --- impl/test/12.eqns | 2 ++ impl/test/12.soln | 2 ++ impl/test/13.eqns | 3 +++ impl/test/13.soln | 3 +++ impl/test/run | 5 ++++- 5 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 impl/test/12.eqns create mode 100644 impl/test/12.soln create mode 100644 impl/test/13.eqns create mode 100644 impl/test/13.soln (limited to 'impl/test') diff --git a/impl/test/12.eqns b/impl/test/12.eqns new file mode 100644 index 0000000..91be47b --- /dev/null +++ b/impl/test/12.eqns @@ -0,0 +1,2 @@ +x = y + 1 +y = max(0, x + 1) diff --git a/impl/test/12.soln b/impl/test/12.soln new file mode 100644 index 0000000..cdfcb1f --- /dev/null +++ b/impl/test/12.soln @@ -0,0 +1,2 @@ +x = inf +y = inf diff --git a/impl/test/13.eqns b/impl/test/13.eqns new file mode 100644 index 0000000..ce399ef --- /dev/null +++ b/impl/test/13.eqns @@ -0,0 +1,3 @@ +x = y + 1 +y = max(0, z) +z = x diff --git a/impl/test/13.soln b/impl/test/13.soln new file mode 100644 index 0000000..ff37347 --- /dev/null +++ b/impl/test/13.soln @@ -0,0 +1,3 @@ +x = inf +y = inf +z = inf diff --git a/impl/test/run b/impl/test/run index 0c1886d..826bbde 100644 --- a/impl/test/run +++ b/impl/test/run @@ -7,7 +7,10 @@ FAILED=0 echo "Testing binary: $1 in directory $DIR" while [ -f "$DIR/$NUM.eqns" ] do - OUTPUT=$($1 "$DIR/$NUM.eqns") + OUTPUT=$(timeout 5s $1 "$DIR/$NUM.eqns") + if [ $? -eq 124 ]; then + OUTPUT="did not terminate" + fi DIFF=$(echo "$OUTPUT" | diff - "$DIR/$NUM.soln") if [ ! -z "$DIFF" ]; then echo "==================" -- cgit v1.2.3