diff -r e3878cdd38bc -r 703c7e42bf46 marking4/re_test.sh --- a/marking4/re_test.sh Tue Feb 04 14:15:42 2020 +0000 +++ b/marking4/re_test.sh Wed Feb 05 12:24:27 2020 +0000 @@ -26,11 +26,11 @@ # functional tests function scala_assert { - (ulimit -t 30; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" 2> /dev/null 1> /dev/null) + (ulimit -t 40; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" 2> /dev/null 1> /dev/null) } function scala_assert_long { - (ulimit -t 60; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" 2> /dev/null 1> /dev/null) + (ulimit -t 80; JAVA_OPTS="-Xmx1g" scala -i "$1" -- "$2" 2> /dev/null 1> /dev/null) } # purity test @@ -104,19 +104,19 @@ echo -e " der('b', STAR(CHAR('a'))) == (ZERO ~ STAR(CHAR('a')))" | tee -a $out echo -e "" | tee -a $out echo -e " val r0 = \"a\" ~ \"b\" ~ \"c\"" | tee -a $out - echo -e " assert(der('a', r0) == (ONE ~ \"b\") ~ \"c\")" | tee -a $out - echo -e " assert(der('b', r0) == (ZERO ~ \"b\") ~ \"c\")" | tee -a $out - echo -e " assert(der('c', r0) == (ZERO ~ \"b\") ~ \"c\")" | tee -a $out + echo -e " der('a', r0) == (ONE ~ \"b\") ~ \"c\"" | tee -a $out + echo -e " der('b', r0) == (ZERO ~ \"b\") ~ \"c\"" | tee -a $out + echo -e " der('c', r0) == (ZERO ~ \"b\") ~ \"c\"" | tee -a $out echo -e "" | tee -a $out echo -e " val r1 = (ONE ~ \"b\") ~ \"c\"" | tee -a $out - echo -e " assert(der('a', r1) == ((ZERO ~ \"b\") | ZERO) ~ \"c\")" | tee -a $out - echo -e " assert(der('b', r1) == ((ZERO ~ \"b\") | ONE) ~ \"c\")" | tee -a $out - echo -e " assert(der('c', r1) == ((ZERO ~ \"b\") | ZERO) ~ \"c\")" | tee -a $out + echo -e " der('a', r1) == ((ZERO ~ \"b\") | ZERO) ~ \"c\"" | tee -a $out + echo -e " der('b', r1) == ((ZERO ~ \"b\") | ONE) ~ \"c\"" | tee -a $out + echo -e " der('c', r1) == ((ZERO ~ \"b\") | ZERO) ~ \"c\"" | tee -a $out echo -e "" | tee -a $out echo -e " val r2 = ((ZERO ~ \"b\") | ONE) ~ \"c\"" | tee -a $out - echo -e " assert(der('a', r2) == ((((ZERO ~ \"b\") | ZERO) ~ \"c\") | ZERO))" | tee -a $out - echo -e " assert(der('b', r2) == ((((ZERO ~ \"b\") | ZERO) ~ \"c\") | ZERO))" | tee -a $out - echo -e " assert(der('c', r2) == ((((ZERO ~ \"b\") | ZERO) ~ \"c\") | ONE))" | tee -a $out + echo -e " der('a', r2) == ((((ZERO ~ \"b\") | ZERO) ~ \"c\") | ZERO)" | tee -a $out + echo -e " der('b', r2) == ((((ZERO ~ \"b\") | ZERO) ~ \"c\") | ZERO)" | tee -a $out + echo -e " der('c', r2) == ((((ZERO ~ \"b\") | ZERO) ~ \"c\") | ONE)" | tee -a $out if (scala_assert "re.scala" "re_test2.scala") then @@ -146,7 +146,7 @@ echo -e " simp((ZERO | ((ZERO | ZERO) | (ZERO | ZERO))) ~ ((ONE | ZERO) | ONE ) ~ (CHAR('a'))) == ZERO" | tee -a $out echo -e " simp(ALT(ONE | ONE, ONE | ONE)) == ONE" | tee -a $out echo -e " simp(ALT(ZERO | CHAR('a'), CHAR('a') | ZERO)) == CHAR('a')" | tee -a $out - echo -e " simp(ALT(ONE | CHAR('a'), CHAR('a') | ONE)) == ALT(ONE | CHAR('a'), CHAR('a') | ONE)" tee -a $out + echo -e " simp(ALT(ONE | CHAR('a'), CHAR('a') | ONE)) == ALT(ONE | CHAR('a'), CHAR('a') | ONE)" | tee -a $out if (scala_assert "re.scala" "re_test3.scala") then @@ -226,13 +226,19 @@ echo -e " val EVIL = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))" | tee -a $out echo -e " matcher(EVIL, \"a\" * 1000000 ++ \"b\") == true" | tee -a $out echo -e " matcher(EVIL, \"a\" * 1000000) == false" | tee -a $out - + START=$(date +%s) - if (time scala_assert_long "re.scala" "re_test6.scala") + if (scala_assert_long "re.scala" "re_test6.scala") then + END=$(date +%s) + DIFF=$(( $END - $START )) + echo " It took $DIFF seconds" | tee -a $out echo -e " --> success" | tee -a $out marks=$(( marks + 1 )) else + END=$(date +%s) + DIFF=$(( $END - $START )) + echo " It took $DIFF seconds" | tee -a $out echo -e " --> ONE OF THE TESTS FAILED\n" | tee -a $out fi fi