testing3/re_test.sh
changeset 160 863feeb5c760
parent 153 4383809c176a
equal deleted inserted replaced
159:92c31cbb1952 160:863feeb5c760
   106   echo " simp(ONE ~ (ONE ~ (ONE ~ CHAR('a')))) == CHAR('a')" >> $out
   106   echo " simp(ONE ~ (ONE ~ (ONE ~ CHAR('a')))) == CHAR('a')" >> $out
   107   echo " simp(ONE ~ (ONE ~ (ONE ~ ZERO))) == ZERO" >> $out
   107   echo " simp(ONE ~ (ONE ~ (ONE ~ ZERO))) == ZERO" >> $out
   108   echo " simp(ALT(ONE ~ (ONE ~ (ONE ~ ZERO)), CHAR('a'))) == CHAR('a')" >> $out
   108   echo " simp(ALT(ONE ~ (ONE ~ (ONE ~ ZERO)), CHAR('a'))) == CHAR('a')" >> $out
   109   echo " simp(CHAR('a') | CHAR('a')) == CHAR('a')" >> $out
   109   echo " simp(CHAR('a') | CHAR('a')) == CHAR('a')" >> $out
   110   echo " simp(ONE | CHAR('a')) == (ONE | CHAR('a'))" >> $out
   110   echo " simp(ONE | CHAR('a')) == (ONE | CHAR('a'))" >> $out
   111   
   111   echo " simp(ALT((CHAR('a') | ZERO) ~ ONE," >> $out
       
   112   echo "          ((ONE | CHAR('b')) | CHAR('c')) ~ (CHAR('d') ~ ZERO))) == CHAR('a')" >> $out
   112   if (scala_assert "re.scala" "re1c_test.scala")
   113   if (scala_assert "re.scala" "re1c_test.scala")
   113   then
   114   then
   114     echo "  --> success" >> $out
   115     echo "  --> success" >> $out
   115   else
   116   else
   116     echo "  --> test failed" >> $out
   117     echo "  --> test failed" >> $out
   118 fi
   119 fi
   119 
   120 
   120 
   121 
   121 if [ $tsts1 -eq 0 ]
   122 if [ $tsts1 -eq 0 ]
   122 then
   123 then
   123   echo " let EVIL = (a*)* b" >> $out
   124   echo " val EVIL = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))" >> $out
   124   echo " ders(List.fill(5)('a'),EVIL) == SEQ(SEQ(STAR(CHAR('a')),STAR(STAR(CHAR('a')))),CHAR('b'))" >> $out
   125   echo " ders(List.fill(5)('a'),EVIL) == SEQ(SEQ(STAR(CHAR('a')),STAR(STAR(CHAR('a')))),CHAR('b'))" >> $out
   125   echo " ders(List('b'),EVIL) == ONE" >> $out
   126   echo " ders(List('b'),EVIL) == ONE" >> $out
   126   echo " ders(List('b','b'),EVIL) == ZERO" >> $out
   127   echo " ders(List('b','b'),EVIL) == ZERO" >> $out
   127   echo " matcher(EVIL, \"a\" * 5 ++ \"b\") == true" >> $out
   128   echo " matcher(EVIL, \"a\" * 5 ++ \"b\") == true" >> $out
   128   echo " matcher(EVIL, \"b\") == true" >> $out
   129   echo " matcher(EVIL, \"b\") == true" >> $out
   143 fi
   144 fi
   144 
   145 
   145 
   146 
   146 if [ $tsts1 -eq 0 ]
   147 if [ $tsts1 -eq 0 ]
   147 then
   148 then
   148   echo " let EVIL = (a*)* b" >> $out  
   149   echo " val EVIL = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))" >> $out  
   149   echo " size(der('a', der('a', EVIL))) == 28" >> $out
   150   echo " size(der('a', der('a', EVIL))) == 28" >> $out
   150   echo " size(der('a', der('a', der('a', EVIL)))) == 58" >> $out
   151   echo " size(der('a', der('a', der('a', EVIL)))) == 58" >> $out
   151   echo " size(ders(\"aaaaaa\".toList, EVIL)) == 8" >> $out
   152   echo " size(ders(\"aaaaaa\".toList, EVIL)) == 8" >> $out
   152   
   153   
   153   if (scala_assert "re.scala" "re1e_test.scala")
   154   if (scala_assert "re.scala" "re1e_test.scala")