X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=tests%2Fregression.tc;h=863f8d80957a1fa9bb22298a63db6065c8a393e6;hp=33510182e1d2dcc8e10c45aafebbc3f63db2f897;hb=e84029a8b861075d6d0ed5040f919b2e4da4c98f;hpb=a8478f5ddfbfbc8d910d09f27163cbd55752d3b6 diff --git a/tests/regression.tc b/tests/regression.tc index 3351018..863f8d8 100644 --- a/tests/regression.tc +++ b/tests/regression.tc @@ -1,24 +1,3 @@ -//testcase { -// input "x"; -// output "a:{x}"; -// -// s = a1:: a -// a = s1:: s -// a = ^"x" -//} -// -//testcase { -// input "x"; -// output "x"; -// output "s2:{s2:{s0 s0} x}"; -// output "s2:{s0 x}"; -// -// -// s = s2:: s s -// s = ^"x" -// s = s0:: () -//} - testcase { input "aaaaa"; s = A @@ -26,15 +5,6 @@ testcase { | "a" A &~ "a" s } -//testcase { -// input "a"; -// output "yes:{}"; -// s = A -// A = "a" s &~ "a" A -// | "a" A &~ "a" s -// | () -//} - testcase { input "ab c"; output "1:{{a b} {c}}"; @@ -91,7 +61,7 @@ testcase { x = ~[] s = xbx:: x* b x* b = abab:: [ab][ab] - &~ ( "aa" | "bb" ) + &~ ("aa"|"bb") } testcase { @@ -217,23 +187,6 @@ testcase { idl = [a-d] } -//testcase { -// input "a*b*c"; -// output "times:{stringify:{{a}} times:{stringify:{{b}} stringify:{{c}}}}"; -// w = " " -// l = id -// s = l "=" r => "assign" -// | r -// r = l -// | l "=" r => "assign" -// | r "+" r => "plus" -// | (r) "*" r => "times" -// | "(" r ")" -// | r r => "times" -// id = idl++ => "stringify" -// idl = [a-d] -//} - testcase { input "a+b*c"; output "plus:{stringify:{{a}} times:{stringify:{{b}} stringify:{{c}}}}"; @@ -319,8 +272,6 @@ keyword = "if" | "then" | "else" | "while" } - - testcase { input "abc "; @@ -390,46 +341,6 @@ testcase { x = [123] } - -//testcase { -// input "ab"; -// -// s = a:"a" b:"b" -//} - - -testcase { - input "a c"; - s = first:: A WSA B? WSB C - A = "a" - B = "b" - C = "c" - WSA = WSA:: " "** - WSB = () -> ~" " - | WSB:: " "++ -} - -//testcase { -// input "aaaaaXaaaa"; -// output ""; -// s = ManyA &~ EndsWithZ -// EndsWithZ = Anything "Z" -// ManyA = () | "a" ManyA -// Anything = () | ("a" | "X" | "Z") Anything -//} - -testcase { - input "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - output ""; - s = ManyA - ManyA = () - | A ManyA! & ManyAB - A = "a" - ManyAB = () - | "a" ManyAB - | "b" ManyAB -} - testcase { input "aaaaaaaa"; output ""; @@ -438,4 +349,24 @@ testcase { AAs = () | AAs "aa" } +// make sure follow restrictions are honored +// when a string matches the empty string +testcase { + input "xxx"; + s = x:: "x" A "x" C "x" + A = B + B = "y" + | () -> ~"x" + C = D -> ~"x" + D = () +} +testcase { + input "axxxxxc"; + output "q:{a {x x x x x} c}"; + s = q:: A ws B? ws C + ws = [x]** + A = a:: "a" + B = b:: "b" + C = c:: "c" +}