--- a/main_testing3/re_test.sh Thu Nov 03 11:30:09 2022 +0000
+++ b/main_testing3/re_test.sh Tue Nov 08 00:27:47 2022 +0000
@@ -53,7 +53,7 @@
if (scala_vars re.scala)
then
- echo -e " --> FAIL (make triple-sure your program conforms to the required format)" >> $out
+ echo -e " --> FAIL (make triple-sure your program conforms to the required format)" >> $out
tsts=$(( 1 ))
else
echo -e " --> passed" >> $out
@@ -89,6 +89,8 @@
echo -e " nullable(ONE ~ ONE) == true" >> $out
echo -e " nullable(ONE ~ CHAR('a')) == false" >> $out
echo -e " nullable(STAR(ZERO)) == true" >> $out
+ echo -e " nullable(ALTs(List(ONE, CHAR('a'), ZERO))) == true" >> $out
+ echo -e " nullable(SEQs(List(ONE, ALTs(List(ONE, CHAR('a'), ZERO)), STAR(ZERO)))) == true" >> $out
if (scala_assert "re.scala" "re_test1.scala")
then
@@ -99,12 +101,12 @@
fi
-
if [ $tsts -eq 0 ]
then
echo -e " der('a', ZERO | ONE) == (ZERO | ZERO)" >> $out
echo -e " der('a', (CHAR('a') | ONE) ~ CHAR('a')) ==" >> $out
echo -e " ALT((ONE | ZERO) ~ CHAR('a'), ONE)" >> $out
+ echo -e " der('a', (CHAR('a') | CHAR('a')) ~ CHAR('a')) == (ONE | ONE) ~ CHAR('a')" >> $out
echo -e " der('a', STAR(CHAR('a'))) == (ONE ~ STAR(CHAR('a')))" >> $out
echo -e " der('b', STAR(CHAR('a'))) == (ZERO ~ STAR(CHAR('a')))" >> $out
@@ -117,7 +119,6 @@
fi
-
if [ $tsts -eq 0 ]
then
echo -e " simp(ZERO | ONE) == ONE" >> $out
@@ -136,6 +137,8 @@
echo -e " simp(ALT(ONE | ONE, ONE | ONE)) == ONE" >> $out
echo -e " simp(ALT(ZERO | CHAR('a'), CHAR('a') | ZERO)) == CHAR('a')" >> $out
echo -e " simp(ALT(ONE | CHAR('a'), CHAR('a') | ONE)) == ALT(ONE, CHAR('a'))" >> $out
+ echo -e " simp(ALTs(Nil)) == ZERO" >> $out
+ echo -e " simp(SEQs(CHAR('a'))) == CHAR('a')" >> $out
if (scala_assert "re.scala" "re_test3.scala")
then
echo -e " --> success" >> $out
@@ -147,6 +150,55 @@
if [ $tsts -eq 0 ]
then
+ echo -e " denest(List(ONE, ZERO, ALTs(List(ONE, CHAR('a'))))) == List(ONE, ONE, CHAR('a'))" >> $out
+ echo -e " denest(List(ONE ~ ONE, ZERO, ZERO | ONE)) == List(ONE ~ ONE, ZERO, ONE)" >> $out
+
+ if (scala_assert "re.scala" "re_test4.scala")
+ then
+ echo -e " --> success" >> $out
+ else
+ echo -e " --> \n ONE TEST FAILED\n" >> $out
+ fi
+fi
+
+
+if [ $tsts -eq 0 ]
+then
+ echo -e " flts(List(CHAR('a'), ZERO, ONE), Nil) == List(ZERO)" >> $out
+ echo -e " flts(List(CHAR('a'), ONE, ONE, CHAR('b')), Nil) == List(CHAR('a'), CHAR('b'))" >> $out
+ echo -e " flts(List(ONE ~ CHAR('a'), CHAR('b') ~ ONE), Nil) == List(ONE, CHAR('a'), CHAR('b'), ONE)" >> $out
+
+ if (scala_assert "re.scala" "re_test5.scala")
+ then
+ echo -e " --> success" >> $out
+ else
+ echo -e " --> \n ONE TEST FAILED\n" >> $out
+ fi
+fi
+
+
+if [ $tsts -eq 0 ]
+then
+ echo -e " SEQs_smart(Nil) == ONE" >> $out
+ echo -e " SEQs_smart(List(ZERO)) == ZERO" >> $out
+ echo -e " SEQs_smart(List(CHAR('a'))) == CHAR('a')" >> $out
+ echo -e " SEQs_smart(List(ONE ~ ONE)) == ONE ~ ONE" >> $out
+ echo -e " SEQs_smart(List(ONE, ONE)) == SEQs(List(ONE, ONE))" >> $out
+ echo -e " ALTs_smart(Nil) == ZERO" >> $out
+ echo -e " ALTs_smart(List(ONE ~ ONE)) == ONE ~ ONE)" >> $out
+ echo -e " ALTs_smart(List(ZERO, ZERO)) == ALTs(List(ZERO, ZERO))" >> $out
+
+ if (scala_assert "re.scala" "re_test6.scala")
+ then
+ echo -e " --> success" >> $out
+ else
+ echo -e " --> \n ONE TEST FAILED\n" >> $out
+ fi
+fi
+
+
+if [ $tsts -eq 0 ]
+then
echo -e " val EVIL = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))" >> $out
echo -e " ders(\"aaaaa\".toList, EVIL) == SEQ(SEQ(STAR(CHAR('a')),STAR(STAR(CHAR('a')))),CHAR('b'))" >> $out
echo -e " ders(List('b'), EVIL) == ONE" >> $out
@@ -161,7 +213,7 @@
echo -e " matcher(ONE | CHAR('a'), \"\") == true" >> $out
echo -e " matcher(ONE | CHAR('a'), \"a\") == true" >> $out
- if (scala_assert "re.scala" "re_test4.scala")
+ if (scala_assert "re.scala" "re_test7.scala")
then
echo -e " --> success" >> $out
else
@@ -173,11 +225,12 @@
if [ $tsts -eq 0 ]
then
echo -e " val EVIL = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))" >> $out
- echo -e " size(der('a', der('a', EVIL))) == 28" >> $out
- echo -e " size(der('a', der('a', der('a', EVIL)))) == 58" >> $out
- echo -e " size(ders(\"aaaaaa\".toList, EVIL)) == 8" >> $out
+ echo -e " size(der('a', der('a', EVIL))) == 36" >> $out
+ echo -e " size(der('a', der('a', der('a', EVIL)))) == 83" >> $out
+ echo -e " size(ders(\"aaaaaa\".toList, EVIL)) == 7" >> $out
+ echo -e " size(ders((\"a\" * 50).toList, EVIL)) == 7" >> $out
- if (scala_assert "re.scala" "re_test5.scala")
+ if (scala_assert "re.scala" "re_test8.scala")
then
echo -e " --> success" >> $out
else