[jboss-svn-commits] JBL Code SVN: r19920 - labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri May 9 13:01:54 EDT 2008
Author: porcelli
Date: 2008-05-09 13:01:54 -0400 (Fri, 09 May 2008)
New Revision: 19920
Modified:
labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/TestNewDRL.java
labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/TestTreeNewDRL.java
labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/gUnitTest.testsuite
labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/gUnitTreeWalkerTest.testsuite
Log:
Added new testes for the compilation_unit.
Modified: labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/TestNewDRL.java
===================================================================
--- labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/TestNewDRL.java 2008-05-09 10:26:23 UTC (rev 19919)
+++ labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/TestNewDRL.java 2008-05-09 17:01:54 UTC (rev 19920)
@@ -10,8 +10,800 @@
String stdout;
String stderr;
- public void testNormal_lhs_block1() throws Exception {
+ public void testPackage_statement1() throws Exception {
+ // test input: "package foo"
+ Object retval = execParser("package_statement", "package foo", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(package (VT_PACKAGE_ID foo))";
+
+ assertEquals("testing rule "+"package_statement", expecting, actual);
+ }
+
+ public void testPackage_statement2() throws Exception {
+ // test input: "package foo.bar.baz;"
+ Object retval = execParser("package_statement", "package foo.bar.baz;", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(package (VT_PACKAGE_ID foo bar baz))";
+
+ assertEquals("testing rule "+"package_statement", expecting, actual);
+ }
+
+ public void testCompilation_unit3() throws Exception {
// test input: ""
+ Object retval = execParser("compilation_unit", "", false);
+ Object actual = examineParserExecResult(8, retval);
+ Object expecting = "VT_COMPILATION_UNIT";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit4() throws Exception {
+ // test input: "package foo; import com.foo.Bar; import com.foo.Baz;"
+ Object retval = execParser("compilation_unit", "package foo; import com.foo.Bar; import com.foo.Baz;", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID foo)) (import (VT_IMPORT_ID com foo Bar)) (import (VT_IMPORT_ID com foo Baz)))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit5() throws Exception {
+ // test input: "rule empty \n\nthen\n \nend"
+ Object retval = execParser("compilation_unit", "rule empty \n\nthen\n \nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule empty then\n \nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit6() throws Exception {
+ // test input: "#the purpose of this is to see what happens when we have some partially damaged syntax\n#as the IDE uses the parsers AST to work out completion suggestions.\npackage test\n\n\nrule simple_rule \n when\n foo3 : Bar(\n\n"
+ Object retval = execParser("compilation_unit", "#the purpose of this is to see what happens when we have some partially damaged syntax\n#as the IDE uses the parsers AST to work out completion suggestions.\npackage test\n\n\nrule simple_rule \n when\n foo3 : Bar(\n\n", false);
+ Object actual = examineParserExecResult(28, retval);
+ Object expecting = "FAIL";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit7() throws Exception {
+ // test input: "package test.templates\n\ntemplate Cheese\n\tString \tname\n\tInteger age\nend\n\ntemplate \"Wine\"\n\tString \t\tname\n\tString \t\tyear\n\tString[] \taccolades\nend\n\n\nrule \"a rule\"\n when\n\tCheese(name == \"Stilton\", age==2001)\n\tWine(name == \"Grange\", age == \"1978\", accolades contains \"world champion\")\n then\n \tbaz();\nend"
+ Object retval = execParser("compilation_unit", "package test.templates\n\ntemplate Cheese\n\tString \tname\n\tInteger age\nend\n\ntemplate \"Wine\"\n\tString \t\tname\n\tString \t\tyear\n\tString[] \taccolades\nend\n\n\nrule \"a rule\"\n when\n\tCheese(name == \"Stilton\", age==2001)\n\tWine(name == \"Grange\", age == \"1978\", accolades contains \"world champion\")\n then\n \tbaz();\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID test templates)) (template Cheese (VT_SLOT (VT_DATA_TYPE String) name) (VT_SLOT (VT_DATA_TYPE Integer) age)) (template \"Wine\" (VT_SLOT (VT_DATA_TYPE String) name) (VT_SLOT (VT_DATA_TYPE String) year) (VT_SLOT (VT_DATA_TYPE String [ ]) accolades)) (rule \"a rule\" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"Stilton\")) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (== 2001)))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Wine) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"Grange\")) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (== \"1978\")) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT accolades)) (contains \"world champion\"))))) then\n \tbaz();\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit8() throws Exception {
+ // test input: "package foo\n\nrule rule_one \n when\n \tFoo()\n then\n \t if (speed > speedLimit ? true : false;)\n pullEmOver();\nend"
+ Object retval = execParser("compilation_unit", "package foo\n\nrule rule_one \n when\n \tFoo()\n then\n \t if (speed > speedLimit ? true : false;)\n pullEmOver();\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID foo)) (rule rule_one when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo)))) then\n \t if (speed > speedLimit ? true : false;)\n pullEmOver();\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit9() throws Exception {
+ // test input: "package foo\n\nfunction String[] yourFunction(String args[]) {\n baz();\n}\n\nrule \"new rule\"\n\n\twhen\n\t\tSomething()\n\tthen\n\t\tyourFunction(new String[3] {\"a\",\"b\",\"c\"});\n\t\t\nend"
+ Object retval = execParser("compilation_unit", "package foo\n\nfunction String[] yourFunction(String args[]) {\n baz();\n}\n\nrule \"new rule\"\n\n\twhen\n\t\tSomething()\n\tthen\n\t\tyourFunction(new String[3] {\"a\",\"b\",\"c\"});\n\t\t\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID foo)) (function (VT_DATA_TYPE String [ ]) yourFunction (VT_PARAM_LIST (VT_DATA_TYPE String) args [ ]) {\n baz();\n}) (rule \"new rule\" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Something)))) then\n\t\tyourFunction(new String[3] {\"a\",\"b\",\"c\"});\n\t\t\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit10() throws Exception {
+ // test input: "\nrule almost_empty \n when\n then\nend"
+ Object retval = execParser("compilation_unit", "\nrule almost_empty \n when\n then\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule almost_empty when VT_AND_IMPLICIT then\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit11() throws Exception {
+ // test input: "rule \"quoted string name\"\n when\n then\nend"
+ Object retval = execParser("compilation_unit", "rule \"quoted string name\"\n when\n then\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule \"quoted string name\" when VT_AND_IMPLICIT then\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit12() throws Exception {
+ // test input: "\nrule rule1 \n no-loop false\n when\n \tnot Cheese(type == \"stilton\")\n then\n\tfunky();\nend"
+ Object retval = execParser("compilation_unit", "\nrule rule1 \n no-loop false\n when\n \tnot Cheese(type == \"stilton\")\n then\n\tfunky();\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule rule1 (VT_RULE_ATTRIBUTES (no-loop false)) when (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\")))))) then\n\tfunky();\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit13() throws Exception {
+ // test input: "\nrule rule1 \n auto-focus true\n when\n \tnot Cheese(type == \"stilton\")\n then\n\tfunky();\nend"
+ Object retval = execParser("compilation_unit", "\nrule rule1 \n auto-focus true\n when\n \tnot Cheese(type == \"stilton\")\n then\n\tfunky();\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule rule1 (VT_RULE_ATTRIBUTES (auto-focus true)) when (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\")))))) then\n\tfunky();\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit14() throws Exception {
+ // test input: "\nrule rule1 \n ruleflow-group \"a group\"\n when\n \tnot Cheese(type == \"stilton\")\n then\n\tfunky();\nend"
+ Object retval = execParser("compilation_unit", "\nrule rule1 \n ruleflow-group \"a group\"\n when\n \tnot Cheese(type == \"stilton\")\n then\n\tfunky();\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule rule1 (VT_RULE_ATTRIBUTES (ruleflow-group \"a group\")) when (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\")))))) then\n\tfunky();\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit15() throws Exception {
+ // test input: "\n\nrule myrule \n when\n then\n \tint i = 0;\n\ti = 1;\n\ti / 1;\n\ti == 1;\n\ti(i);\n\ti = 'i';\n\ti.i.i;\n\ti\\i;\n\ti<i;\n\ti>i;\n\ti=\"i\";\t\n\t++i;\n\ti++;\n\t--i;\n\ti--;\n\ti += i;\n\ti -= i;\n\ti *= i;\n\ti /= i;\n\tint i = 5;\n\tfor(int j; j<i; ++j) {\n\t System.out.println(j);\n\t}\t\n\tObject o = new String(\"Hello\");\n\tString s = (String) o;\t\n\t\nend"
+ Object retval = execParser("compilation_unit", "\n\nrule myrule \n when\n then\n \tint i = 0;\n\ti = 1;\n\ti / 1;\n\ti == 1;\n\ti(i);\n\ti = 'i';\n\ti.i.i;\n\ti\\i;\n\ti<i;\n\ti>i;\n\ti=\"i\";\t\n\t++i;\n\ti++;\n\t--i;\n\ti--;\n\ti += i;\n\ti -= i;\n\ti *= i;\n\ti /= i;\n\tint i = 5;\n\tfor(int j; j<i; ++j) {\n\t System.out.println(j);\n\t}\t\n\tObject o = new String(\"Hello\");\n\tString s = (String) o;\t\n\t\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule myrule when VT_AND_IMPLICIT then\n \tint i = 0;\n\ti = 1;\n\ti / 1;\n\ti == 1;\n\ti(i);\n\ti = 'i';\n\ti.i.i;\n\ti\\i;\n\ti<i;\n\ti>i;\n\ti=\"i\";\t\n\t++i;\n\ti++;\n\t--i;\n\ti--;\n\ti += i;\n\ti -= i;\n\ti *= i;\n\ti /= i;\n\tint i = 5;\n\tfor(int j; j<i; ++j) {\n\t System.out.println(j);\n\t}\t\n\tObject o = new String(\"Hello\");\n\tString s = (String) o;\t\n\t\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit16() throws Exception {
+ // test input: "#check that it can handle true/false literals, and \n#negative numbers\nrule simple_rule \n when\n\tFoo(bar == false)\n\tFoo(boo > -42)\n\tFoo(boo > -42.42)\n then\n\tcons();\nend"
+ Object retval = execParser("compilation_unit", "#check that it can handle true/false literals, and \n#negative numbers\nrule simple_rule \n when\n\tFoo(bar == false)\n\tFoo(boo > -42)\n\tFoo(boo > -42.42)\n then\n\tcons();\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT bar)) (== false)))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT boo)) (> -42)))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT boo)) (> -42.42))))) then\n\tcons();\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit17() throws Exception {
+ // test input: "package org.drools.test;\n \nimport org.drools.Cheese;\n \nrule \"simple rule\"\n when\n Cheese( )\n then\nend "
+ Object retval = execParser("compilation_unit", "package org.drools.test;\n \nimport org.drools.Cheese;\n \nrule \"simple rule\"\n when\n Cheese( )\n then\nend ", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools test)) (import (VT_IMPORT_ID org drools Cheese)) (rule \"simple rule\" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese)))) then\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit18() throws Exception {
+ // test input: "\nrule blah\n\n when \n\n\tCol1() from something.doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\n\tCol2()\n then\n\tpartay();\nend\t"
+ Object retval = execParser("compilation_unit", "\nrule blah\n\n when \n\n\tCol1() from something.doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\n\tCol2()\n then\n\tpartay();\nend\t", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule blah when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Col1))) (VT_FROM_SOURCE something (. doIt ( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Col2)))) then\n\tpartay();\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit19() throws Exception {
+ // test input: "\nrule blah\n\n when \n\n\tCol1() from doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\n\tCol2()\n then\n\tpartay();\nend\t"
+ Object retval = execParser("compilation_unit", "\nrule blah\n\n when \n\n\tCol1() from doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\n\tCol2()\n then\n\tpartay();\nend\t", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule blah when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Col1))) (VT_FROM_SOURCE doIt ( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] ))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Col2)))) then\n\tpartay();\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit20() throws Exception {
+ // test input: "\nrule blah\n\n when \n\n\tCol1() from something.doIt\n\tCol2()\n then\n\tpartay();\nend\t"
+ Object retval = execParser("compilation_unit", "\nrule blah\n\n when \n\n\tCol1() from something.doIt\n\tCol2()\n then\n\tpartay();\nend\t", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule blah when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Col1))) (VT_FROM_SOURCE something (. doIt))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Col2)))) then\n\tpartay();\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit21() throws Exception {
+ // test input: "\nrule blah\n\n when \n\n\tCol1() from something.doIt[\"key\"]\n\tCol2()\n then\n\tpartay();\nend\t"
+ Object retval = execParser("compilation_unit", "\nrule blah\n\n when \n\n\tCol1() from something.doIt[\"key\"]\n\tCol2()\n then\n\tpartay();\nend\t", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule blah when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Col1))) (VT_FROM_SOURCE something (. doIt [\"key\"]))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Col2)))) then\n\tpartay();\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit22() throws Exception {
+ // test input: "rule blah\n when \n\tCol1() from doIt1( foo,bar,42,\"hello\",{ a => \"b\"}, [a, \"b\", 42] )\n\t .doIt2(bar, [a, \"b\", 42]).field[\"key\"]\n\tCol2()\n then\n\tpartay();\nend\t"
+ Object retval = execParser("compilation_unit", "rule blah\n when \n\tCol1() from doIt1( foo,bar,42,\"hello\",{ a => \"b\"}, [a, \"b\", 42] )\n\t .doIt2(bar, [a, \"b\", 42]).field[\"key\"]\n\tCol2()\n then\n\tpartay();\nend\t", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule blah when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Col1))) (VT_FROM_SOURCE doIt1 ( foo,bar,42,\"hello\",{ a => \"b\"}, [a, \"b\", 42] ) (. doIt2 (bar, [a, \"b\", 42]) (. field [\"key\"])))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Col2)))) then\n\tpartay();\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit23() throws Exception {
+ // test input: "\nrule simple_rule \n when\n foo3 : Bar(a==3)\n foo4 : Bar(a4:a==4)\n Baz()\n then\n if ( a == b ) {\n assert( foo3 );\n } else {\n retract( foo4 );\n } \n System.out.println( a4 );\nend"
+ Object retval = execParser("compilation_unit", "\nrule simple_rule \n when\n foo3 : Bar(a==3)\n foo4 : Bar(a4:a==4)\n Baz()\n then\n if ( a == b ) {\n assert( foo3 );\n } else {\n retract( foo4 );\n } \n System.out.println( a4 );\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo3 (VT_FACT (VT_DATA_TYPE Bar) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 3))))) (VT_PATTERN (VT_FACT_BINDING foo4 (VT_FACT (VT_DATA_TYPE Bar) (VT_BIND_FIELD a4 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 4)))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Baz)))) then\n if ( a == b ) {\n assert( foo3 );\n } else {\n retract( foo4 );\n } \n System.out.println( a4 );\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit24() throws Exception {
+ // test input: "#this is for showing off all the new multi restriction stuff\n\n\n\n\nrule simple_rule \n when\n \tPerson(age > 30 && < 40)\n \tVehicle(type == \"sedan\" || == \"wagon\", age < 3)\n then\n\tconsequence();\nend"
+ Object retval = execParser("compilation_unit", "#this is for showing off all the new multi restriction stuff\n\n\n\n\nrule simple_rule \n when\n \tPerson(age > 30 && < 40)\n \tVehicle(type == \"sedan\" || == \"wagon\", age < 3)\n then\n\tconsequence();\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Vehicle) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (|| (== \"sedan\") (== \"wagon\"))) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 3))))) then\n\tconsequence();\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit25() throws Exception {
+ // test input: "package la\n\n\nrule simple_rule \n when\n \tBaz()\n then\n \t//woot\n \tfirst\n \t\n \t#\n \t\n \t/* lala\n \t\n \t*/\n \tsecond \nend"
+ Object retval = execParser("compilation_unit", "package la\n\n\nrule simple_rule \n when\n \tBaz()\n then\n \t//woot\n \tfirst\n \t\n \t#\n \t\n \t/* lala\n \t\n \t*/\n \tsecond \nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID la)) (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Baz)))) then\n \t//woot\n \tfirst\n \t\n \t//\n \t\n \t/* lala\n \t\n \t*/\n \tsecond \nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit26() throws Exception {
+ // test input: "\nrule simple_rule \n when\n foo3 : Bar(a==3) ; foo4 : Bar(a4:a==4) ; Baz()\n then\n if ( a == b ) {\n assert( foo3 );\n } else {\n retract( foo4 );\n } \n System.out.println( a4 );\nend"
+ Object retval = execParser("compilation_unit", "\nrule simple_rule \n when\n foo3 : Bar(a==3) ; foo4 : Bar(a4:a==4) ; Baz()\n then\n if ( a == b ) {\n assert( foo3 );\n } else {\n retract( foo4 );\n } \n System.out.println( a4 );\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo3 (VT_FACT (VT_DATA_TYPE Bar) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 3))))) (VT_PATTERN (VT_FACT_BINDING foo4 (VT_FACT (VT_DATA_TYPE Bar) (VT_BIND_FIELD a4 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 4)))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Baz)))) then\n if ( a == b ) {\n assert( foo3 );\n } else {\n retract( foo4 );\n } \n System.out.println( a4 );\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit27() throws Exception {
+ // test input: "\nrule simple_rule \n when\n \tnot Cheese(type == \"stilton\")\n then\n\tfunky();\nend"
+ Object retval = execParser("compilation_unit", "\nrule simple_rule \n when\n \tnot Cheese(type == \"stilton\")\n then\n\tfunky();\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\")))))) then\n\tfunky();\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit28() throws Exception {
+ // test input: "package HR1\n\nimport function abd.def.x\nimport function qed.wah.*\n\nrule simple_rule \n when \t\t \t\n \tnot ( Cheese(type == \"stilton\") )\n \texists ( Foo() )\n then\n\tfunky();\nend"
+ Object retval = execParser("compilation_unit", "package HR1\n\nimport function abd.def.x\nimport function qed.wah.*\n\nrule simple_rule \n when \t\t \t\n \tnot ( Cheese(type == \"stilton\") )\n \texists ( Foo() )\n then\n\tfunky();\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID HR1)) (VT_FUNCTION_IMPORT function (VT_IMPORT_ID abd def x)) (VT_FUNCTION_IMPORT function (VT_IMPORT_ID qed wah .*)) (rule simple_rule when (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\"))))) (exists (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo))))) then\n\tfunky();\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit29() throws Exception {
+ // test input: "package HR1\n\nrule simple_rule \n when \t\t \t\n \tnot ( Cheese(type == \"stilton\") )\n \texists ( Foo() )\n then\n\tfunky();\nend"
+ Object retval = execParser("compilation_unit", "package HR1\n\nrule simple_rule \n when \t\t \t\n \tnot ( Cheese(type == \"stilton\") )\n \texists ( Foo() )\n then\n\tfunky();\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID HR1)) (rule simple_rule when (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\"))))) (exists (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo))))) then\n\tfunky();\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit30() throws Exception {
+ // test input: "package HR2\n\nrule simple_rule \n when \t\t \t\n \ta : (not ( Cheese(type == \"stilton\") ))\n \texists ( Foo() )\n then\n\tfunky();\nend"
+ Object retval = execParser("compilation_unit", "package HR2\n\nrule simple_rule \n when \t\t \t\n \ta : (not ( Cheese(type == \"stilton\") ))\n \texists ( Foo() )\n then\n\tfunky();\nend", false);
+ Object actual = examineParserExecResult(28, retval);
+ Object expecting = "FAIL";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit31() throws Exception {
+ // test input: "\n\nquery \"simple_query\" \n foo3 : Bar(a==3)\n foo4 : Bar(a4:a==4)\n Baz()\n\t\nend"
+ Object retval = execParser("compilation_unit", "\n\nquery \"simple_query\" \n foo3 : Bar(a==3)\n foo4 : Bar(a4:a==4)\n Baz()\n\t\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (query \"simple_query\" (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo3 (VT_FACT (VT_DATA_TYPE Bar) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 3))))) (VT_PATTERN (VT_FACT_BINDING foo4 (VT_FACT (VT_DATA_TYPE Bar) (VT_BIND_FIELD a4 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 4)))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Baz))))))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit32() throws Exception {
+ // test input: "\npackage foo\n\nrule bar\n\twhen\n\t\tBaz()\n\tthen\n\t\tBoo()\nend\n\nquery \"simple_query\" \n foo3 : Bar(a==3)\n foo4 : Bar(a4:a==4)\n Baz()\n\t\nend\n\nrule bar2\n\twhen\n\t\tBaz()\n\tthen\n\t\tBoo()\nend\n\nquery \"simple_query2\" \n foo3 : Bar(a==3)\n foo4 : Bar(a4:a==4)\n Baz()\n\t\nend\n\t"
+ Object retval = execParser("compilation_unit", "\npackage foo\n\nrule bar\n\twhen\n\t\tBaz()\n\tthen\n\t\tBoo()\nend\n\nquery \"simple_query\" \n foo3 : Bar(a==3)\n foo4 : Bar(a4:a==4)\n Baz()\n\t\nend\n\nrule bar2\n\twhen\n\t\tBaz()\n\tthen\n\t\tBoo()\nend\n\nquery \"simple_query2\" \n foo3 : Bar(a==3)\n foo4 : Bar(a4:a==4)\n Baz()\n\t\nend\n\t", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID foo)) (rule bar when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Baz)))) then\n\t\tBoo()\nend) (query \"simple_query\" (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo3 (VT_FACT (VT_DATA_TYPE Bar) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 3))))) (VT_PATTERN (VT_FACT_BINDING foo4 (VT_FACT (VT_DATA_TYPE Bar) (VT_BIND_FIELD a4 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 4)))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Baz))))) (rule bar2 when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Baz)))) then\n\t\tBoo()\nend) (query \"simple_query2\" (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo3 (VT_FACT (VT_DATA_TYPE Bar) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 3))))) (VT_PATTERN (VT_FACT_BINDING foo4 (VT_FACT (VT_DATA_TYPE Bar) (VT_BIND_FIELD a4 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 4)))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Baz))))))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit33() throws Exception {
+ // test input: "package org.drools.test;\n\nimport org.drools.integrationtests.Cheese;\n\nrule \"Like Stilton\"\n when\n Cheese( t:type == \"stilton\" )\n then\n System.out.println(\"I like \" + t);\nend \n\nrule \"Like Cheddar\"\n when\n Cheese( t:type == \"cheddar\" )\n then\n System.out.println(\"I like \" + t );\nend "
+ Object retval = execParser("compilation_unit", "package org.drools.test;\n\nimport org.drools.integrationtests.Cheese;\n\nrule \"Like Stilton\"\n when\n Cheese( t:type == \"stilton\" )\n then\n System.out.println(\"I like \" + t);\nend \n\nrule \"Like Cheddar\"\n when\n Cheese( t:type == \"cheddar\" )\n then\n System.out.println(\"I like \" + t );\nend ", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools test)) (import (VT_IMPORT_ID org drools integrationtests Cheese)) (rule \"Like Stilton\" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_BIND_FIELD t (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\")))))) then\n System.out.println(\"I like \" + t);\nend) (rule \"Like Cheddar\" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_BIND_FIELD t (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"cheddar\")))))) then\n System.out.println(\"I like \" + t );\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit34() throws Exception {
+ // test input: "package org.drools.test;\n\nimport org.drools.Cheese;\n\nrule \"like cheddar\"\n when\n Cheese( $type:type )\n then\n System.out.println(\"I like \" + $type);\nend "
+ Object retval = execParser("compilation_unit", "package org.drools.test;\n\nimport org.drools.Cheese;\n\nrule \"like cheddar\"\n when\n Cheese( $type:type )\n then\n System.out.println(\"I like \" + $type);\nend ", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools test)) (import (VT_IMPORT_ID org drools Cheese)) (rule \"like cheddar\" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_BIND_FIELD $type (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type))))))) then\n System.out.println(\"I like \" + $type);\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit35() throws Exception {
+ // test input: "package org.drools.test;\n\nimport org.drools.Cheese;\nimport org.drools.Person;\n\nrule \"Who likes Stilton\"\n when\n Cheese($type : type == \"stilton\")\n $person : Person($name : name == \"bob\", likes == $type) \n then\n System.out.println( $name + \" likes \" + $type);\nend "
+ Object retval = execParser("compilation_unit", "package org.drools.test;\n\nimport org.drools.Cheese;\nimport org.drools.Person;\n\nrule \"Who likes Stilton\"\n when\n Cheese($type : type == \"stilton\")\n $person : Person($name : name == \"bob\", likes == $type) \n then\n System.out.println( $name + \" likes \" + $type);\nend ", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools test)) (import (VT_IMPORT_ID org drools Cheese)) (import (VT_IMPORT_ID org drools Person)) (rule \"Who likes Stilton\" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_BIND_FIELD $type (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\"))))) (VT_PATTERN (VT_FACT_BINDING $person (VT_FACT (VT_DATA_TYPE Person) (VT_BIND_FIELD $name (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"bob\"))) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT likes)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $type)))))))) then\n System.out.println( $name + \" likes \" + $type);\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit36() throws Exception {
+ // test input: "\nimport org.drools.Person\n\nrule simple_rule \n when\n\tPerson(name == \"mark\") or \n\t( Person(type == \"fan\") and Cheese(type == \"green\") )\n then\n\tSystem.out.println( \"Mark and Michael\" + bar );\nend"
+ Object retval = execParser("compilation_unit", "\nimport org.drools.Person\n\nrule simple_rule \n when\n\tPerson(name == \"mark\") or \n\t( Person(type == \"fan\") and Cheese(type == \"green\") )\n then\n\tSystem.out.println( \"Mark and Michael\" + bar );\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (import (VT_IMPORT_ID org drools Person)) (rule simple_rule when (VT_AND_IMPLICIT (or (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"mark\")))) (and (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"fan\")))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"green\"))))))) then\n\tSystem.out.println( \"Mark and Michael\" + bar );\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit37() throws Exception {
+ // test input: "\nimport org.drools.Person\n\nrule simple_rule \n when\n Person(name == \"mark\") && Cheese(type == \"stilton\")\n Person(name == \"mark\") || Cheese(type == \"stilton\")\n then\n\tSystem.out.println( \"Mark and Michael\" );\nend"
+ Object retval = execParser("compilation_unit", "\nimport org.drools.Person\n\nrule simple_rule \n when\n Person(name == \"mark\") && Cheese(type == \"stilton\")\n Person(name == \"mark\") || Cheese(type == \"stilton\")\n then\n\tSystem.out.println( \"Mark and Michael\" );\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (import (VT_IMPORT_ID org drools Person)) (rule simple_rule when (VT_AND_IMPLICIT (&& (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"mark\")))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\"))))) (|| (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"mark\")))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\")))))) then\n\tSystem.out.println( \"Mark and Michael\" );\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit38() throws Exception {
+ // test input: "\nimport org.drools.Person\n\nrule simple_rule \n when\n\tfoo : ( Person(name == \"mark\") or Person(type == \"fan\") ) \n\tCheese(type == \"green\")\n then\n\tSystem.out.println( \"Mark and Michael\" + bar );\nend"
+ Object retval = execParser("compilation_unit", "\nimport org.drools.Person\n\nrule simple_rule \n when\n\tfoo : ( Person(name == \"mark\") or Person(type == \"fan\") ) \n\tCheese(type == \"green\")\n then\n\tSystem.out.println( \"Mark and Michael\" + bar );\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (import (VT_IMPORT_ID org drools Person)) (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo (or (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"mark\"))) (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"fan\")))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"green\"))))) then\n\tSystem.out.println( \"Mark and Michael\" + bar );\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit39() throws Exception {
+ // test input: "\n\nrule simple_rule \n when\n\tfoo : ( Person(name == \"mark\") \n\t\tor \n\t\tPerson(type == \"fan\") )\n then\n\tSystem.out.println( \"Mark and Michael\" + bar );\nend"
+ Object retval = execParser("compilation_unit", "\n\nrule simple_rule \n when\n\tfoo : ( Person(name == \"mark\") \n\t\tor \n\t\tPerson(type == \"fan\") )\n then\n\tSystem.out.println( \"Mark and Michael\" + bar );\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo (or (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"mark\"))) (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"fan\"))))))) then\n\tSystem.out.println( \"Mark and Michael\" + bar );\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit40() throws Exception {
+ // test input: "rule simple_rule \n when\n\tfoo : ( \n\t\tPerson(name == \"mark\") or Person(type == \"fan\") \n\t\t)\n then\n\tSystem.out.println( \"Mark and Michael\" + bar );\nend"
+ Object retval = execParser("compilation_unit", "rule simple_rule \n when\n\tfoo : ( \n\t\tPerson(name == \"mark\") or Person(type == \"fan\") \n\t\t)\n then\n\tSystem.out.println( \"Mark and Michael\" + bar );\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo (or (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"mark\"))) (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"fan\"))))))) then\n\tSystem.out.println( \"Mark and Michael\" + bar );\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit41() throws Exception {
+ // test input: "\nrule simple_rule \n when\n\t ( (not Foo(x==\"a\") or Foo(x==\"y\") ) and ( Shoes() or Butt() ) )\n then\n\tgo wild\nend"
+ Object retval = execParser("compilation_unit", "\nrule simple_rule \n when\n\t ( (not Foo(x==\"a\") or Foo(x==\"y\") ) and ( Shoes() or Butt() ) )\n then\n\tgo wild\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (and (or (not (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT x)) (== \"a\"))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT x)) (== \"y\"))))) (or (VT_PATTERN (VT_FACT (VT_DATA_TYPE Shoes))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Butt)))))) then\n\tgo wild\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit42() throws Exception {
+ // test input: "\nrule simple_rule \n when\n\teval(abc(\"foo\") + 5)\n\tFoo()\n\teval(qed())\n\tBar()\n then\n\tKapow\n\tPoof\n\t\nend"
+ Object retval = execParser("compilation_unit", "\nrule simple_rule \n when\n\teval(abc(\"foo\") + 5)\n\tFoo()\n\teval(qed())\n\tBar()\n then\n\tKapow\n\tPoof\n\t\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (eval (abc(\"foo\") + 5)) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo))) (eval (qed())) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Bar)))) then\n\tKapow\n\tPoof\n\t\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit43() throws Exception {
+ // test input: "\nrule simple_rule \n when\n\tFoo()\n\tBar()\n\teval(abc(\"foo\"))\n then\n\tKapow\n\t\nend"
+ Object retval = execParser("compilation_unit", "\nrule simple_rule \n when\n\tFoo()\n\tBar()\n\teval(abc(\"foo\"))\n then\n\tKapow\n\t\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Bar))) (eval (abc(\"foo\")))) then\n\tKapow\n\t\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit44() throws Exception {
+ // test input: "\nrule simple_rule \n when\n\tFoo(name== (a + b))\n then\n\tKapow\n\t\nend"
+ Object retval = execParser("compilation_unit", "\nrule simple_rule \n when\n\tFoo(name== (a + b))\n then\n\tKapow\n\t\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== (a + b)))))) then\n\tKapow\n\t\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit45() throws Exception {
+ // test input: "\nrule simple_rule \n when\n \tPerson( $age2:age -> ($age2 == $age1+2 ) ) \n then\n\tfoo bar\nend"
+ Object retval = execParser("compilation_unit", "\nrule simple_rule \n when\n \tPerson( $age2:age -> ($age2 == $age1+2 ) ) \n then\n\tfoo bar\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_BIND_FIELD $age2 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (-> ($age2 == $age1+2 ))))))) then\n\tfoo bar\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit46() throws Exception {
+ // test input: "package org.drools.test;\n\nimport org.drools.Cheese;\n\nglobal java.util.List list;\nglobal java.lang.Integer five;\n\nrule \"not rule test\"\n when\n $person : Person( $likes:like )\n not Cheese( type == $likes )\n then\n\t\tlist.add( $person );\nend "
+ Object retval = execParser("compilation_unit", "package org.drools.test;\n\nimport org.drools.Cheese;\n\nglobal java.util.List list;\nglobal java.lang.Integer five;\n\nrule \"not rule test\"\n when\n $person : Person( $likes:like )\n not Cheese( type == $likes )\n then\n\t\tlist.add( $person );\nend ", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools test)) (import (VT_IMPORT_ID org drools Cheese)) (global (VT_DATA_TYPE java util List) list) (global (VT_DATA_TYPE java lang Integer) five) (rule \"not rule test\" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING $person (VT_FACT (VT_DATA_TYPE Person) (VT_BIND_FIELD $likes (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT like))))))) (not (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $likes)))))))) then\n\t\tlist.add( $person );\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit47() throws Exception {
+ // test input: "package org.drools.test;\n\nimport org.drools.Cheese;\n\nglobal java.lang.String foo\nglobal java.lang.Integer bar;\n\nrule baz\n when\n Cheese( )\n then\n\nend "
+ Object retval = execParser("compilation_unit", "package org.drools.test;\n\nimport org.drools.Cheese;\n\nglobal java.lang.String foo\nglobal java.lang.Integer bar;\n\nrule baz\n when\n Cheese( )\n then\n\nend ", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools test)) (import (VT_IMPORT_ID org drools Cheese)) (global (VT_DATA_TYPE java lang String) foo) (global (VT_DATA_TYPE java lang Integer) bar) (rule baz when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese)))) then\n\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit48() throws Exception {
+ // test input: "\nimport java.lang.String\n\nfunction String functionA(String s, Integer i) {\n\t\n\tfoo();\n\n}\n\nfunction void functionB() {\n\tbar();\t\n}\n\n\nrule something \n\twhen\n\tthen\nend\n\nrule \"one more thing\"\n\twhen\n\tthen\nend\n\n\n\n\t"
+ Object retval = execParser("compilation_unit", "\nimport java.lang.String\n\nfunction String functionA(String s, Integer i) {\n\t\n\tfoo();\n\n}\n\nfunction void functionB() {\n\tbar();\t\n}\n\n\nrule something \n\twhen\n\tthen\nend\n\nrule \"one more thing\"\n\twhen\n\tthen\nend\n\n\n\n\t", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (import (VT_IMPORT_ID java lang String)) (function (VT_DATA_TYPE String) functionA (VT_PARAM_LIST (VT_DATA_TYPE String) s (VT_DATA_TYPE Integer) i) {\n\t\n\tfoo();\n\n}) (function (VT_DATA_TYPE void) functionB VT_PARAM_LIST {\n\tbar();\t\n}) (rule something when VT_AND_IMPLICIT then\nend) (rule \"one more thing\" when VT_AND_IMPLICIT then\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit49() throws Exception {
+ // test input: "#this starts with a comment\npackage foo.bar\n\n//and another comment\n\n/*\nyet\n\t another\n \t\t\t\tstyle\n*/\n\nrule \"test\"\n when\n then\nend"
+ Object retval = execParser("compilation_unit", "#this starts with a comment\npackage foo.bar\n\n//and another comment\n\n/*\nyet\n\t another\n \t\t\t\tstyle\n*/\n\nrule \"test\"\n when\n then\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID foo bar)) (rule \"test\" when VT_AND_IMPLICIT then\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit50() throws Exception {
+ // test input: "\n\n\nrule simple_rule \n\t\t#attributes keywork (and colon) is totally optional\n\t\tsalience 42\n\t\tagenda-group \"my_group\"\n\t\tno-loop \n\t\tduration 42\n\t\tactivation-group \"my_activation_group\"\n\t\tlock-on-active true\n\twhen\n\t\tFoo()\n\tthen\n\t\tbar();\nend"
+ Object retval = execParser("compilation_unit", "\n\n\nrule simple_rule \n\t\t#attributes keywork (and colon) is totally optional\n\t\tsalience 42\n\t\tagenda-group \"my_group\"\n\t\tno-loop \n\t\tduration 42\n\t\tactivation-group \"my_activation_group\"\n\t\tlock-on-active true\n\twhen\n\t\tFoo()\n\tthen\n\t\tbar();\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule simple_rule (VT_RULE_ATTRIBUTES (salience 42) (agenda-group \"my_group\") no-loop (duration 42) (activation-group \"my_activation_group\") (lock-on-active true)) when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo)))) then\n\t\tbar();\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit51() throws Exception {
+ // test input: "\n\n\nrule simple_rule \n\tattributes: \n\t\tsalience 42, agenda-group \"my_group\", no-loop, lock-on-active, duration 42, activation-group \"my_activation_group\"\n\twhen\n\t\tFoo()\n\tthen\n\t\tbar();\nend"
+ Object retval = execParser("compilation_unit", "\n\n\nrule simple_rule \n\tattributes: \n\t\tsalience 42, agenda-group \"my_group\", no-loop, lock-on-active, duration 42, activation-group \"my_activation_group\"\n\twhen\n\t\tFoo()\n\tthen\n\t\tbar();\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule simple_rule (VT_RULE_ATTRIBUTES attributes (salience 42) (agenda-group \"my_group\") no-loop lock-on-active (duration 42) (activation-group \"my_activation_group\")) when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo)))) then\n\t\tbar();\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit52() throws Exception {
+ // test input: "\nrule simple_rule \n when\n \tFoo(bar == Foo.BAR)\n then\nend"
+ Object retval = execParser("compilation_unit", "\nrule simple_rule \n when\n \tFoo(bar == Foo.BAR)\n then\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT bar)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT Foo) (VT_ACCESSOR_ELEMENT BAR))))))) then\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit53() throws Exception {
+ // test input: "rule one\n when\n exists Foo()\n exits Bar()\n then\nend\n\nrule two \n when\n ford = ford = ford\n then\nend"
+ Object retval = execParser("compilation_unit", "rule one\n when\n exists Foo()\n exits Bar()\n then\nend\n\nrule two \n when\n ford = ford = ford\n then\nend", false);
+ Object actual = examineParserExecResult(28, retval);
+ Object expecting = "FAIL";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit54() throws Exception {
+ // test input: "\nrule \"another test\"\n when\n s : String()\n eval(s.equals(\"foo\") && s.startsWith(\"f\"))\n \n \n then\n list.add( s );\nend "
+ Object retval = execParser("compilation_unit", "\nrule \"another test\"\n when\n s : String()\n eval(s.equals(\"foo\") && s.startsWith(\"f\"))\n \n \n then\n list.add( s );\nend ", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule \"another test\" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING s (VT_FACT (VT_DATA_TYPE String)))) (eval (s.equals(\"foo\") && s.startsWith(\"f\")))) then\n list.add( s );\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit55() throws Exception {
+ // test input: "package nesting;\n\n\n\n\nrule \"test something\"\n\n\twhen\n\t\tp: Person( name soundslike \"Michael\" )\n\tthen\n\t\tp.name = \"goober\"\n\t\tSystem.out.println(p.name)\nend"
+ Object retval = execParser("compilation_unit", "package nesting;\n\n\n\n\nrule \"test something\"\n\n\twhen\n\t\tp: Person( name soundslike \"Michael\" )\n\tthen\n\t\tp.name = \"goober\"\n\t\tSystem.out.println(p.name)\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID nesting)) (rule \"test something\" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING p (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (soundslike \"Michael\")))))) then\n\t\tp.name = \"goober\"\n\t\tSystem.out.println(p.name)\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit56() throws Exception {
+ // test input: "package com.foo;\n\nagenda-group \"x\"\n\nimport goo.ber\nimport wee.waa\n\n\ndialect \"java\"\n\n\n\n\nrule bar\n when\n then\nend\n\nrule baz\n dialect \"mvel\"\n when\n then\nend"
+ Object retval = execParser("compilation_unit", "package com.foo;\n\nagenda-group \"x\"\n\nimport goo.ber\nimport wee.waa\n\n\ndialect \"java\"\n\n\n\n\nrule bar\n when\n then\nend\n\nrule baz\n dialect \"mvel\"\n when\n then\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID com foo)) (agenda-group \"x\") (import (VT_IMPORT_ID goo ber)) (import (VT_IMPORT_ID wee waa)) (dialect \"java\") (rule bar when VT_AND_IMPLICIT then\nend) (rule baz (VT_RULE_ATTRIBUTES (dialect \"mvel\")) when VT_AND_IMPLICIT then\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit57() throws Exception {
+ // test input: "\npackage com.foo;\n\nimport im.one\n\nimport im.two\n\nrule foo\n when\n then\nend\n\nfunction cheeseIt() {\n\n}\n\nimport im.three;\n\nrule bar\n when\n then\nend\n\nfunction uncheeseIt() {\n\n}\n\nimport im.four;"
+ Object retval = execParser("compilation_unit", "\npackage com.foo;\n\nimport im.one\n\nimport im.two\n\nrule foo\n when\n then\nend\n\nfunction cheeseIt() {\n\n}\n\nimport im.three;\n\nrule bar\n when\n then\nend\n\nfunction uncheeseIt() {\n\n}\n\nimport im.four;", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID com foo)) (import (VT_IMPORT_ID im one)) (import (VT_IMPORT_ID im two)) (rule foo when VT_AND_IMPLICIT then\nend) (function cheeseIt VT_PARAM_LIST {\n\n}) (import (VT_IMPORT_ID im three)) (rule bar when VT_AND_IMPLICIT then\nend) (function uncheeseIt VT_PARAM_LIST {\n\n}) (import (VT_IMPORT_ID im four)))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit58() throws Exception {
+ // test input: "\nrule \"1. Do Stuff!\"\n when\n then\nend\n\nrule \"2. Do More Stuff!\"\n when\n then\nend"
+ Object retval = execParser("compilation_unit", "\nrule \"1. Do Stuff!\"\n when\n then\nend\n\nrule \"2. Do More Stuff!\"\n when\n then\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule \"1. Do Stuff!\" when VT_AND_IMPLICIT then\nend) (rule \"2. Do More Stuff!\" when VT_AND_IMPLICIT then\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit59() throws Exception {
+ // test input: "\nrule simple_rule \n when\n\tFoo()\n\tBar()\n\teval(\n\t\n\t\n\t\n\t abc(\n\t \n\t \"foo\") + \n\t 5\n\t \n\t \n\t \n\t \n\t )\n then\n\tKapow\n\tPoof\n\t\nend"
+ Object retval = execParser("compilation_unit", "\nrule simple_rule \n when\n\tFoo()\n\tBar()\n\teval(\n\t\n\t\n\t\n\t abc(\n\t \n\t \"foo\") + \n\t 5\n\t \n\t \n\t \n\t \n\t )\n then\n\tKapow\n\tPoof\n\t\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Bar))) (eval (\n\t\n\t\n\t\n\t abc(\n\t \n\t \"foo\") + \n\t 5\n\t \n\t \n\t \n\t \n\t ))) then\n\tKapow\n\tPoof\n\t\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit60() throws Exception {
+ // test input: "\nrule simple_rule \n when\n\teval(abc();)\n then\n\tKapow\n\tPoof\nend"
+ Object retval = execParser("compilation_unit", "\nrule simple_rule \n when\n\teval(abc();)\n then\n\tKapow\n\tPoof\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (eval (abc();))) then\n\tKapow\n\tPoof\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit61() throws Exception {
+ // test input: "\n\n\nrule simple_rule \n when\n\tFoo(\n\t bar == baz, la==laz\n\t )\n then\n\tKapow\n\tPoof\nend\n\t"
+ Object retval = execParser("compilation_unit", "\n\n\nrule simple_rule \n when\n\tFoo(\n\t bar == baz, la==laz\n\t )\n then\n\tKapow\n\tPoof\nend\n\t", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT bar)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT baz)))) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT la)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT laz))))))) then\n\tKapow\n\tPoof\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit62() throws Exception {
+ // test input: "package org.drools.test;\n\nrule \"Who likes Stilton\"\n when\n com.cheeseco.Cheese($type : type == \"stilton\")\n then\n System.out.println( $name + \" likes \" + $type);\nend "
+ Object retval = execParser("compilation_unit", "package org.drools.test;\n\nrule \"Who likes Stilton\"\n when\n com.cheeseco.Cheese($type : type == \"stilton\")\n then\n System.out.println( $name + \" likes \" + $type);\nend ", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools test)) (rule \"Who likes Stilton\" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE com cheeseco Cheese) (VT_BIND_FIELD $type (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\")))))) then\n System.out.println( $name + \" likes \" + $type);\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit63() throws Exception {
+ // test input: "rule \"AccumulateParserTest\"\nwhen\n Integer() from accumulate( Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\nthen\nend"
+ Object retval = execParser("compilation_unit", "rule \"AccumulateParserTest\"\nwhen\n Integer() from accumulate( Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\nthen\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule \"AccumulateParserTest\" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Integer))) (accumulate (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21)))) (VT_ACCUMULATE_INIT_CLAUSE (init ( int x = 0; )) (action ( x++; )) (result ( new Integer(x) )))))) then\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit64() throws Exception {
+ // test input: "rule \"AccumulateParserTest\"\nwhen\n $counter:Integer() from accumulate( $person : Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\nthen\nend"
+ Object retval = execParser("compilation_unit", "rule \"AccumulateParserTest\"\nwhen\n $counter:Integer() from accumulate( $person : Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\nthen\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule \"AccumulateParserTest\" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $counter (VT_FACT (VT_DATA_TYPE Integer)))) (accumulate (VT_PATTERN (VT_FACT_BINDING $person (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21))))) (VT_ACCUMULATE_INIT_CLAUSE (init ( int x = 0; )) (action ( x++; )) (result ( new Integer(x) )))))) then\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit65() throws Exception {
+ // test input: "rule \"CollectParserTest\"\nwhen\n $personList : ArrayList() from collect( Person( age > 21 ) );\nthen\nend"
+ Object retval = execParser("compilation_unit", "rule \"CollectParserTest\"\nwhen\n $personList : ArrayList() from collect( Person( age > 21 ) );\nthen\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule \"CollectParserTest\" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $personList (VT_FACT (VT_DATA_TYPE ArrayList)))) (collect (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21))))))) then\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit66() throws Exception {
+ // test input: "rule \"test_Quotes\"\n when\n InitialFact()\n then\n String s = \"\\\"\\n\\t\\\\\";\nend "
+ Object retval = execParser("compilation_unit", "rule \"test_Quotes\"\n when\n InitialFact()\n then\n String s = \"\\\"\\n\\t\\\\\";\nend ", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule \"test_Quotes\" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE InitialFact)))) then\n String s = \"\\\"\\n\\t\\\\\";\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit67() throws Exception {
+ // test input: "rule \"test nested CEs\"\t\n\twhen\n\t not ( State( $state : state ) and\n\t not( Person( status == $state, $likes : likes ) and\n\t Cheese( type == $likes ) ) )\n\t Person( name == \"Bob\" )\n\t ( Cheese( price == 10 ) or Cheese( type == \"brie\" ) )\n\tthen \n\t\tresults.add(\"OK\");\t\t\nend"
+ Object retval = execParser("compilation_unit", "rule \"test nested CEs\"\t\n\twhen\n\t not ( State( $state : state ) and\n\t not( Person( status == $state, $likes : likes ) and\n\t Cheese( type == $likes ) ) )\n\t Person( name == \"Bob\" )\n\t ( Cheese( price == 10 ) or Cheese( type == \"brie\" ) )\n\tthen \n\t\tresults.add(\"OK\");\t\t\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule \"test nested CEs\" when (VT_AND_IMPLICIT (not (and (VT_PATTERN (VT_FACT (VT_DATA_TYPE State) (VT_BIND_FIELD $state (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT state)))))) (not (and (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT status)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $state)))) (VT_BIND_FIELD $likes (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT likes)))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $likes)))))))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"Bob\")))) (or (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT price)) (== 10)))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"brie\")))))) then \n!
\t\tresults.add(\"OK\");\t\t\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit68() throws Exception {
+ // test input: "rule \"ForallParserTest\"\nwhen\n forall( Person( age > 21, $likes : likes )\n Cheese( type == $likes ) );\nthen\nend"
+ Object retval = execParser("compilation_unit", "rule \"ForallParserTest\"\nwhen\n forall( Person( age > 21, $likes : likes )\n Cheese( type == $likes ) );\nthen\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule \"ForallParserTest\" when (VT_AND_IMPLICIT (forall (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21)) (VT_BIND_FIELD $likes (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT likes)))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $likes)))))))) then\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit69() throws Exception {
+ // test input: "#testing 'in' operator\n\nrule simple_rule \n when\n \tPerson(age > 30 && < 40)\n \tVehicle(type in ( \"sedan\", \"wagon\" ), age < 3)\n then\n\tconsequence();\nend"
+ Object retval = execParser("compilation_unit", "#testing 'in' operator\n\nrule simple_rule \n when\n \tPerson(age > 30 && < 40)\n \tVehicle(type in ( \"sedan\", \"wagon\" ), age < 3)\n then\n\tconsequence();\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Vehicle) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (in \"sedan\" \"wagon\")) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 3))))) then\n\tconsequence();\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit70() throws Exception {
+ // test input: "#testing not 'in' operator\n\nrule simple_rule \n when\n \tPerson(age > 30 && < 40)\n \tVehicle(type not in ( \"sedan\", \"wagon\" ), age < 3)\n then\n\tconsequence();\nend"
+ Object retval = execParser("compilation_unit", "#testing not 'in' operator\n\nrule simple_rule \n when\n \tPerson(age > 30 && < 40)\n \tVehicle(type not in ( \"sedan\", \"wagon\" ), age < 3)\n then\n\tconsequence();\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Vehicle) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (in not \"sedan\" \"wagon\")) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 3))))) then\n\tconsequence();\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit71() throws Exception {
+ // test input: "package org.drools;\n\nglobal java.util.List list;\n\nrule \"rule1\"\nwhen\n Pattern1();\n Pattern2() from x.y.z;\nthen\n System.out.println(\"Test\");\nend;\n\nquery \"query1\"\n\tPattern5();\n\tPattern6();\n\tPattern7();\nend;\n\nrule \"rule2\"\nwhen\n Pattern3();\n Pattern4() from collect( Pattern5() );\nthen\n System.out.println(\"Test\");\nend;\n\n\t"
+ Object retval = execParser("compilation_unit", "package org.drools;\n\nglobal java.util.List list;\n\nrule \"rule1\"\nwhen\n Pattern1();\n Pattern2() from x.y.z;\nthen\n System.out.println(\"Test\");\nend;\n\nquery \"query1\"\n\tPattern5();\n\tPattern6();\n\tPattern7();\nend;\n\nrule \"rule2\"\nwhen\n Pattern3();\n Pattern4() from collect( Pattern5() );\nthen\n System.out.println(\"Test\");\nend;\n\n\t", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools)) (global (VT_DATA_TYPE java util List) list) (rule \"rule1\" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Pattern1))) (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Pattern2))) (VT_FROM_SOURCE x (. y (. z))))) then\n System.out.println(\"Test\");\nend;) (query \"query1\" (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Pattern5))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Pattern6))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Pattern7))))) (rule \"rule2\" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Pattern3))) (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Pattern4))) (collect (VT_PATTERN (VT_FACT (VT_DATA_TYPE Pattern5)))))) then\n System.out.println(\"Test\");\nend;))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit72() throws Exception {
+ // test input: "package org.drools\n\nrule \"Test Parse\"\n\nwhen\n eval( 3==3 )\nthen\n System.out.println(\"OK\");\nend "
+ Object retval = execParser("compilation_unit", "package org.drools\n\nrule \"Test Parse\"\n\nwhen\n eval( 3==3 )\nthen\n System.out.println(\"OK\");\nend ", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools)) (rule \"Test Parse\" when (VT_AND_IMPLICIT (eval ( 3==3 ))) then\n System.out.println(\"OK\");\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit73() throws Exception {
+ // test input: "rule \"AccumulateReverseParserTest\"\nwhen\n Integer() from accumulate( Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n reverse( x--; ),\n result( new Integer(x) ) );\nthen\nend"
+ Object retval = execParser("compilation_unit", "rule \"AccumulateReverseParserTest\"\nwhen\n Integer() from accumulate( Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n reverse( x--; ),\n result( new Integer(x) ) );\nthen\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule \"AccumulateReverseParserTest\" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Integer))) (accumulate (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21)))) (VT_ACCUMULATE_INIT_CLAUSE (init ( int x = 0; )) (action ( x++; )) (reverse ( x--; )) (result ( new Integer(x) )))))) then\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit74() throws Exception {
+ // test input: "rule \"AccumulateReverseParserTest\"\nwhen\n Number() from accumulate( Person( $age : age > 21 ),\n average( $age ) );\nthen\nend"
+ Object retval = execParser("compilation_unit", "rule \"AccumulateReverseParserTest\"\nwhen\n Number() from accumulate( Person( $age : age > 21 ),\n average( $age ) );\nthen\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule \"AccumulateReverseParserTest\" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Number))) (accumulate (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_BIND_FIELD $age (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21))))) (VT_ACCUMULATE_ID_CLAUSE average ( $age ))))) then\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit75() throws Exception {
+ // test input: "rule \"CollectParserTest\"\nwhen\n #bellow statement makes no sense, but is useful to test parsing recursiveness\n $personList : ArrayList() from collect( $p : Person( age > 21 || age < 10 ) from collect( People() from $town.getPeople() ) );\nthen\nend\n\n\t"
+ Object retval = execParser("compilation_unit", "rule \"CollectParserTest\"\nwhen\n #bellow statement makes no sense, but is useful to test parsing recursiveness\n $personList : ArrayList() from collect( $p : Person( age > 21 || age < 10 ) from collect( People() from $town.getPeople() ) );\nthen\nend\n\n\t", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule \"CollectParserTest\" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $personList (VT_FACT (VT_DATA_TYPE ArrayList)))) (collect (from (VT_PATTERN (VT_FACT_BINDING $p (VT_FACT (VT_DATA_TYPE Person) (|| (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 10)))))) (collect (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE People))) (VT_FROM_SOURCE $town (. getPeople ())))))))) then\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit76() throws Exception {
+ // test input: "rule \"AccumulateParserTest\"\nwhen\n #bellow statement makes no sense, but is useful to test parsing recursiveness\n $personList : ArrayList() from accumulate( Person( $age : age > 21 || < 10 ) from collect( People() from $town.getPeople() ),\n max( $age ) );\nthen\nend\n\n\t"
+ Object retval = execParser("compilation_unit", "rule \"AccumulateParserTest\"\nwhen\n #bellow statement makes no sense, but is useful to test parsing recursiveness\n $personList : ArrayList() from accumulate( Person( $age : age > 21 || < 10 ) from collect( People() from $town.getPeople() ),\n max( $age ) );\nthen\nend\n\n\t", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule \"AccumulateParserTest\" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $personList (VT_FACT (VT_DATA_TYPE ArrayList)))) (accumulate (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_BIND_FIELD $age (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (|| (> 21) (< 10)))))) (collect (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE People))) (VT_FROM_SOURCE $town (. getPeople ()))))) (VT_ACCUMULATE_ID_CLAUSE max ( $age ))))) then\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit77() throws Exception {
+ // test input: "package org.drools;\n\nrule \"testing OR CE\"\nwhen\n $p : Person( name == \"bob\" )\n $c : Cheese( type == $p.likes ) || Cheese( price == 10 )\nthen\n // do something\nend "
+ Object retval = execParser("compilation_unit", "package org.drools;\n\nrule \"testing OR CE\"\nwhen\n $p : Person( name == \"bob\" )\n $c : Cheese( type == $p.likes ) || Cheese( price == 10 )\nthen\n // do something\nend ", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools)) (rule \"testing OR CE\" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING $p (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"bob\"))))) (|| (VT_PATTERN (VT_FACT_BINDING $c (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $p) (VT_ACCESSOR_ELEMENT likes))))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT price)) (== 10)))))) then\n // do something\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit78() throws Exception {
+ // test input: "rule \"another test\" salience 10 when eval( true ) then System.out.println(1); end"
+ Object retval = execParser("compilation_unit", "rule \"another test\" salience 10 when eval( true ) then System.out.println(1); end", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule \"another test\" (VT_RULE_ATTRIBUTES (salience 10)) when (VT_AND_IMPLICIT (eval ( true ))) then System.out.println(1); end))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit79() throws Exception {
+ // test input: "rule \"another test\" salience 10 when eval( true ) then System.out.println(1);\nend"
+ Object retval = execParser("compilation_unit", "rule \"another test\" salience 10 when eval( true ) then System.out.println(1);\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule \"another test\" (VT_RULE_ATTRIBUTES (salience 10)) when (VT_AND_IMPLICIT (eval ( true ))) then System.out.println(1);\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit80() throws Exception {
+ // test input: "rule \"AccumulateMultiPatternParserTest\"\nwhen\n $counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\nthen\nend"
+ Object retval = execParser("compilation_unit", "rule \"AccumulateMultiPatternParserTest\"\nwhen\n $counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\nthen\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (rule \"AccumulateMultiPatternParserTest\" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $counter (VT_FACT (VT_DATA_TYPE Integer)))) (accumulate (and (VT_PATTERN (VT_FACT_BINDING $person (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $person) (VT_ACCESSOR_ELEMENT likes))))))) (VT_ACCUMULATE_INIT_CLAUSE (init ( int x = 0; )) (action ( x++; )) (result ( new Integer(x) )))))) then\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit81() throws Exception {
+ // test input: "package org.drools;\n\nrule \"test rule\"\n\tsalience 10\n\twhen\n\t\t$c: WorkerPerformanceContext(eval)$c.getBalanceMonth() != null))\n\tthen\n\t\tretract($p);\nend\n\t"
+ Object retval = execParser("compilation_unit", "package org.drools;\n\nrule \"test rule\"\n\tsalience 10\n\twhen\n\t\t$c: WorkerPerformanceContext(eval)$c.getBalanceMonth() != null))\n\tthen\n\t\tretract($p);\nend\n\t", false);
+ Object actual = examineParserExecResult(28, retval);
+ Object expecting = "FAIL";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit82() throws Exception {
+ // test input: "package org.drools;\n\nrule \"Avoid NPE on wrong syntax\"\nwhen\n not( Cheese( ( type == \"stilton\", price == 10 ) || ( type == \"brie\", price == 15 ) ) from $cheeseList )\nthen\n System.out.println(\"OK\");\nend"
+ Object retval = execParser("compilation_unit", "package org.drools;\n\nrule \"Avoid NPE on wrong syntax\"\nwhen\n not( Cheese( ( type == \"stilton\", price == 10 ) || ( type == \"brie\", price == 15 ) ) from $cheeseList )\nthen\n System.out.println(\"OK\");\nend", false);
+ Object actual = examineParserExecResult(28, retval);
+ Object expecting = "FAIL";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit83() throws Exception {
+ // test input: "package org.drools;\n\nrule \"test pluggable operators\"\nwhen\n $a : EventA()\n $b : EventB( this after[1,10] $a )\n $c : EventC( this finishes $b )\n $d : EventD( this not starts $a )\n $e : EventE( this not before [1, 10] $b )\nthen\nend"
+ Object retval = execParser("compilation_unit", "package org.drools;\n\nrule \"test pluggable operators\"\nwhen\n $a : EventA()\n $b : EventB( this after[1,10] $a )\n $c : EventC( this finishes $b )\n $d : EventD( this not starts $a )\n $e : EventE( this not before [1, 10] $b )\nthen\nend", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools)) (rule \"test pluggable operators\" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING $a (VT_FACT (VT_DATA_TYPE EventA)))) (VT_PATTERN (VT_FACT_BINDING $b (VT_FACT (VT_DATA_TYPE EventB) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT this)) (after [1,10] (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $a))))))) (VT_PATTERN (VT_FACT_BINDING $c (VT_FACT (VT_DATA_TYPE EventC) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT this)) (finishes (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $b))))))) (VT_PATTERN (VT_FACT_BINDING $d (VT_FACT (VT_DATA_TYPE EventD) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT this)) (starts not (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $a))))))) (VT_PATTERN (VT_FACT_BINDING $e (VT_FACT (VT_DATA_TYPE EventE) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT this)) (before not [1, 10] (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $b)))))))) then\nend))";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testPattern_source84() throws Exception {
+ // test input: "StockTick( symbol==\"ACME\") from entry-point StreamA"
+ Object retval = execParser("pattern_source", "StockTick( symbol==\"ACME\") from entry-point StreamA", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(from (VT_PATTERN (VT_FACT (VT_DATA_TYPE StockTick) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT symbol)) (== \"ACME\")))) (entry-point StreamA))";
+
+ assertEquals("testing rule "+"pattern_source", expecting, actual);
+ }
+
+ public void testParen_chunk85() throws Exception {
+ // test input: "( foo )"
+ Object retval = execParser("paren_chunk", "( foo )", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "( foo )";
+
+ assertEquals("testing rule "+"paren_chunk", expecting, actual);
+ }
+
+ public void testParen_chunk86() throws Exception {
+ // test input: "(fnord())"
+ Object retval = execParser("paren_chunk", "(fnord())", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(fnord())";
+
+ assertEquals("testing rule "+"paren_chunk", expecting, actual);
+ }
+
+ public void testParen_chunk87() throws Exception {
+ // test input: "( fnord( \"cheese\" ) )"
+ Object retval = execParser("paren_chunk", "( fnord( \"cheese\" ) )", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "( fnord( \"cheese\" ) )";
+
+ assertEquals("testing rule "+"paren_chunk", expecting, actual);
+ }
+
+ public void testParen_chunk88() throws Exception {
+ // test input: "( %*9dkj)"
+ Object retval = execParser("paren_chunk", "( %*9dkj)", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "( %*9dkj)";
+
+ assertEquals("testing rule "+"paren_chunk", expecting, actual);
+ }
+
+ public void testNormal_lhs_block89() throws Exception {
+ // test input: ""
Object retval = execParser("normal_lhs_block", "", false);
Object actual = examineParserExecResult(8, retval);
Object expecting = "VT_AND_IMPLICIT";
@@ -19,7 +811,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block2() throws Exception {
+ public void testNormal_lhs_block90() throws Exception {
// test input: " $id : Something( duration == \"foo\") "
Object retval = execParser("normal_lhs_block", " $id : Something( duration == \"foo\") ", false);
Object actual = examineParserExecResult(10, retval);
@@ -28,7 +820,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block3() throws Exception {
+ public void testNormal_lhs_block91() throws Exception {
// test input: "foo3 : Bar("
Object retval = execParser("normal_lhs_block", "foo3 : Bar(", false);
Object actual = examineParserExecResult(28, retval);
@@ -37,7 +829,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block4() throws Exception {
+ public void testNormal_lhs_block92() throws Exception {
// test input: "\n\tCheese(name == \"Stilton\", age==2001)\n\tWine(name == \"Grange\", age == \"1978\", accolades contains \"world champion\")\n\t"
Object retval = execParser("normal_lhs_block", "\n\tCheese(name == \"Stilton\", age==2001)\n\tWine(name == \"Grange\", age == \"1978\", accolades contains \"world champion\")\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -46,7 +838,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block5() throws Exception {
+ public void testNormal_lhs_block93() throws Exception {
// test input: "Foo()"
Object retval = execParser("normal_lhs_block", "Foo()", false);
Object actual = examineParserExecResult(10, retval);
@@ -55,7 +847,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block6() throws Exception {
+ public void testNormal_lhs_block94() throws Exception {
// test input: "not Cheese(type == \"stilton\")"
Object retval = execParser("normal_lhs_block", "not Cheese(type == \"stilton\")", false);
Object actual = examineParserExecResult(10, retval);
@@ -64,7 +856,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block7() throws Exception {
+ public void testNormal_lhs_block95() throws Exception {
// test input: "\n\tPerson(age < 42, location==\"atlanta\") \n\tor\n\tPerson(name==\"bob\")\n\t"
Object retval = execParser("normal_lhs_block", "\n\tPerson(age < 42, location==\"atlanta\") \n\tor\n\tPerson(name==\"bob\")\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -73,7 +865,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block8() throws Exception {
+ public void testNormal_lhs_block96() throws Exception {
// test input: "\n\tFoo(bar == false)\n\tFoo(boo > -42)\n\tFoo(boo > -42.42)\n\t"
Object retval = execParser("normal_lhs_block", "\n\tFoo(bar == false)\n\tFoo(boo > -42)\n\tFoo(boo > -42.42)\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -82,7 +874,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block9() throws Exception {
+ public void testNormal_lhs_block97() throws Exception {
// test input: "Cheese( )"
Object retval = execParser("normal_lhs_block", "Cheese( )", false);
Object actual = examineParserExecResult(10, retval);
@@ -91,7 +883,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block10() throws Exception {
+ public void testNormal_lhs_block98() throws Exception {
// test input: "\n\tCol1() from something.doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\n\tCol2()\n\t"
Object retval = execParser("normal_lhs_block", "\n\tCol1() from something.doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\n\tCol2()\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -100,7 +892,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block11() throws Exception {
+ public void testNormal_lhs_block99() throws Exception {
// test input: "\n\tCol1() from doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\n\tCol2()\n\t"
Object retval = execParser("normal_lhs_block", "\n\tCol1() from doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\n\tCol2()\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -109,7 +901,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block12() throws Exception {
+ public void testNormal_lhs_block100() throws Exception {
// test input: "\n\tCol1() from something.doIt\n\tCol2()\n\t"
Object retval = execParser("normal_lhs_block", "\n\tCol1() from something.doIt\n\tCol2()\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -118,7 +910,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block13() throws Exception {
+ public void testNormal_lhs_block101() throws Exception {
// test input: "\n\tCol1() from something.doIt[\"key\"]\n\tCol2()\n\t"
Object retval = execParser("normal_lhs_block", "\n\tCol1() from something.doIt[\"key\"]\n\tCol2()\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -127,7 +919,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block14() throws Exception {
+ public void testNormal_lhs_block102() throws Exception {
// test input: "\n\tCol1() from doIt1( foo,bar,42,\"hello\",{ a => \"b\"}, [a, \"b\", 42] )\n\t .doIt2(bar, [a, \"b\", 42]).field[\"key\"]\n\tCol2()\n\t"
Object retval = execParser("normal_lhs_block", "\n\tCol1() from doIt1( foo,bar,42,\"hello\",{ a => \"b\"}, [a, \"b\", 42] )\n\t .doIt2(bar, [a, \"b\", 42]).field[\"key\"]\n\tCol2()\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -136,7 +928,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block15() throws Exception {
+ public void testNormal_lhs_block103() throws Exception {
// test input: "\n\tfoo3 : Bar(a==3)\n foo4 : Bar(a4:a==4)\n Baz()\n\t"
Object retval = execParser("normal_lhs_block", "\n\tfoo3 : Bar(a==3)\n foo4 : Bar(a4:a==4)\n Baz()\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -145,7 +937,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block16() throws Exception {
+ public void testNormal_lhs_block104() throws Exception {
// test input: "\n\tPerson(age > 30 && < 40)\n \tVehicle(type == \"sedan\" || == \"wagon\", age < 3)\n\t"
Object retval = execParser("normal_lhs_block", "\n\tPerson(age > 30 && < 40)\n \tVehicle(type == \"sedan\" || == \"wagon\", age < 3)\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -154,7 +946,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block17() throws Exception {
+ public void testNormal_lhs_block105() throws Exception {
// test input: " foo3 : Bar(a==3) ; foo4 : Bar(a4:a==4) ; Baz()"
Object retval = execParser("normal_lhs_block", " foo3 : Bar(a==3) ; foo4 : Bar(a4:a==4) ; Baz()", false);
Object actual = examineParserExecResult(10, retval);
@@ -163,7 +955,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block18() throws Exception {
+ public void testNormal_lhs_block106() throws Exception {
// test input: "\n \tnot ( Cheese(type == \"stilton\") )\n \texists ( Foo() )\n \t"
Object retval = execParser("normal_lhs_block", "\n \tnot ( Cheese(type == \"stilton\") )\n \texists ( Foo() )\n \t", false);
Object actual = examineParserExecResult(10, retval);
@@ -172,7 +964,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block19() throws Exception {
+ public void testNormal_lhs_block107() throws Exception {
// test input: "\n \tnot ( Cheese(type == \"stilton\") )\n \texists ( Foo() )\n\t"
Object retval = execParser("normal_lhs_block", "\n \tnot ( Cheese(type == \"stilton\") )\n \texists ( Foo() )\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -181,7 +973,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block20() throws Exception {
+ public void testNormal_lhs_block108() throws Exception {
// test input: "\n \ta : (not ( Cheese(type == \"stilton\") ))\n \texists ( Foo() )\n\t"
Object retval = execParser("normal_lhs_block", "\n \ta : (not ( Cheese(type == \"stilton\") ))\n \texists ( Foo() )\n\t", false);
Object actual = examineParserExecResult(28, retval);
@@ -190,7 +982,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block21() throws Exception {
+ public void testNormal_lhs_block109() throws Exception {
// test input: " Cheese( t:type == \"cheddar\" ) "
Object retval = execParser("normal_lhs_block", " Cheese( t:type == \"cheddar\" ) ", false);
Object actual = examineParserExecResult(10, retval);
@@ -199,7 +991,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block22() throws Exception {
+ public void testNormal_lhs_block110() throws Exception {
// test input: "Cheese( $type:type )"
Object retval = execParser("normal_lhs_block", "Cheese( $type:type )", false);
Object actual = examineParserExecResult(10, retval);
@@ -208,7 +1000,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block23() throws Exception {
+ public void testNormal_lhs_block111() throws Exception {
// test input: "\n Cheese($type : type == \"stilton\")\n $person : Person($name : name == \"bob\", likes == $type) \n\t"
Object retval = execParser("normal_lhs_block", "\n Cheese($type : type == \"stilton\")\n $person : Person($name : name == \"bob\", likes == $type) \n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -217,7 +1009,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block24() throws Exception {
+ public void testNormal_lhs_block112() throws Exception {
// test input: "\n\tPerson(name == \"mark\") or \n\t( Person(type == \"fan\") and Cheese(type == \"green\") )\n\t"
Object retval = execParser("normal_lhs_block", "\n\tPerson(name == \"mark\") or \n\t( Person(type == \"fan\") and Cheese(type == \"green\") )\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -226,7 +1018,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block25() throws Exception {
+ public void testNormal_lhs_block113() throws Exception {
// test input: "\n\tPerson(name == \"mark\") && Cheese(type == \"stilton\")\n Person(name == \"mark\") || Cheese(type == \"stilton\")\n\t"
Object retval = execParser("normal_lhs_block", "\n\tPerson(name == \"mark\") && Cheese(type == \"stilton\")\n Person(name == \"mark\") || Cheese(type == \"stilton\")\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -235,7 +1027,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block26() throws Exception {
+ public void testNormal_lhs_block114() throws Exception {
// test input: "\n\tfoo : ( Person(name == \"mark\") or Person(type == \"fan\") ) \n\tCheese(type == \"green\")\n\t"
Object retval = execParser("normal_lhs_block", "\n\tfoo : ( Person(name == \"mark\") or Person(type == \"fan\") ) \n\tCheese(type == \"green\")\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -244,7 +1036,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block27() throws Exception {
+ public void testNormal_lhs_block115() throws Exception {
// test input: "\n\tfoo : ( Person(name == \"mark\") \n\t\tor \n\t\tPerson(type == \"fan\") )\n\t"
Object retval = execParser("normal_lhs_block", "\n\tfoo : ( Person(name == \"mark\") \n\t\tor \n\t\tPerson(type == \"fan\") )\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -253,7 +1045,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block28() throws Exception {
+ public void testNormal_lhs_block116() throws Exception {
// test input: "\n\tfoo : ( \n\t\tPerson(name == \"mark\") or Person(type == \"fan\") \n\t\t)\n\t"
Object retval = execParser("normal_lhs_block", "\n\tfoo : ( \n\t\tPerson(name == \"mark\") or Person(type == \"fan\") \n\t\t)\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -262,7 +1054,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block29() throws Exception {
+ public void testNormal_lhs_block117() throws Exception {
// test input: "\n\t ( (not Foo(x==\"a\") or Foo(x==\"y\") ) and ( Shoes() or Butt() ) )\n\t"
Object retval = execParser("normal_lhs_block", "\n\t ( (not Foo(x==\"a\") or Foo(x==\"y\") ) and ( Shoes() or Butt() ) )\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -271,7 +1063,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block30() throws Exception {
+ public void testNormal_lhs_block118() throws Exception {
// test input: "\n\teval(abc(\"foo\") + 5)\n\tFoo()\n\teval(qed())\n\tBar()\n\t"
Object retval = execParser("normal_lhs_block", "\n\teval(abc(\"foo\") + 5)\n\tFoo()\n\teval(qed())\n\tBar()\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -280,7 +1072,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block31() throws Exception {
+ public void testNormal_lhs_block119() throws Exception {
// test input: "\n\tFoo()\n\tBar()\n\teval(abc(\"foo\"))\n\t"
Object retval = execParser("normal_lhs_block", "\n\tFoo()\n\tBar()\n\teval(abc(\"foo\"))\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -289,7 +1081,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block32() throws Exception {
+ public void testNormal_lhs_block120() throws Exception {
// test input: "Foo(name== (a + b))"
Object retval = execParser("normal_lhs_block", "Foo(name== (a + b))", false);
Object actual = examineParserExecResult(10, retval);
@@ -298,7 +1090,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block33() throws Exception {
+ public void testNormal_lhs_block121() throws Exception {
// test input: "Person( $age2:age -> ($age2 == $age1+2 ) )"
Object retval = execParser("normal_lhs_block", "Person( $age2:age -> ($age2 == $age1+2 ) )", false);
Object actual = examineParserExecResult(10, retval);
@@ -307,7 +1099,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block34() throws Exception {
+ public void testNormal_lhs_block122() throws Exception {
// test input: "Foo(bar == Foo.BAR)"
Object retval = execParser("normal_lhs_block", "Foo(bar == Foo.BAR)", false);
Object actual = examineParserExecResult(10, retval);
@@ -316,7 +1108,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block35() throws Exception {
+ public void testNormal_lhs_block123() throws Exception {
// test input: "\n\tp: Person( name soundslike \"Michael\" )\n\t"
Object retval = execParser("normal_lhs_block", "\n\tp: Person( name soundslike \"Michael\" )\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -325,7 +1117,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block36() throws Exception {
+ public void testNormal_lhs_block124() throws Exception {
// test input: "\n\tFoo()\n\tBar()\n\teval(\n\t\n\t\n\t\n\t abc(\n\t \n\t \"foo\") + \n\t 5\n\t \n\t \n\t \n\t \n\t )\n\t"
Object retval = execParser("normal_lhs_block", "\n\tFoo()\n\tBar()\n\teval(\n\t\n\t\n\t\n\t abc(\n\t \n\t \"foo\") + \n\t 5\n\t \n\t \n\t \n\t \n\t )\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -334,7 +1126,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block37() throws Exception {
+ public void testNormal_lhs_block125() throws Exception {
// test input: "eval(abc();)"
Object retval = execParser("normal_lhs_block", "eval(abc();)", false);
Object actual = examineParserExecResult(10, retval);
@@ -343,7 +1135,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block38() throws Exception {
+ public void testNormal_lhs_block126() throws Exception {
// test input: "\n\tFoo(\n\t bar == baz, la==laz\n\t )\n\t "
Object retval = execParser("normal_lhs_block", "\n\tFoo(\n\t bar == baz, la==laz\n\t )\n\t ", false);
Object actual = examineParserExecResult(10, retval);
@@ -352,7 +1144,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block39() throws Exception {
+ public void testNormal_lhs_block127() throws Exception {
// test input: "com.cheeseco.Cheese($type : type == \"stilton\")"
Object retval = execParser("normal_lhs_block", "com.cheeseco.Cheese($type : type == \"stilton\")", false);
Object actual = examineParserExecResult(10, retval);
@@ -361,7 +1153,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block40() throws Exception {
+ public void testNormal_lhs_block128() throws Exception {
// test input: "\n\t Integer() from accumulate( Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\n\t"
Object retval = execParser("normal_lhs_block", "\n\t Integer() from accumulate( Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -370,7 +1162,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block41() throws Exception {
+ public void testNormal_lhs_block129() throws Exception {
// test input: "\n $counter:Integer() from accumulate( $person : Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\n\t"
Object retval = execParser("normal_lhs_block", "\n $counter:Integer() from accumulate( $person : Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -379,7 +1171,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block42() throws Exception {
+ public void testNormal_lhs_block130() throws Exception {
// test input: "$personList : ArrayList() from collect( Person( age > 21 ) );"
Object retval = execParser("normal_lhs_block", "$personList : ArrayList() from collect( Person( age > 21 ) );", false);
Object actual = examineParserExecResult(10, retval);
@@ -388,7 +1180,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block43() throws Exception {
+ public void testNormal_lhs_block131() throws Exception {
// test input: "\n\t\tnot ( State( $state : state ) and\n\t not( Person( status == $state, $likes : likes ) and\n\t Cheese( type == $likes ) ) )\n\t Person( name == \"Bob\" )\n\t ( Cheese( price == 10 ) or Cheese( type == \"brie\" ) )\n\t"
Object retval = execParser("normal_lhs_block", "\n\t\tnot ( State( $state : state ) and\n\t not( Person( status == $state, $likes : likes ) and\n\t Cheese( type == $likes ) ) )\n\t Person( name == \"Bob\" )\n\t ( Cheese( price == 10 ) or Cheese( type == \"brie\" ) )\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -397,7 +1189,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block44() throws Exception {
+ public void testNormal_lhs_block132() throws Exception {
// test input: "\n forall( Person( age > 21, $likes : likes )\n Cheese( type == $likes ) );\n\t"
Object retval = execParser("normal_lhs_block", "\n forall( Person( age > 21, $likes : likes )\n Cheese( type == $likes ) );\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -406,7 +1198,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block45() throws Exception {
+ public void testNormal_lhs_block133() throws Exception {
// test input: "\n Country( $cities : city )\n Person( city memberOf $cities )\n "
Object retval = execParser("normal_lhs_block", "\n Country( $cities : city )\n Person( city memberOf $cities )\n ", false);
Object actual = examineParserExecResult(10, retval);
@@ -415,7 +1207,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block46() throws Exception {
+ public void testNormal_lhs_block134() throws Exception {
// test input: "\n Country( $cities : city )\n Person( city not memberOf $cities )\n "
Object retval = execParser("normal_lhs_block", "\n Country( $cities : city )\n Person( city not memberOf $cities )\n ", false);
Object actual = examineParserExecResult(10, retval);
@@ -424,7 +1216,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block47() throws Exception {
+ public void testNormal_lhs_block135() throws Exception {
// test input: "\n \tPerson(age > 30 && < 40)\n \tVehicle(type in ( \"sedan\", \"wagon\" ), age < 3)\n\t"
Object retval = execParser("normal_lhs_block", "\n \tPerson(age > 30 && < 40)\n \tVehicle(type in ( \"sedan\", \"wagon\" ), age < 3)\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -433,7 +1225,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block48() throws Exception {
+ public void testNormal_lhs_block136() throws Exception {
// test input: "\n \tPerson(age > 30 && < 40)\n \tVehicle(type not in ( \"sedan\", \"wagon\" ), age < 3)\n\t"
Object retval = execParser("normal_lhs_block", "\n \tPerson(age > 30 && < 40)\n \tVehicle(type not in ( \"sedan\", \"wagon\" ), age < 3)\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -442,7 +1234,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block49() throws Exception {
+ public void testNormal_lhs_block137() throws Exception {
// test input: " Person( age < 42 && location==\"atlanta\") "
Object retval = execParser("normal_lhs_block", " Person( age < 42 && location==\"atlanta\") ", false);
Object actual = examineParserExecResult(10, retval);
@@ -451,7 +1243,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block50() throws Exception {
+ public void testNormal_lhs_block138() throws Exception {
// test input: " Person( age < 42 || location==\"atlanta\") "
Object retval = execParser("normal_lhs_block", " Person( age < 42 || location==\"atlanta\") ", false);
Object actual = examineParserExecResult(10, retval);
@@ -460,7 +1252,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block51() throws Exception {
+ public void testNormal_lhs_block139() throws Exception {
// test input: "Person( age < 42 && location==\"atlanta\" || age > 20 && location==\"Seatle\" || location == \"Chicago\")"
Object retval = execParser("normal_lhs_block", "Person( age < 42 && location==\"atlanta\" || age > 20 && location==\"Seatle\" || location == \"Chicago\")", false);
Object actual = examineParserExecResult(10, retval);
@@ -469,7 +1261,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block52() throws Exception {
+ public void testNormal_lhs_block140() throws Exception {
// test input: "Person( age < 42 && ( location==\"atlanta\" || age > 20 && location==\"Seatle\") || location == \"Chicago\")"
Object retval = execParser("normal_lhs_block", "Person( age < 42 && ( location==\"atlanta\" || age > 20 && location==\"Seatle\") || location == \"Chicago\")", false);
Object actual = examineParserExecResult(10, retval);
@@ -478,7 +1270,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block53() throws Exception {
+ public void testNormal_lhs_block141() throws Exception {
// test input: " Person( ( age == 70 && hair == \"black\" ) || ( age == 40 && hair == \"pink\" ) || ( age == 12 && ( hair == \"yellow\" || hair == \"blue\" ) ) ) "
Object retval = execParser("normal_lhs_block", " Person( ( age == 70 && hair == \"black\" ) || ( age == 40 && hair == \"pink\" ) || ( age == 12 && ( hair == \"yellow\" || hair == \"blue\" ) ) ) ", false);
Object actual = examineParserExecResult(10, retval);
@@ -487,7 +1279,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block54() throws Exception {
+ public void testNormal_lhs_block142() throws Exception {
// test input: " Person( name matches \"mark\" || matches \"bob\" ) "
Object retval = execParser("normal_lhs_block", " Person( name matches \"mark\" || matches \"bob\" ) ", false);
Object actual = examineParserExecResult(10, retval);
@@ -496,7 +1288,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block55() throws Exception {
+ public void testNormal_lhs_block143() throws Exception {
// test input: "\n\tCity( $city : city )\n\tCountry( cities not contains $city )\n\t"
Object retval = execParser("normal_lhs_block", "\n\tCity( $city : city )\n\tCountry( cities not contains $city )\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -505,7 +1297,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block56() throws Exception {
+ public void testNormal_lhs_block144() throws Exception {
// test input: " Message( text not matches '[abc]*' ) "
Object retval = execParser("normal_lhs_block", " Message( text not matches '[abc]*' ) ", false);
Object actual = examineParserExecResult(10, retval);
@@ -514,7 +1306,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block57() throws Exception {
+ public void testNormal_lhs_block145() throws Exception {
// test input: "Foo( bar > 1 || == 1 )"
Object retval = execParser("normal_lhs_block", "Foo( bar > 1 || == 1 )", false);
Object actual = examineParserExecResult(10, retval);
@@ -523,7 +1315,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block58() throws Exception {
+ public void testNormal_lhs_block146() throws Exception {
// test input: "\n\tPattern1();\n\tPattern2() from x.y.z;\n\tPattern5();\n\tPattern6();\n\tPattern7();\n\tPattern3();\n\tPattern4() from collect( Pattern5() );\n\t"
Object retval = execParser("normal_lhs_block", "\n\tPattern1();\n\tPattern2() from x.y.z;\n\tPattern5();\n\tPattern6();\n\tPattern7();\n\tPattern3();\n\tPattern4() from collect( Pattern5() );\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -532,7 +1324,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block59() throws Exception {
+ public void testNormal_lhs_block147() throws Exception {
// test input: " eval( 3==3 ) "
Object retval = execParser("normal_lhs_block", " eval( 3==3 ) ", false);
Object actual = examineParserExecResult(10, retval);
@@ -541,7 +1333,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block60() throws Exception {
+ public void testNormal_lhs_block148() throws Exception {
// test input: "\n\tInteger() from accumulate( Person( age > 21 ),\n\t init( int x = 0; ),\n\t action( x++; ),\n\t reverse( x--; ),\n\t result( new Integer(x) ) );\n\t"
Object retval = execParser("normal_lhs_block", "\n\tInteger() from accumulate( Person( age > 21 ),\n\t init( int x = 0; ),\n\t action( x++; ),\n\t reverse( x--; ),\n\t result( new Integer(x) ) );\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -550,7 +1342,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block61() throws Exception {
+ public void testNormal_lhs_block149() throws Exception {
// test input: "\n Number() from accumulate( Person( $age : age > 21 ),\n average( $age ) );\n\t"
Object retval = execParser("normal_lhs_block", "\n Number() from accumulate( Person( $age : age > 21 ),\n average( $age ) );\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -559,7 +1351,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block62() throws Exception {
+ public void testNormal_lhs_block150() throws Exception {
// test input: "\n #bellow statement makes no sense, but is useful to test parsing recursiveness\n $personList : ArrayList() from collect( $p : Person( age > 21 || age < 10 ) from collect( People() from $town.getPeople() ) );\n\t"
Object retval = execParser("normal_lhs_block", "\n #bellow statement makes no sense, but is useful to test parsing recursiveness\n $personList : ArrayList() from collect( $p : Person( age > 21 || age < 10 ) from collect( People() from $town.getPeople() ) );\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -568,7 +1360,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block63() throws Exception {
+ public void testNormal_lhs_block151() throws Exception {
// test input: "\n $personList : ArrayList() from accumulate( Person( $age : age > 21 || < 10 ) from collect( People() from $town.getPeople() ),\n max( $age ) );\n\t"
Object retval = execParser("normal_lhs_block", "\n $personList : ArrayList() from accumulate( Person( $age : age > 21 || < 10 ) from collect( People() from $town.getPeople() ),\n max( $age ) );\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -577,7 +1369,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block64() throws Exception {
+ public void testNormal_lhs_block152() throws Exception {
// test input: "\n $p : Person( name == \"bob\" )\n $c : Cheese( type == $p.likes ) || Cheese( price == 10 )\n "
Object retval = execParser("normal_lhs_block", "\n $p : Person( name == \"bob\" )\n $c : Cheese( type == $p.likes ) || Cheese( price == 10 )\n ", false);
Object actual = examineParserExecResult(10, retval);
@@ -586,7 +1378,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block65() throws Exception {
+ public void testNormal_lhs_block153() throws Exception {
// test input: "\n\t(or\n\tnot Person()\n\t\t(and Cheese()\n\t\t\tMeat()\n\t\t\tWine()))\n\t"
Object retval = execParser("normal_lhs_block", "\n\t(or\n\tnot Person()\n\t\t(and Cheese()\n\t\t\tMeat()\n\t\t\tWine()))\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -595,7 +1387,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block66() throws Exception {
+ public void testNormal_lhs_block154() throws Exception {
// test input: "\n $counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\n\t"
Object retval = execParser("normal_lhs_block", "\n $counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -604,7 +1396,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block67() throws Exception {
+ public void testNormal_lhs_block155() throws Exception {
// test input: "\n $a : EventA()\n $b : EventB( this after[1,10] $a )\n $c : EventC( this finishes $b )\n $d : EventD( this not starts $a )\n $e : EventE( this not before [1, 10] $b )\n\t"
Object retval = execParser("normal_lhs_block", "\n $a : EventA()\n $b : EventB( this after[1,10] $a )\n $c : EventC( this finishes $b )\n $d : EventD( this not starts $a )\n $e : EventE( this not before [1, 10] $b )\n\t", false);
Object actual = examineParserExecResult(10, retval);
@@ -613,7 +1405,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block68() throws Exception {
+ public void testNormal_lhs_block156() throws Exception {
// test input: "StockTick( symbol==\"ACME\") from entry-point StreamA"
Object retval = execParser("normal_lhs_block", "StockTick( symbol==\"ACME\") from entry-point StreamA", false);
Object actual = examineParserExecResult(10, retval);
@@ -622,7 +1414,7 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testNormal_lhs_block69() throws Exception {
+ public void testNormal_lhs_block157() throws Exception {
// test input: "Person( ( age ( > 60 && < 70 ) || ( > 50 && < 55 ) && hair == \"black\" ) || ( age == 40 && hair == \"pink\" ) || ( age == 12 && ( hair == \"yellow\" || hair == \"blue\" ) ))"
Object retval = execParser("normal_lhs_block", "Person( ( age ( > 60 && < 70 ) || ( > 50 && < 55 ) && hair == \"black\" ) || ( age == 40 && hair == \"pink\" ) || ( age == 12 && ( hair == \"yellow\" || hair == \"blue\" ) ))", false);
Object actual = examineParserExecResult(10, retval);
@@ -631,7 +1423,16 @@
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
- public void testConstraints70() throws Exception {
+ public void testNormal_lhs_block158() throws Exception {
+ // test input: "org . drools/*comment*/\t .Message( text not matches $c#comment\n. property )\n"
+ Object retval = execParser("normal_lhs_block", "org . drools/*comment*/\t .Message( text not matches $c#comment\n. property )\n", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE org drools Message) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT text)) (matches not (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $c) (VT_ACCESSOR_ELEMENT property)))))))";
+
+ assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
+ }
+
+ public void testConstraints159() throws Exception {
// test input: "$var : attr -> ( $var.equals(\"xyz\") )"
Object retval = execParser("constraints", "$var : attr -> ( $var.equals(\"xyz\") )", false);
Object actual = examineParserExecResult(10, retval);
@@ -640,7 +1441,7 @@
assertEquals("testing rule "+"constraints", expecting, actual);
}
- public void testConstraints71() throws Exception {
+ public void testConstraints160() throws Exception {
// test input: "eval( $var.equals(\"xyz\") )"
Object retval = execParser("constraints", "eval( $var.equals(\"xyz\") )", false);
Object actual = examineParserExecResult(10, retval);
Modified: labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/TestTreeNewDRL.java
===================================================================
--- labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/TestTreeNewDRL.java 2008-05-09 10:26:23 UTC (rev 19919)
+++ labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/TestTreeNewDRL.java 2008-05-09 17:01:54 UTC (rev 19920)
@@ -10,8 +10,764 @@
String stdout;
String stderr;
- public void testLhs_block_walks_Normal_lhs_block1() throws Exception {
+ public void testPackage_statement_walks_Package_statement1() throws Exception {
+ // test input: "package foo"
+ Object retval = execTreeParser("package_statement", "package_statement", "package foo", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"package_statement", expecting, actual);
+ }
+
+ public void testPackage_statement_walks_Package_statement2() throws Exception {
+ // test input: "package foo.bar.baz;"
+ Object retval = execTreeParser("package_statement", "package_statement", "package foo.bar.baz;", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"package_statement", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit3() throws Exception {
// test input: ""
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit4() throws Exception {
+ // test input: "package foo; import com.foo.Bar; import com.foo.Baz;"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package foo; import com.foo.Bar; import com.foo.Baz;", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit5() throws Exception {
+ // test input: "rule empty \n\nthen\n \nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "rule empty \n\nthen\n \nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit6() throws Exception {
+ // test input: "#the purpose of this is to see what happens when we have some partially damaged syntax\n#as the IDE uses the parsers AST to work out completion suggestions.\npackage test\n\n\nrule simple_rule \n when\n foo3 : Bar(\n\n"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "#the purpose of this is to see what happens when we have some partially damaged syntax\n#as the IDE uses the parsers AST to work out completion suggestions.\npackage test\n\n\nrule simple_rule \n when\n foo3 : Bar(\n\n", false);
+ Object actual = examineParserExecResult(28, retval);
+ Object expecting = "FAIL";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit7() throws Exception {
+ // test input: "package test.templates\n\ntemplate Cheese\n\tString \tname\n\tInteger age\nend\n\ntemplate \"Wine\"\n\tString \t\tname\n\tString \t\tyear\n\tString[] \taccolades\nend\n\n\nrule \"a rule\"\n when\n\tCheese(name == \"Stilton\", age==2001)\n\tWine(name == \"Grange\", age == \"1978\", accolades contains \"world champion\")\n then\n \tbaz();\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package test.templates\n\ntemplate Cheese\n\tString \tname\n\tInteger age\nend\n\ntemplate \"Wine\"\n\tString \t\tname\n\tString \t\tyear\n\tString[] \taccolades\nend\n\n\nrule \"a rule\"\n when\n\tCheese(name == \"Stilton\", age==2001)\n\tWine(name == \"Grange\", age == \"1978\", accolades contains \"world champion\")\n then\n \tbaz();\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit8() throws Exception {
+ // test input: "package foo\n\nrule rule_one \n when\n \tFoo()\n then\n \t if (speed > speedLimit ? true : false;)\n pullEmOver();\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package foo\n\nrule rule_one \n when\n \tFoo()\n then\n \t if (speed > speedLimit ? true : false;)\n pullEmOver();\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit9() throws Exception {
+ // test input: "package foo\n\nfunction String[] yourFunction(String args[]) {\n baz();\n}\n\nrule \"new rule\"\n\n\twhen\n\t\tSomething()\n\tthen\n\t\tyourFunction(new String[3] {\"a\",\"b\",\"c\"});\n\t\t\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package foo\n\nfunction String[] yourFunction(String args[]) {\n baz();\n}\n\nrule \"new rule\"\n\n\twhen\n\t\tSomething()\n\tthen\n\t\tyourFunction(new String[3] {\"a\",\"b\",\"c\"});\n\t\t\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit10() throws Exception {
+ // test input: "\nrule almost_empty \n when\n then\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule almost_empty \n when\n then\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit11() throws Exception {
+ // test input: "rule \"quoted string name\"\n when\n then\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "rule \"quoted string name\"\n when\n then\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit12() throws Exception {
+ // test input: "\nrule rule1 \n no-loop false\n when\n \tnot Cheese(type == \"stilton\")\n then\n\tfunky();\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule rule1 \n no-loop false\n when\n \tnot Cheese(type == \"stilton\")\n then\n\tfunky();\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit13() throws Exception {
+ // test input: "\nrule rule1 \n auto-focus true\n when\n \tnot Cheese(type == \"stilton\")\n then\n\tfunky();\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule rule1 \n auto-focus true\n when\n \tnot Cheese(type == \"stilton\")\n then\n\tfunky();\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit14() throws Exception {
+ // test input: "\nrule rule1 \n ruleflow-group \"a group\"\n when\n \tnot Cheese(type == \"stilton\")\n then\n\tfunky();\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule rule1 \n ruleflow-group \"a group\"\n when\n \tnot Cheese(type == \"stilton\")\n then\n\tfunky();\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit15() throws Exception {
+ // test input: "\n\nrule myrule \n when\n then\n \tint i = 0;\n\ti = 1;\n\ti / 1;\n\ti == 1;\n\ti(i);\n\ti = 'i';\n\ti.i.i;\n\ti\\i;\n\ti<i;\n\ti>i;\n\ti=\"i\";\t\n\t++i;\n\ti++;\n\t--i;\n\ti--;\n\ti += i;\n\ti -= i;\n\ti *= i;\n\ti /= i;\n\tint i = 5;\n\tfor(int j; j<i; ++j) {\n\t System.out.println(j);\n\t}\t\n\tObject o = new String(\"Hello\");\n\tString s = (String) o;\t\n\t\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\n\nrule myrule \n when\n then\n \tint i = 0;\n\ti = 1;\n\ti / 1;\n\ti == 1;\n\ti(i);\n\ti = 'i';\n\ti.i.i;\n\ti\\i;\n\ti<i;\n\ti>i;\n\ti=\"i\";\t\n\t++i;\n\ti++;\n\t--i;\n\ti--;\n\ti += i;\n\ti -= i;\n\ti *= i;\n\ti /= i;\n\tint i = 5;\n\tfor(int j; j<i; ++j) {\n\t System.out.println(j);\n\t}\t\n\tObject o = new String(\"Hello\");\n\tString s = (String) o;\t\n\t\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit16() throws Exception {
+ // test input: "#check that it can handle true/false literals, and \n#negative numbers\nrule simple_rule \n when\n\tFoo(bar == false)\n\tFoo(boo > -42)\n\tFoo(boo > -42.42)\n then\n\tcons();\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "#check that it can handle true/false literals, and \n#negative numbers\nrule simple_rule \n when\n\tFoo(bar == false)\n\tFoo(boo > -42)\n\tFoo(boo > -42.42)\n then\n\tcons();\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit17() throws Exception {
+ // test input: "package org.drools.test;\n \nimport org.drools.Cheese;\n \nrule \"simple rule\"\n when\n Cheese( )\n then\nend "
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package org.drools.test;\n \nimport org.drools.Cheese;\n \nrule \"simple rule\"\n when\n Cheese( )\n then\nend ", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit18() throws Exception {
+ // test input: "\nrule blah\n\n when \n\n\tCol1() from something.doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\n\tCol2()\n then\n\tpartay();\nend\t"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule blah\n\n when \n\n\tCol1() from something.doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\n\tCol2()\n then\n\tpartay();\nend\t", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit19() throws Exception {
+ // test input: "\nrule blah\n\n when \n\n\tCol1() from doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\n\tCol2()\n then\n\tpartay();\nend\t"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule blah\n\n when \n\n\tCol1() from doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\n\tCol2()\n then\n\tpartay();\nend\t", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit20() throws Exception {
+ // test input: "\nrule blah\n\n when \n\n\tCol1() from something.doIt\n\tCol2()\n then\n\tpartay();\nend\t"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule blah\n\n when \n\n\tCol1() from something.doIt\n\tCol2()\n then\n\tpartay();\nend\t", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit21() throws Exception {
+ // test input: "\nrule blah\n\n when \n\n\tCol1() from something.doIt[\"key\"]\n\tCol2()\n then\n\tpartay();\nend\t"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule blah\n\n when \n\n\tCol1() from something.doIt[\"key\"]\n\tCol2()\n then\n\tpartay();\nend\t", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit22() throws Exception {
+ // test input: "rule blah\n when \n\tCol1() from doIt1( foo,bar,42,\"hello\",{ a => \"b\"}, [a, \"b\", 42] )\n\t .doIt2(bar, [a, \"b\", 42]).field[\"key\"]\n\tCol2()\n then\n\tpartay();\nend\t"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "rule blah\n when \n\tCol1() from doIt1( foo,bar,42,\"hello\",{ a => \"b\"}, [a, \"b\", 42] )\n\t .doIt2(bar, [a, \"b\", 42]).field[\"key\"]\n\tCol2()\n then\n\tpartay();\nend\t", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit23() throws Exception {
+ // test input: "\nrule simple_rule \n when\n foo3 : Bar(a==3)\n foo4 : Bar(a4:a==4)\n Baz()\n then\n if ( a == b ) {\n assert( foo3 );\n } else {\n retract( foo4 );\n } \n System.out.println( a4 );\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule simple_rule \n when\n foo3 : Bar(a==3)\n foo4 : Bar(a4:a==4)\n Baz()\n then\n if ( a == b ) {\n assert( foo3 );\n } else {\n retract( foo4 );\n } \n System.out.println( a4 );\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit24() throws Exception {
+ // test input: "#this is for showing off all the new multi restriction stuff\n\n\n\n\nrule simple_rule \n when\n \tPerson(age > 30 && < 40)\n \tVehicle(type == \"sedan\" || == \"wagon\", age < 3)\n then\n\tconsequence();\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "#this is for showing off all the new multi restriction stuff\n\n\n\n\nrule simple_rule \n when\n \tPerson(age > 30 && < 40)\n \tVehicle(type == \"sedan\" || == \"wagon\", age < 3)\n then\n\tconsequence();\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit25() throws Exception {
+ // test input: "package la\n\n\nrule simple_rule \n when\n \tBaz()\n then\n \t//woot\n \tfirst\n \t\n \t#\n \t\n \t/* lala\n \t\n \t*/\n \tsecond \nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package la\n\n\nrule simple_rule \n when\n \tBaz()\n then\n \t//woot\n \tfirst\n \t\n \t#\n \t\n \t/* lala\n \t\n \t*/\n \tsecond \nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit26() throws Exception {
+ // test input: "\nrule simple_rule \n when\n foo3 : Bar(a==3) ; foo4 : Bar(a4:a==4) ; Baz()\n then\n if ( a == b ) {\n assert( foo3 );\n } else {\n retract( foo4 );\n } \n System.out.println( a4 );\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule simple_rule \n when\n foo3 : Bar(a==3) ; foo4 : Bar(a4:a==4) ; Baz()\n then\n if ( a == b ) {\n assert( foo3 );\n } else {\n retract( foo4 );\n } \n System.out.println( a4 );\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit27() throws Exception {
+ // test input: "\nrule simple_rule \n when\n \tnot Cheese(type == \"stilton\")\n then\n\tfunky();\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule simple_rule \n when\n \tnot Cheese(type == \"stilton\")\n then\n\tfunky();\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit28() throws Exception {
+ // test input: "package HR1\n\nimport function abd.def.x\nimport function qed.wah.*\n\nrule simple_rule \n when \t\t \t\n \tnot ( Cheese(type == \"stilton\") )\n \texists ( Foo() )\n then\n\tfunky();\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package HR1\n\nimport function abd.def.x\nimport function qed.wah.*\n\nrule simple_rule \n when \t\t \t\n \tnot ( Cheese(type == \"stilton\") )\n \texists ( Foo() )\n then\n\tfunky();\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit29() throws Exception {
+ // test input: "package HR1\n\nrule simple_rule \n when \t\t \t\n \tnot ( Cheese(type == \"stilton\") )\n \texists ( Foo() )\n then\n\tfunky();\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package HR1\n\nrule simple_rule \n when \t\t \t\n \tnot ( Cheese(type == \"stilton\") )\n \texists ( Foo() )\n then\n\tfunky();\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit30() throws Exception {
+ // test input: "package HR2\n\nrule simple_rule \n when \t\t \t\n \ta : (not ( Cheese(type == \"stilton\") ))\n \texists ( Foo() )\n then\n\tfunky();\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package HR2\n\nrule simple_rule \n when \t\t \t\n \ta : (not ( Cheese(type == \"stilton\") ))\n \texists ( Foo() )\n then\n\tfunky();\nend", false);
+ Object actual = examineParserExecResult(28, retval);
+ Object expecting = "FAIL";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit31() throws Exception {
+ // test input: "\n\nquery \"simple_query\" \n foo3 : Bar(a==3)\n foo4 : Bar(a4:a==4)\n Baz()\n\t\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\n\nquery \"simple_query\" \n foo3 : Bar(a==3)\n foo4 : Bar(a4:a==4)\n Baz()\n\t\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit32() throws Exception {
+ // test input: "\npackage foo\n\nrule bar\n\twhen\n\t\tBaz()\n\tthen\n\t\tBoo()\nend\n\nquery \"simple_query\" \n foo3 : Bar(a==3)\n foo4 : Bar(a4:a==4)\n Baz()\n\t\nend\n\nrule bar2\n\twhen\n\t\tBaz()\n\tthen\n\t\tBoo()\nend\n\nquery \"simple_query2\" \n foo3 : Bar(a==3)\n foo4 : Bar(a4:a==4)\n Baz()\n\t\nend\n\t"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\npackage foo\n\nrule bar\n\twhen\n\t\tBaz()\n\tthen\n\t\tBoo()\nend\n\nquery \"simple_query\" \n foo3 : Bar(a==3)\n foo4 : Bar(a4:a==4)\n Baz()\n\t\nend\n\nrule bar2\n\twhen\n\t\tBaz()\n\tthen\n\t\tBoo()\nend\n\nquery \"simple_query2\" \n foo3 : Bar(a==3)\n foo4 : Bar(a4:a==4)\n Baz()\n\t\nend\n\t", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit33() throws Exception {
+ // test input: "package org.drools.test;\n\nimport org.drools.integrationtests.Cheese;\n\nrule \"Like Stilton\"\n when\n Cheese( t:type == \"stilton\" )\n then\n System.out.println(\"I like \" + t);\nend \n\nrule \"Like Cheddar\"\n when\n Cheese( t:type == \"cheddar\" )\n then\n System.out.println(\"I like \" + t );\nend "
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package org.drools.test;\n\nimport org.drools.integrationtests.Cheese;\n\nrule \"Like Stilton\"\n when\n Cheese( t:type == \"stilton\" )\n then\n System.out.println(\"I like \" + t);\nend \n\nrule \"Like Cheddar\"\n when\n Cheese( t:type == \"cheddar\" )\n then\n System.out.println(\"I like \" + t );\nend ", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit34() throws Exception {
+ // test input: "package org.drools.test;\n\nimport org.drools.Cheese;\n\nrule \"like cheddar\"\n when\n Cheese( $type:type )\n then\n System.out.println(\"I like \" + $type);\nend "
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package org.drools.test;\n\nimport org.drools.Cheese;\n\nrule \"like cheddar\"\n when\n Cheese( $type:type )\n then\n System.out.println(\"I like \" + $type);\nend ", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit35() throws Exception {
+ // test input: "package org.drools.test;\n\nimport org.drools.Cheese;\nimport org.drools.Person;\n\nrule \"Who likes Stilton\"\n when\n Cheese($type : type == \"stilton\")\n $person : Person($name : name == \"bob\", likes == $type) \n then\n System.out.println( $name + \" likes \" + $type);\nend "
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package org.drools.test;\n\nimport org.drools.Cheese;\nimport org.drools.Person;\n\nrule \"Who likes Stilton\"\n when\n Cheese($type : type == \"stilton\")\n $person : Person($name : name == \"bob\", likes == $type) \n then\n System.out.println( $name + \" likes \" + $type);\nend ", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit36() throws Exception {
+ // test input: "\nimport org.drools.Person\n\nrule simple_rule \n when\n\tPerson(name == \"mark\") or \n\t( Person(type == \"fan\") and Cheese(type == \"green\") )\n then\n\tSystem.out.println( \"Mark and Michael\" + bar );\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nimport org.drools.Person\n\nrule simple_rule \n when\n\tPerson(name == \"mark\") or \n\t( Person(type == \"fan\") and Cheese(type == \"green\") )\n then\n\tSystem.out.println( \"Mark and Michael\" + bar );\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit37() throws Exception {
+ // test input: "\nimport org.drools.Person\n\nrule simple_rule \n when\n Person(name == \"mark\") && Cheese(type == \"stilton\")\n Person(name == \"mark\") || Cheese(type == \"stilton\")\n then\n\tSystem.out.println( \"Mark and Michael\" );\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nimport org.drools.Person\n\nrule simple_rule \n when\n Person(name == \"mark\") && Cheese(type == \"stilton\")\n Person(name == \"mark\") || Cheese(type == \"stilton\")\n then\n\tSystem.out.println( \"Mark and Michael\" );\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit38() throws Exception {
+ // test input: "\nimport org.drools.Person\n\nrule simple_rule \n when\n\tfoo : ( Person(name == \"mark\") or Person(type == \"fan\") ) \n\tCheese(type == \"green\")\n then\n\tSystem.out.println( \"Mark and Michael\" + bar );\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nimport org.drools.Person\n\nrule simple_rule \n when\n\tfoo : ( Person(name == \"mark\") or Person(type == \"fan\") ) \n\tCheese(type == \"green\")\n then\n\tSystem.out.println( \"Mark and Michael\" + bar );\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit39() throws Exception {
+ // test input: "\n\nrule simple_rule \n when\n\tfoo : ( Person(name == \"mark\") \n\t\tor \n\t\tPerson(type == \"fan\") )\n then\n\tSystem.out.println( \"Mark and Michael\" + bar );\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\n\nrule simple_rule \n when\n\tfoo : ( Person(name == \"mark\") \n\t\tor \n\t\tPerson(type == \"fan\") )\n then\n\tSystem.out.println( \"Mark and Michael\" + bar );\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit40() throws Exception {
+ // test input: "rule simple_rule \n when\n\tfoo : ( \n\t\tPerson(name == \"mark\") or Person(type == \"fan\") \n\t\t)\n then\n\tSystem.out.println( \"Mark and Michael\" + bar );\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "rule simple_rule \n when\n\tfoo : ( \n\t\tPerson(name == \"mark\") or Person(type == \"fan\") \n\t\t)\n then\n\tSystem.out.println( \"Mark and Michael\" + bar );\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit41() throws Exception {
+ // test input: "\nrule simple_rule \n when\n\t ( (not Foo(x==\"a\") or Foo(x==\"y\") ) and ( Shoes() or Butt() ) )\n then\n\tgo wild\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule simple_rule \n when\n\t ( (not Foo(x==\"a\") or Foo(x==\"y\") ) and ( Shoes() or Butt() ) )\n then\n\tgo wild\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit42() throws Exception {
+ // test input: "\nrule simple_rule \n when\n\teval(abc(\"foo\") + 5)\n\tFoo()\n\teval(qed())\n\tBar()\n then\n\tKapow\n\tPoof\n\t\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule simple_rule \n when\n\teval(abc(\"foo\") + 5)\n\tFoo()\n\teval(qed())\n\tBar()\n then\n\tKapow\n\tPoof\n\t\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit43() throws Exception {
+ // test input: "\nrule simple_rule \n when\n\tFoo()\n\tBar()\n\teval(abc(\"foo\"))\n then\n\tKapow\n\t\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule simple_rule \n when\n\tFoo()\n\tBar()\n\teval(abc(\"foo\"))\n then\n\tKapow\n\t\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit44() throws Exception {
+ // test input: "\nrule simple_rule \n when\n\tFoo(name== (a + b))\n then\n\tKapow\n\t\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule simple_rule \n when\n\tFoo(name== (a + b))\n then\n\tKapow\n\t\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit45() throws Exception {
+ // test input: "\nrule simple_rule \n when\n \tPerson( $age2:age -> ($age2 == $age1+2 ) ) \n then\n\tfoo bar\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule simple_rule \n when\n \tPerson( $age2:age -> ($age2 == $age1+2 ) ) \n then\n\tfoo bar\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit46() throws Exception {
+ // test input: "package org.drools.test;\n\nimport org.drools.Cheese;\n\nglobal java.util.List list;\nglobal java.lang.Integer five;\n\nrule \"not rule test\"\n when\n $person : Person( $likes:like )\n not Cheese( type == $likes )\n then\n\t\tlist.add( $person );\nend "
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package org.drools.test;\n\nimport org.drools.Cheese;\n\nglobal java.util.List list;\nglobal java.lang.Integer five;\n\nrule \"not rule test\"\n when\n $person : Person( $likes:like )\n not Cheese( type == $likes )\n then\n\t\tlist.add( $person );\nend ", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit47() throws Exception {
+ // test input: "package org.drools.test;\n\nimport org.drools.Cheese;\n\nglobal java.lang.String foo\nglobal java.lang.Integer bar;\n\nrule baz\n when\n Cheese( )\n then\n\nend "
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package org.drools.test;\n\nimport org.drools.Cheese;\n\nglobal java.lang.String foo\nglobal java.lang.Integer bar;\n\nrule baz\n when\n Cheese( )\n then\n\nend ", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit48() throws Exception {
+ // test input: "\nimport java.lang.String\n\nfunction String functionA(String s, Integer i) {\n\t\n\tfoo();\n\n}\n\nfunction void functionB() {\n\tbar();\t\n}\n\n\nrule something \n\twhen\n\tthen\nend\n\nrule \"one more thing\"\n\twhen\n\tthen\nend\n\n\n\n\t"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nimport java.lang.String\n\nfunction String functionA(String s, Integer i) {\n\t\n\tfoo();\n\n}\n\nfunction void functionB() {\n\tbar();\t\n}\n\n\nrule something \n\twhen\n\tthen\nend\n\nrule \"one more thing\"\n\twhen\n\tthen\nend\n\n\n\n\t", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit49() throws Exception {
+ // test input: "#this starts with a comment\npackage foo.bar\n\n//and another comment\n\n/*\nyet\n\t another\n \t\t\t\tstyle\n*/\n\nrule \"test\"\n when\n then\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "#this starts with a comment\npackage foo.bar\n\n//and another comment\n\n/*\nyet\n\t another\n \t\t\t\tstyle\n*/\n\nrule \"test\"\n when\n then\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit50() throws Exception {
+ // test input: "\n\n\nrule simple_rule \n\t\t#attributes keywork (and colon) is totally optional\n\t\tsalience 42\n\t\tagenda-group \"my_group\"\n\t\tno-loop \n\t\tduration 42\n\t\tactivation-group \"my_activation_group\"\n\t\tlock-on-active true\n\twhen\n\t\tFoo()\n\tthen\n\t\tbar();\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\n\n\nrule simple_rule \n\t\t#attributes keywork (and colon) is totally optional\n\t\tsalience 42\n\t\tagenda-group \"my_group\"\n\t\tno-loop \n\t\tduration 42\n\t\tactivation-group \"my_activation_group\"\n\t\tlock-on-active true\n\twhen\n\t\tFoo()\n\tthen\n\t\tbar();\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit51() throws Exception {
+ // test input: "\n\n\nrule simple_rule \n\tattributes: \n\t\tsalience 42, agenda-group \"my_group\", no-loop, lock-on-active, duration 42, activation-group \"my_activation_group\"\n\twhen\n\t\tFoo()\n\tthen\n\t\tbar();\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\n\n\nrule simple_rule \n\tattributes: \n\t\tsalience 42, agenda-group \"my_group\", no-loop, lock-on-active, duration 42, activation-group \"my_activation_group\"\n\twhen\n\t\tFoo()\n\tthen\n\t\tbar();\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit52() throws Exception {
+ // test input: "\nrule simple_rule \n when\n \tFoo(bar == Foo.BAR)\n then\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule simple_rule \n when\n \tFoo(bar == Foo.BAR)\n then\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit53() throws Exception {
+ // test input: "rule one\n when\n exists Foo()\n exits Bar()\n then\nend\n\nrule two \n when\n ford = ford = ford\n then\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "rule one\n when\n exists Foo()\n exits Bar()\n then\nend\n\nrule two \n when\n ford = ford = ford\n then\nend", false);
+ Object actual = examineParserExecResult(28, retval);
+ Object expecting = "FAIL";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit54() throws Exception {
+ // test input: "\nrule \"another test\"\n when\n s : String()\n eval(s.equals(\"foo\") && s.startsWith(\"f\"))\n \n \n then\n list.add( s );\nend "
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule \"another test\"\n when\n s : String()\n eval(s.equals(\"foo\") && s.startsWith(\"f\"))\n \n \n then\n list.add( s );\nend ", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit55() throws Exception {
+ // test input: "package nesting;\n\n\n\n\nrule \"test something\"\n\n\twhen\n\t\tp: Person( name soundslike \"Michael\" )\n\tthen\n\t\tp.name = \"goober\"\n\t\tSystem.out.println(p.name)\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package nesting;\n\n\n\n\nrule \"test something\"\n\n\twhen\n\t\tp: Person( name soundslike \"Michael\" )\n\tthen\n\t\tp.name = \"goober\"\n\t\tSystem.out.println(p.name)\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit56() throws Exception {
+ // test input: "package com.foo;\n\nagenda-group \"x\"\n\nimport goo.ber\nimport wee.waa\n\n\ndialect \"java\"\n\n\n\n\nrule bar\n when\n then\nend\n\nrule baz\n dialect \"mvel\"\n when\n then\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package com.foo;\n\nagenda-group \"x\"\n\nimport goo.ber\nimport wee.waa\n\n\ndialect \"java\"\n\n\n\n\nrule bar\n when\n then\nend\n\nrule baz\n dialect \"mvel\"\n when\n then\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit57() throws Exception {
+ // test input: "\npackage com.foo;\n\nimport im.one\n\nimport im.two\n\nrule foo\n when\n then\nend\n\nfunction cheeseIt() {\n\n}\n\nimport im.three;\n\nrule bar\n when\n then\nend\n\nfunction uncheeseIt() {\n\n}\n\nimport im.four;"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\npackage com.foo;\n\nimport im.one\n\nimport im.two\n\nrule foo\n when\n then\nend\n\nfunction cheeseIt() {\n\n}\n\nimport im.three;\n\nrule bar\n when\n then\nend\n\nfunction uncheeseIt() {\n\n}\n\nimport im.four;", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit58() throws Exception {
+ // test input: "\nrule \"1. Do Stuff!\"\n when\n then\nend\n\nrule \"2. Do More Stuff!\"\n when\n then\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule \"1. Do Stuff!\"\n when\n then\nend\n\nrule \"2. Do More Stuff!\"\n when\n then\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit59() throws Exception {
+ // test input: "\nrule simple_rule \n when\n\tFoo()\n\tBar()\n\teval(\n\t\n\t\n\t\n\t abc(\n\t \n\t \"foo\") + \n\t 5\n\t \n\t \n\t \n\t \n\t )\n then\n\tKapow\n\tPoof\n\t\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule simple_rule \n when\n\tFoo()\n\tBar()\n\teval(\n\t\n\t\n\t\n\t abc(\n\t \n\t \"foo\") + \n\t 5\n\t \n\t \n\t \n\t \n\t )\n then\n\tKapow\n\tPoof\n\t\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit60() throws Exception {
+ // test input: "\nrule simple_rule \n when\n\teval(abc();)\n then\n\tKapow\n\tPoof\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\nrule simple_rule \n when\n\teval(abc();)\n then\n\tKapow\n\tPoof\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit61() throws Exception {
+ // test input: "\n\n\nrule simple_rule \n when\n\tFoo(\n\t bar == baz, la==laz\n\t )\n then\n\tKapow\n\tPoof\nend\n\t"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "\n\n\nrule simple_rule \n when\n\tFoo(\n\t bar == baz, la==laz\n\t )\n then\n\tKapow\n\tPoof\nend\n\t", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit62() throws Exception {
+ // test input: "package org.drools.test;\n\nrule \"Who likes Stilton\"\n when\n com.cheeseco.Cheese($type : type == \"stilton\")\n then\n System.out.println( $name + \" likes \" + $type);\nend "
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package org.drools.test;\n\nrule \"Who likes Stilton\"\n when\n com.cheeseco.Cheese($type : type == \"stilton\")\n then\n System.out.println( $name + \" likes \" + $type);\nend ", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit63() throws Exception {
+ // test input: "rule \"AccumulateParserTest\"\nwhen\n Integer() from accumulate( Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\nthen\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "rule \"AccumulateParserTest\"\nwhen\n Integer() from accumulate( Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\nthen\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit64() throws Exception {
+ // test input: "rule \"AccumulateParserTest\"\nwhen\n $counter:Integer() from accumulate( $person : Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\nthen\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "rule \"AccumulateParserTest\"\nwhen\n $counter:Integer() from accumulate( $person : Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\nthen\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit65() throws Exception {
+ // test input: "rule \"CollectParserTest\"\nwhen\n $personList : ArrayList() from collect( Person( age > 21 ) );\nthen\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "rule \"CollectParserTest\"\nwhen\n $personList : ArrayList() from collect( Person( age > 21 ) );\nthen\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit66() throws Exception {
+ // test input: "rule \"test_Quotes\"\n when\n InitialFact()\n then\n String s = \"\\\"\\n\\t\\\\\";\nend "
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "rule \"test_Quotes\"\n when\n InitialFact()\n then\n String s = \"\\\"\\n\\t\\\\\";\nend ", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit67() throws Exception {
+ // test input: "rule \"test nested CEs\"\t\n\twhen\n\t not ( State( $state : state ) and\n\t not( Person( status == $state, $likes : likes ) and\n\t Cheese( type == $likes ) ) )\n\t Person( name == \"Bob\" )\n\t ( Cheese( price == 10 ) or Cheese( type == \"brie\" ) )\n\tthen \n\t\tresults.add(\"OK\");\t\t\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "rule \"test nested CEs\"\t\n\twhen\n\t not ( State( $state : state ) and\n\t not( Person( status == $state, $likes : likes ) and\n\t Cheese( type == $likes ) ) )\n\t Person( name == \"Bob\" )\n\t ( Cheese( price == 10 ) or Cheese( type == \"brie\" ) )\n\tthen \n\t\tresults.add(\"OK\");\t\t\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit68() throws Exception {
+ // test input: "rule \"ForallParserTest\"\nwhen\n forall( Person( age > 21, $likes : likes )\n Cheese( type == $likes ) );\nthen\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "rule \"ForallParserTest\"\nwhen\n forall( Person( age > 21, $likes : likes )\n Cheese( type == $likes ) );\nthen\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit69() throws Exception {
+ // test input: "#testing 'in' operator\n\nrule simple_rule \n when\n \tPerson(age > 30 && < 40)\n \tVehicle(type in ( \"sedan\", \"wagon\" ), age < 3)\n then\n\tconsequence();\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "#testing 'in' operator\n\nrule simple_rule \n when\n \tPerson(age > 30 && < 40)\n \tVehicle(type in ( \"sedan\", \"wagon\" ), age < 3)\n then\n\tconsequence();\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit70() throws Exception {
+ // test input: "#testing not 'in' operator\n\nrule simple_rule \n when\n \tPerson(age > 30 && < 40)\n \tVehicle(type not in ( \"sedan\", \"wagon\" ), age < 3)\n then\n\tconsequence();\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "#testing not 'in' operator\n\nrule simple_rule \n when\n \tPerson(age > 30 && < 40)\n \tVehicle(type not in ( \"sedan\", \"wagon\" ), age < 3)\n then\n\tconsequence();\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit71() throws Exception {
+ // test input: "package org.drools;\n\nglobal java.util.List list;\n\nrule \"rule1\"\nwhen\n Pattern1();\n Pattern2() from x.y.z;\nthen\n System.out.println(\"Test\");\nend;\n\nquery \"query1\"\n\tPattern5();\n\tPattern6();\n\tPattern7();\nend;\n\nrule \"rule2\"\nwhen\n Pattern3();\n Pattern4() from collect( Pattern5() );\nthen\n System.out.println(\"Test\");\nend;\n\n\t"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package org.drools;\n\nglobal java.util.List list;\n\nrule \"rule1\"\nwhen\n Pattern1();\n Pattern2() from x.y.z;\nthen\n System.out.println(\"Test\");\nend;\n\nquery \"query1\"\n\tPattern5();\n\tPattern6();\n\tPattern7();\nend;\n\nrule \"rule2\"\nwhen\n Pattern3();\n Pattern4() from collect( Pattern5() );\nthen\n System.out.println(\"Test\");\nend;\n\n\t", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit72() throws Exception {
+ // test input: "package org.drools\n\nrule \"Test Parse\"\n\nwhen\n eval( 3==3 )\nthen\n System.out.println(\"OK\");\nend "
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package org.drools\n\nrule \"Test Parse\"\n\nwhen\n eval( 3==3 )\nthen\n System.out.println(\"OK\");\nend ", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit73() throws Exception {
+ // test input: "rule \"AccumulateReverseParserTest\"\nwhen\n Integer() from accumulate( Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n reverse( x--; ),\n result( new Integer(x) ) );\nthen\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "rule \"AccumulateReverseParserTest\"\nwhen\n Integer() from accumulate( Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n reverse( x--; ),\n result( new Integer(x) ) );\nthen\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit74() throws Exception {
+ // test input: "rule \"AccumulateReverseParserTest\"\nwhen\n Number() from accumulate( Person( $age : age > 21 ),\n average( $age ) );\nthen\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "rule \"AccumulateReverseParserTest\"\nwhen\n Number() from accumulate( Person( $age : age > 21 ),\n average( $age ) );\nthen\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit75() throws Exception {
+ // test input: "rule \"CollectParserTest\"\nwhen\n #bellow statement makes no sense, but is useful to test parsing recursiveness\n $personList : ArrayList() from collect( $p : Person( age > 21 || age < 10 ) from collect( People() from $town.getPeople() ) );\nthen\nend\n\n\t"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "rule \"CollectParserTest\"\nwhen\n #bellow statement makes no sense, but is useful to test parsing recursiveness\n $personList : ArrayList() from collect( $p : Person( age > 21 || age < 10 ) from collect( People() from $town.getPeople() ) );\nthen\nend\n\n\t", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit76() throws Exception {
+ // test input: "rule \"AccumulateParserTest\"\nwhen\n #bellow statement makes no sense, but is useful to test parsing recursiveness\n $personList : ArrayList() from accumulate( Person( $age : age > 21 || < 10 ) from collect( People() from $town.getPeople() ),\n max( $age ) );\nthen\nend\n\n\t"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "rule \"AccumulateParserTest\"\nwhen\n #bellow statement makes no sense, but is useful to test parsing recursiveness\n $personList : ArrayList() from accumulate( Person( $age : age > 21 || < 10 ) from collect( People() from $town.getPeople() ),\n max( $age ) );\nthen\nend\n\n\t", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit77() throws Exception {
+ // test input: "package org.drools;\n\nrule \"testing OR CE\"\nwhen\n $p : Person( name == \"bob\" )\n $c : Cheese( type == $p.likes ) || Cheese( price == 10 )\nthen\n // do something\nend "
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package org.drools;\n\nrule \"testing OR CE\"\nwhen\n $p : Person( name == \"bob\" )\n $c : Cheese( type == $p.likes ) || Cheese( price == 10 )\nthen\n // do something\nend ", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit78() throws Exception {
+ // test input: "rule \"another test\" salience 10 when eval( true ) then System.out.println(1); end"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "rule \"another test\" salience 10 when eval( true ) then System.out.println(1); end", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit79() throws Exception {
+ // test input: "rule \"another test\" salience 10 when eval( true ) then System.out.println(1);\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "rule \"another test\" salience 10 when eval( true ) then System.out.println(1);\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit80() throws Exception {
+ // test input: "rule \"AccumulateMultiPatternParserTest\"\nwhen\n $counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\nthen\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "rule \"AccumulateMultiPatternParserTest\"\nwhen\n $counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\nthen\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit81() throws Exception {
+ // test input: "package org.drools;\n\nrule \"test rule\"\n\tsalience 10\n\twhen\n\t\t$c: WorkerPerformanceContext(eval)$c.getBalanceMonth() != null))\n\tthen\n\t\tretract($p);\nend\n\t"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package org.drools;\n\nrule \"test rule\"\n\tsalience 10\n\twhen\n\t\t$c: WorkerPerformanceContext(eval)$c.getBalanceMonth() != null))\n\tthen\n\t\tretract($p);\nend\n\t", false);
+ Object actual = examineParserExecResult(28, retval);
+ Object expecting = "FAIL";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit82() throws Exception {
+ // test input: "package org.drools;\n\nrule \"Avoid NPE on wrong syntax\"\nwhen\n not( Cheese( ( type == \"stilton\", price == 10 ) || ( type == \"brie\", price == 15 ) ) from $cheeseList )\nthen\n System.out.println(\"OK\");\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package org.drools;\n\nrule \"Avoid NPE on wrong syntax\"\nwhen\n not( Cheese( ( type == \"stilton\", price == 10 ) || ( type == \"brie\", price == 15 ) ) from $cheeseList )\nthen\n System.out.println(\"OK\");\nend", false);
+ Object actual = examineParserExecResult(28, retval);
+ Object expecting = "FAIL";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testCompilation_unit_walks_Compilation_unit83() throws Exception {
+ // test input: "package org.drools;\n\nrule \"test pluggable operators\"\nwhen\n $a : EventA()\n $b : EventB( this after[1,10] $a )\n $c : EventC( this finishes $b )\n $d : EventD( this not starts $a )\n $e : EventE( this not before [1, 10] $b )\nthen\nend"
+ Object retval = execTreeParser("compilation_unit", "compilation_unit", "package org.drools;\n\nrule \"test pluggable operators\"\nwhen\n $a : EventA()\n $b : EventB( this after[1,10] $a )\n $c : EventC( this finishes $b )\n $d : EventD( this not starts $a )\n $e : EventE( this not before [1, 10] $b )\nthen\nend", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"compilation_unit", expecting, actual);
+ }
+
+ public void testLhs_walks_Pattern_source84() throws Exception {
+ // test input: "StockTick( symbol==\"ACME\") from entry-point StreamA"
+ Object retval = execTreeParser("lhs", "pattern_source", "StockTick( symbol==\"ACME\") from entry-point StreamA", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"lhs", expecting, actual);
+ }
+
+ public void testLhs_block_walks_Normal_lhs_block85() throws Exception {
+ // test input: ""
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -19,7 +775,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block2() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block86() throws Exception {
// test input: " $id : Something( duration == \"foo\") "
Object retval = execTreeParser("lhs_block", "normal_lhs_block", " $id : Something( duration == \"foo\") ", false);
Object actual = examineParserExecResult(27, retval);
@@ -28,7 +784,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block3() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block87() throws Exception {
// test input: "foo3 : Bar("
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "foo3 : Bar(", false);
Object actual = examineParserExecResult(28, retval);
@@ -37,7 +793,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block4() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block88() throws Exception {
// test input: "\n\tCheese(name == \"Stilton\", age==2001)\n\tWine(name == \"Grange\", age == \"1978\", accolades contains \"world champion\")\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tCheese(name == \"Stilton\", age==2001)\n\tWine(name == \"Grange\", age == \"1978\", accolades contains \"world champion\")\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -46,7 +802,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block5() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block89() throws Exception {
// test input: "Foo()"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "Foo()", false);
Object actual = examineParserExecResult(27, retval);
@@ -55,7 +811,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block6() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block90() throws Exception {
// test input: "not Cheese(type == \"stilton\")"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "not Cheese(type == \"stilton\")", false);
Object actual = examineParserExecResult(27, retval);
@@ -64,7 +820,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block7() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block91() throws Exception {
// test input: "\n\tPerson(age < 42, location==\"atlanta\") \n\tor\n\tPerson(name==\"bob\")\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tPerson(age < 42, location==\"atlanta\") \n\tor\n\tPerson(name==\"bob\")\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -73,7 +829,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block8() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block92() throws Exception {
// test input: "\n\tFoo(bar == false)\n\tFoo(boo > -42)\n\tFoo(boo > -42.42)\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tFoo(bar == false)\n\tFoo(boo > -42)\n\tFoo(boo > -42.42)\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -82,7 +838,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block9() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block93() throws Exception {
// test input: "Cheese( )"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "Cheese( )", false);
Object actual = examineParserExecResult(27, retval);
@@ -91,7 +847,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block10() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block94() throws Exception {
// test input: "\n\tCol1() from something.doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\n\tCol2()\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tCol1() from something.doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\n\tCol2()\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -100,7 +856,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block11() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block95() throws Exception {
// test input: "\n\tCol1() from doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\n\tCol2()\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tCol1() from doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\n\tCol2()\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -109,7 +865,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block12() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block96() throws Exception {
// test input: "\n\tCol1() from something.doIt\n\tCol2()\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tCol1() from something.doIt\n\tCol2()\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -118,7 +874,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block13() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block97() throws Exception {
// test input: "\n\tCol1() from something.doIt[\"key\"]\n\tCol2()\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tCol1() from something.doIt[\"key\"]\n\tCol2()\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -127,7 +883,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block14() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block98() throws Exception {
// test input: "\n\tCol1() from doIt1( foo,bar,42,\"hello\",{ a => \"b\"}, [a, \"b\", 42] )\n\t .doIt2(bar, [a, \"b\", 42]).field[\"key\"]\n\tCol2()\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tCol1() from doIt1( foo,bar,42,\"hello\",{ a => \"b\"}, [a, \"b\", 42] )\n\t .doIt2(bar, [a, \"b\", 42]).field[\"key\"]\n\tCol2()\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -136,7 +892,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block15() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block99() throws Exception {
// test input: "\n\tfoo3 : Bar(a==3)\n foo4 : Bar(a4:a==4)\n Baz()\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tfoo3 : Bar(a==3)\n foo4 : Bar(a4:a==4)\n Baz()\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -145,7 +901,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block16() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block100() throws Exception {
// test input: "\n\tPerson(age > 30 && < 40)\n \tVehicle(type == \"sedan\" || == \"wagon\", age < 3)\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tPerson(age > 30 && < 40)\n \tVehicle(type == \"sedan\" || == \"wagon\", age < 3)\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -154,7 +910,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block17() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block101() throws Exception {
// test input: " foo3 : Bar(a==3) ; foo4 : Bar(a4:a==4) ; Baz()"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", " foo3 : Bar(a==3) ; foo4 : Bar(a4:a==4) ; Baz()", false);
Object actual = examineParserExecResult(27, retval);
@@ -163,7 +919,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block18() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block102() throws Exception {
// test input: "\n \tnot ( Cheese(type == \"stilton\") )\n \texists ( Foo() )\n \t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n \tnot ( Cheese(type == \"stilton\") )\n \texists ( Foo() )\n \t", false);
Object actual = examineParserExecResult(27, retval);
@@ -172,7 +928,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block19() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block103() throws Exception {
// test input: "\n \tnot ( Cheese(type == \"stilton\") )\n \texists ( Foo() )\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n \tnot ( Cheese(type == \"stilton\") )\n \texists ( Foo() )\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -181,7 +937,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block20() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block104() throws Exception {
// test input: "\n \ta : (not ( Cheese(type == \"stilton\") ))\n \texists ( Foo() )\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n \ta : (not ( Cheese(type == \"stilton\") ))\n \texists ( Foo() )\n\t", false);
Object actual = examineParserExecResult(28, retval);
@@ -190,7 +946,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block21() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block105() throws Exception {
// test input: " Cheese( t:type == \"cheddar\" ) "
Object retval = execTreeParser("lhs_block", "normal_lhs_block", " Cheese( t:type == \"cheddar\" ) ", false);
Object actual = examineParserExecResult(27, retval);
@@ -199,7 +955,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block22() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block106() throws Exception {
// test input: "Cheese( $type:type )"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "Cheese( $type:type )", false);
Object actual = examineParserExecResult(27, retval);
@@ -208,7 +964,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block23() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block107() throws Exception {
// test input: "\n Cheese($type : type == \"stilton\")\n $person : Person($name : name == \"bob\", likes == $type) \n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n Cheese($type : type == \"stilton\")\n $person : Person($name : name == \"bob\", likes == $type) \n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -217,7 +973,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block24() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block108() throws Exception {
// test input: "\n\tPerson(name == \"mark\") or \n\t( Person(type == \"fan\") and Cheese(type == \"green\") )\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tPerson(name == \"mark\") or \n\t( Person(type == \"fan\") and Cheese(type == \"green\") )\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -226,7 +982,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block25() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block109() throws Exception {
// test input: "\n\tPerson(name == \"mark\") && Cheese(type == \"stilton\")\n Person(name == \"mark\") || Cheese(type == \"stilton\")\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tPerson(name == \"mark\") && Cheese(type == \"stilton\")\n Person(name == \"mark\") || Cheese(type == \"stilton\")\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -235,7 +991,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block26() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block110() throws Exception {
// test input: "\n\tfoo : ( Person(name == \"mark\") or Person(type == \"fan\") ) \n\tCheese(type == \"green\")\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tfoo : ( Person(name == \"mark\") or Person(type == \"fan\") ) \n\tCheese(type == \"green\")\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -244,7 +1000,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block27() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block111() throws Exception {
// test input: "\n\tfoo : ( Person(name == \"mark\") \n\t\tor \n\t\tPerson(type == \"fan\") )\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tfoo : ( Person(name == \"mark\") \n\t\tor \n\t\tPerson(type == \"fan\") )\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -253,7 +1009,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block28() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block112() throws Exception {
// test input: "\n\tfoo : ( \n\t\tPerson(name == \"mark\") or Person(type == \"fan\") \n\t\t)\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tfoo : ( \n\t\tPerson(name == \"mark\") or Person(type == \"fan\") \n\t\t)\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -262,7 +1018,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block29() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block113() throws Exception {
// test input: "\n\t ( (not Foo(x==\"a\") or Foo(x==\"y\") ) and ( Shoes() or Butt() ) )\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\t ( (not Foo(x==\"a\") or Foo(x==\"y\") ) and ( Shoes() or Butt() ) )\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -271,7 +1027,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block30() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block114() throws Exception {
// test input: "\n\teval(abc(\"foo\") + 5)\n\tFoo()\n\teval(qed())\n\tBar()\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\teval(abc(\"foo\") + 5)\n\tFoo()\n\teval(qed())\n\tBar()\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -280,7 +1036,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block31() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block115() throws Exception {
// test input: "\n\tFoo()\n\tBar()\n\teval(abc(\"foo\"))\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tFoo()\n\tBar()\n\teval(abc(\"foo\"))\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -289,7 +1045,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block32() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block116() throws Exception {
// test input: "Foo(name== (a + b))"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "Foo(name== (a + b))", false);
Object actual = examineParserExecResult(27, retval);
@@ -298,7 +1054,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block33() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block117() throws Exception {
// test input: "Person( $age2:age -> ($age2 == $age1+2 ) )"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "Person( $age2:age -> ($age2 == $age1+2 ) )", false);
Object actual = examineParserExecResult(27, retval);
@@ -307,7 +1063,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block34() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block118() throws Exception {
// test input: "Foo(bar == Foo.BAR)"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "Foo(bar == Foo.BAR)", false);
Object actual = examineParserExecResult(27, retval);
@@ -316,7 +1072,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block35() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block119() throws Exception {
// test input: "\n\tp: Person( name soundslike \"Michael\" )\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tp: Person( name soundslike \"Michael\" )\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -325,7 +1081,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block36() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block120() throws Exception {
// test input: "\n\tFoo()\n\tBar()\n\teval(\n\t\n\t\n\t\n\t abc(\n\t \n\t \"foo\") + \n\t 5\n\t \n\t \n\t \n\t \n\t )\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tFoo()\n\tBar()\n\teval(\n\t\n\t\n\t\n\t abc(\n\t \n\t \"foo\") + \n\t 5\n\t \n\t \n\t \n\t \n\t )\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -334,7 +1090,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block37() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block121() throws Exception {
// test input: "eval(abc();)"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "eval(abc();)", false);
Object actual = examineParserExecResult(27, retval);
@@ -343,7 +1099,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block38() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block122() throws Exception {
// test input: "\n\tFoo(\n\t bar == baz, la==laz\n\t )\n\t "
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tFoo(\n\t bar == baz, la==laz\n\t )\n\t ", false);
Object actual = examineParserExecResult(27, retval);
@@ -352,7 +1108,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block39() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block123() throws Exception {
// test input: "com.cheeseco.Cheese($type : type == \"stilton\")"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "com.cheeseco.Cheese($type : type == \"stilton\")", false);
Object actual = examineParserExecResult(27, retval);
@@ -361,7 +1117,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block40() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block124() throws Exception {
// test input: "\n\t Integer() from accumulate( Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\t Integer() from accumulate( Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -370,7 +1126,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block41() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block125() throws Exception {
// test input: "\n $counter:Integer() from accumulate( $person : Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n $counter:Integer() from accumulate( $person : Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -379,7 +1135,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block42() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block126() throws Exception {
// test input: "$personList : ArrayList() from collect( Person( age > 21 ) );"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "$personList : ArrayList() from collect( Person( age > 21 ) );", false);
Object actual = examineParserExecResult(27, retval);
@@ -388,7 +1144,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block43() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block127() throws Exception {
// test input: "\n\t\tnot ( State( $state : state ) and\n\t not( Person( status == $state, $likes : likes ) and\n\t Cheese( type == $likes ) ) )\n\t Person( name == \"Bob\" )\n\t ( Cheese( price == 10 ) or Cheese( type == \"brie\" ) )\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\t\tnot ( State( $state : state ) and\n\t not( Person( status == $state, $likes : likes ) and\n\t Cheese( type == $likes ) ) )\n\t Person( name == \"Bob\" )\n\t ( Cheese( price == 10 ) or Cheese( type == \"brie\" ) )\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -397,7 +1153,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block44() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block128() throws Exception {
// test input: "\n forall( Person( age > 21, $likes : likes )\n Cheese( type == $likes ) );\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n forall( Person( age > 21, $likes : likes )\n Cheese( type == $likes ) );\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -406,7 +1162,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block45() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block129() throws Exception {
// test input: "\n Country( $cities : city )\n Person( city memberOf $cities )\n "
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n Country( $cities : city )\n Person( city memberOf $cities )\n ", false);
Object actual = examineParserExecResult(27, retval);
@@ -415,7 +1171,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block46() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block130() throws Exception {
// test input: "\n Country( $cities : city )\n Person( city not memberOf $cities )\n "
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n Country( $cities : city )\n Person( city not memberOf $cities )\n ", false);
Object actual = examineParserExecResult(27, retval);
@@ -424,7 +1180,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block47() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block131() throws Exception {
// test input: "\n \tPerson(age > 30 && < 40)\n \tVehicle(type in ( \"sedan\", \"wagon\" ), age < 3)\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n \tPerson(age > 30 && < 40)\n \tVehicle(type in ( \"sedan\", \"wagon\" ), age < 3)\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -433,7 +1189,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block48() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block132() throws Exception {
// test input: "\n \tPerson(age > 30 && < 40)\n \tVehicle(type not in ( \"sedan\", \"wagon\" ), age < 3)\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n \tPerson(age > 30 && < 40)\n \tVehicle(type not in ( \"sedan\", \"wagon\" ), age < 3)\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -442,7 +1198,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block49() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block133() throws Exception {
// test input: " Person( age < 42 && location==\"atlanta\") "
Object retval = execTreeParser("lhs_block", "normal_lhs_block", " Person( age < 42 && location==\"atlanta\") ", false);
Object actual = examineParserExecResult(27, retval);
@@ -451,7 +1207,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block50() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block134() throws Exception {
// test input: " Person( age < 42 || location==\"atlanta\") "
Object retval = execTreeParser("lhs_block", "normal_lhs_block", " Person( age < 42 || location==\"atlanta\") ", false);
Object actual = examineParserExecResult(27, retval);
@@ -460,7 +1216,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block51() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block135() throws Exception {
// test input: "Person( age < 42 && location==\"atlanta\" || age > 20 && location==\"Seatle\" || location == \"Chicago\")"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "Person( age < 42 && location==\"atlanta\" || age > 20 && location==\"Seatle\" || location == \"Chicago\")", false);
Object actual = examineParserExecResult(27, retval);
@@ -469,7 +1225,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block52() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block136() throws Exception {
// test input: "Person( age < 42 && ( location==\"atlanta\" || age > 20 && location==\"Seatle\") || location == \"Chicago\")"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "Person( age < 42 && ( location==\"atlanta\" || age > 20 && location==\"Seatle\") || location == \"Chicago\")", false);
Object actual = examineParserExecResult(27, retval);
@@ -478,7 +1234,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block53() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block137() throws Exception {
// test input: " Person( ( age == 70 && hair == \"black\" ) || ( age == 40 && hair == \"pink\" ) || ( age == 12 && ( hair == \"yellow\" || hair == \"blue\" ) ) ) "
Object retval = execTreeParser("lhs_block", "normal_lhs_block", " Person( ( age == 70 && hair == \"black\" ) || ( age == 40 && hair == \"pink\" ) || ( age == 12 && ( hair == \"yellow\" || hair == \"blue\" ) ) ) ", false);
Object actual = examineParserExecResult(27, retval);
@@ -487,7 +1243,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block54() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block138() throws Exception {
// test input: " Person( name matches \"mark\" || matches \"bob\" ) "
Object retval = execTreeParser("lhs_block", "normal_lhs_block", " Person( name matches \"mark\" || matches \"bob\" ) ", false);
Object actual = examineParserExecResult(27, retval);
@@ -496,7 +1252,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block55() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block139() throws Exception {
// test input: "\n\tCity( $city : city )\n\tCountry( cities not contains $city )\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tCity( $city : city )\n\tCountry( cities not contains $city )\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -505,7 +1261,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block56() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block140() throws Exception {
// test input: " Message( text not matches '[abc]*' ) "
Object retval = execTreeParser("lhs_block", "normal_lhs_block", " Message( text not matches '[abc]*' ) ", false);
Object actual = examineParserExecResult(27, retval);
@@ -514,7 +1270,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block57() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block141() throws Exception {
// test input: "Foo( bar > 1 || == 1 )"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "Foo( bar > 1 || == 1 )", false);
Object actual = examineParserExecResult(27, retval);
@@ -523,7 +1279,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block58() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block142() throws Exception {
// test input: "\n\tPattern1();\n\tPattern2() from x.y.z;\n\tPattern5();\n\tPattern6();\n\tPattern7();\n\tPattern3();\n\tPattern4() from collect( Pattern5() );\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tPattern1();\n\tPattern2() from x.y.z;\n\tPattern5();\n\tPattern6();\n\tPattern7();\n\tPattern3();\n\tPattern4() from collect( Pattern5() );\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -532,7 +1288,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block59() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block143() throws Exception {
// test input: " eval( 3==3 ) "
Object retval = execTreeParser("lhs_block", "normal_lhs_block", " eval( 3==3 ) ", false);
Object actual = examineParserExecResult(27, retval);
@@ -541,7 +1297,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block60() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block144() throws Exception {
// test input: "\n\tInteger() from accumulate( Person( age > 21 ),\n\t init( int x = 0; ),\n\t action( x++; ),\n\t reverse( x--; ),\n\t result( new Integer(x) ) );\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tInteger() from accumulate( Person( age > 21 ),\n\t init( int x = 0; ),\n\t action( x++; ),\n\t reverse( x--; ),\n\t result( new Integer(x) ) );\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -550,7 +1306,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block61() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block145() throws Exception {
// test input: "\n Number() from accumulate( Person( $age : age > 21 ),\n average( $age ) );\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n Number() from accumulate( Person( $age : age > 21 ),\n average( $age ) );\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -559,7 +1315,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block62() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block146() throws Exception {
// test input: "\n #bellow statement makes no sense, but is useful to test parsing recursiveness\n $personList : ArrayList() from collect( $p : Person( age > 21 || age < 10 ) from collect( People() from $town.getPeople() ) );\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n #bellow statement makes no sense, but is useful to test parsing recursiveness\n $personList : ArrayList() from collect( $p : Person( age > 21 || age < 10 ) from collect( People() from $town.getPeople() ) );\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -568,7 +1324,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block63() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block147() throws Exception {
// test input: "\n $personList : ArrayList() from accumulate( Person( $age : age > 21 || < 10 ) from collect( People() from $town.getPeople() ),\n max( $age ) );\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n $personList : ArrayList() from accumulate( Person( $age : age > 21 || < 10 ) from collect( People() from $town.getPeople() ),\n max( $age ) );\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -577,7 +1333,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block64() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block148() throws Exception {
// test input: "\n $p : Person( name == \"bob\" )\n $c : Cheese( type == $p.likes ) || Cheese( price == 10 )\n "
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n $p : Person( name == \"bob\" )\n $c : Cheese( type == $p.likes ) || Cheese( price == 10 )\n ", false);
Object actual = examineParserExecResult(27, retval);
@@ -586,7 +1342,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block65() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block149() throws Exception {
// test input: "\n\t(or\n\tnot Person()\n\t\t(and Cheese()\n\t\t\tMeat()\n\t\t\tWine()))\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\t(or\n\tnot Person()\n\t\t(and Cheese()\n\t\t\tMeat()\n\t\t\tWine()))\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -595,7 +1351,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block66() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block150() throws Exception {
// test input: "\n $counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n $counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -604,7 +1360,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block67() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block151() throws Exception {
// test input: "\n $a : EventA()\n $b : EventB( this after[1,10] $a )\n $c : EventC( this finishes $b )\n $d : EventD( this not starts $a )\n $e : EventE( this not before [1, 10] $b )\n\t"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n $a : EventA()\n $b : EventB( this after[1,10] $a )\n $c : EventC( this finishes $b )\n $d : EventD( this not starts $a )\n $e : EventE( this not before [1, 10] $b )\n\t", false);
Object actual = examineParserExecResult(27, retval);
@@ -613,7 +1369,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block68() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block152() throws Exception {
// test input: "StockTick( symbol==\"ACME\") from entry-point StreamA"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "StockTick( symbol==\"ACME\") from entry-point StreamA", false);
Object actual = examineParserExecResult(27, retval);
@@ -622,7 +1378,7 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
- public void testLhs_block_walks_Normal_lhs_block69() throws Exception {
+ public void testLhs_block_walks_Normal_lhs_block153() throws Exception {
// test input: "Person( ( age ( > 60 && < 70 ) || ( > 50 && < 55 ) && hair == \"black\" ) || ( age == 40 && hair == \"pink\" ) || ( age == 12 && ( hair == \"yellow\" || hair == \"blue\" ) ))"
Object retval = execTreeParser("lhs_block", "normal_lhs_block", "Person( ( age ( > 60 && < 70 ) || ( > 50 && < 55 ) && hair == \"black\" ) || ( age == 40 && hair == \"pink\" ) || ( age == 12 && ( hair == \"yellow\" || hair == \"blue\" ) ))", false);
Object actual = examineParserExecResult(27, retval);
@@ -631,6 +1387,33 @@
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
+ public void testLhs_block_walks_Normal_lhs_block154() throws Exception {
+ // test input: "org . drools/*comment*/\t .Message( text not matches $c#comment\n. property )\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "org . drools/*comment*/\t .Message( text not matches $c#comment\n. property )\n", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"lhs_block", expecting, actual);
+ }
+
+ public void testFact_expression_walks_Constraints155() throws Exception {
+ // test input: "$var : attr -> ( $var.equals(\"xyz\") )"
+ Object retval = execTreeParser("fact_expression", "constraints", "$var : attr -> ( $var.equals(\"xyz\") )", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"fact_expression", expecting, actual);
+ }
+
+ public void testFact_expression_walks_Constraints156() throws Exception {
+ // test input: "eval( $var.equals(\"xyz\") )"
+ Object retval = execTreeParser("fact_expression", "constraints", "eval( $var.equals(\"xyz\") )", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
+
+ assertEquals("testing rule "+"fact_expression", expecting, actual);
+ }
+
// Invoke target parser.rule
public Object execTreeParser(String testTreeRuleName, String testRuleName, String testInput, boolean isFile) throws Exception {
CharStream input;
Modified: labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/gUnitTest.testsuite
===================================================================
--- labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/gUnitTest.testsuite 2008-05-09 10:26:23 UTC (rev 19919)
+++ labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/gUnitTest.testsuite 2008-05-09 17:01:54 UTC (rev 19920)
@@ -4,6 +4,1209 @@
package org.drools.lang;
}
+package_statement:
+ "package foo"
+ -> (package (VT_PACKAGE_ID foo))
+
+ "package foo.bar.baz;"
+ -> (package (VT_PACKAGE_ID foo bar baz))
+
+compilation_unit:
+ ""
+ -> "VT_COMPILATION_UNIT"
+ "package foo; import com.foo.Bar; import com.foo.Baz;"
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID foo)) (import (VT_IMPORT_ID com foo Bar)) (import (VT_IMPORT_ID com foo Baz)))
+
+ <<rule empty
+
+then
+
+end>>
+ -> (VT_COMPILATION_UNIT (rule empty then
+
+end))
+ <<#the purpose of this is to see what happens when we have some partially damaged syntax
+#as the IDE uses the parsers AST to work out completion suggestions.
+package test
+
+
+rule simple_rule
+ when
+ foo3 : Bar(
+
+>>
+ FAIL
+ <<package test.templates
+
+template Cheese
+ String name
+ Integer age
+end
+
+template "Wine"
+ String name
+ String year
+ String[] accolades
+end
+
+
+rule "a rule"
+ when
+ Cheese(name == "Stilton", age==2001)
+ Wine(name == "Grange", age == "1978", accolades contains "world champion")
+ then
+ baz();
+end>>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID test templates)) (template Cheese (VT_SLOT (VT_DATA_TYPE String) name) (VT_SLOT (VT_DATA_TYPE Integer) age)) (template "Wine" (VT_SLOT (VT_DATA_TYPE String) name) (VT_SLOT (VT_DATA_TYPE String) year) (VT_SLOT (VT_DATA_TYPE String [ ]) accolades)) (rule "a rule" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "Stilton")) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (== 2001)))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Wine) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "Grange")) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (== "1978")) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT accolades)) (contains "world champion"))))) then
+ baz();
+end))
+ <<package foo
+
+rule rule_one
+ when
+ Foo()
+ then
+ if (speed > speedLimit ? true : false;)
+ pullEmOver();
+end>>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID foo)) (rule rule_one when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo)))) then
+ if (speed > speedLimit ? true : false;)
+ pullEmOver();
+end))
+ <<package foo
+
+function String[] yourFunction(String args[]) {
+ baz();
+}
+
+rule "new rule"
+
+ when
+ Something()
+ then
+ yourFunction(new String[3] {"a","b","c"});
+
+end>>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID foo)) (function (VT_DATA_TYPE String [ ]) yourFunction (VT_PARAM_LIST (VT_DATA_TYPE String) args [ ]) {
+ baz();
+}) (rule "new rule" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Something)))) then
+ yourFunction(new String[3] {"a","b","c"});
+
+end))
+ <<
+rule almost_empty
+ when
+ then
+end>>
+ -> (VT_COMPILATION_UNIT (rule almost_empty when VT_AND_IMPLICIT then
+end))
+ <<rule "quoted string name"
+ when
+ then
+end>>
+ -> (VT_COMPILATION_UNIT (rule "quoted string name" when VT_AND_IMPLICIT then
+end))
+ <<
+rule rule1
+ no-loop false
+ when
+ not Cheese(type == "stilton")
+ then
+ funky();
+end>>
+ -> (VT_COMPILATION_UNIT (rule rule1 (VT_RULE_ATTRIBUTES (no-loop false)) when (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton")))))) then
+ funky();
+end))
+ <<
+rule rule1
+ auto-focus true
+ when
+ not Cheese(type == "stilton")
+ then
+ funky();
+end>>
+ -> (VT_COMPILATION_UNIT (rule rule1 (VT_RULE_ATTRIBUTES (auto-focus true)) when (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton")))))) then
+ funky();
+end))
+ <<
+rule rule1
+ ruleflow-group "a group"
+ when
+ not Cheese(type == "stilton")
+ then
+ funky();
+end>>
+ -> (VT_COMPILATION_UNIT (rule rule1 (VT_RULE_ATTRIBUTES (ruleflow-group "a group")) when (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton")))))) then
+ funky();
+end))
+ <<
+
+rule myrule
+ when
+ then
+ int i = 0;
+ i = 1;
+ i / 1;
+ i == 1;
+ i(i);
+ i = 'i';
+ i.i.i;
+ i\i;
+ i<i;
+ i>i;
+ i="i";
+ ++i;
+ i++;
+ --i;
+ i--;
+ i += i;
+ i -= i;
+ i *= i;
+ i /= i;
+ int i = 5;
+ for(int j; j<i; ++j) {
+ System.out.println(j);
+ }
+ Object o = new String("Hello");
+ String s = (String) o;
+
+end>>
+ -> (VT_COMPILATION_UNIT (rule myrule when VT_AND_IMPLICIT then
+ int i = 0;
+ i = 1;
+ i / 1;
+ i == 1;
+ i(i);
+ i = 'i';
+ i.i.i;
+ i\i;
+ i<i;
+ i>i;
+ i="i";
+ ++i;
+ i++;
+ --i;
+ i--;
+ i += i;
+ i -= i;
+ i *= i;
+ i /= i;
+ int i = 5;
+ for(int j; j<i; ++j) {
+ System.out.println(j);
+ }
+ Object o = new String("Hello");
+ String s = (String) o;
+
+end))
+
+ <<#check that it can handle true/false literals, and
+#negative numbers
+rule simple_rule
+ when
+ Foo(bar == false)
+ Foo(boo > -42)
+ Foo(boo > -42.42)
+ then
+ cons();
+end>>
+ -> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT bar)) (== false)))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT boo)) (> -42)))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT boo)) (> -42.42))))) then
+ cons();
+end))
+
+ <<package org.drools.test;
+
+import org.drools.Cheese;
+
+rule "simple rule"
+ when
+ Cheese( )
+ then
+end >>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools test)) (import (VT_IMPORT_ID org drools Cheese)) (rule "simple rule" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese)))) then
+end))
+ <<
+rule blah
+
+ when
+
+ Col1() from something.doIt( foo,bar,42,"hello",{ a => "b", "something" => 42, "a" => foo, x => {x=>y}},"end", [a, "b", 42] )
+ Col2()
+ then
+ partay();
+end >>
+ -> (VT_COMPILATION_UNIT (rule blah when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Col1))) (VT_FROM_SOURCE something (. doIt ( foo,bar,42,"hello",{ a => "b", "something" => 42, "a" => foo, x => {x=>y}},"end", [a, "b", 42] )))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Col2)))) then
+ partay();
+end))
+ <<
+rule blah
+
+ when
+
+ Col1() from doIt( foo,bar,42,"hello",{ a => "b", "something" => 42, "a" => foo, x => {x=>y}},"end", [a, "b", 42] )
+ Col2()
+ then
+ partay();
+end >>
+ -> (VT_COMPILATION_UNIT (rule blah when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Col1))) (VT_FROM_SOURCE doIt ( foo,bar,42,"hello",{ a => "b", "something" => 42, "a" => foo, x => {x=>y}},"end", [a, "b", 42] ))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Col2)))) then
+ partay();
+end))
+ <<
+rule blah
+
+ when
+
+ Col1() from something.doIt
+ Col2()
+ then
+ partay();
+end >>
+ -> (VT_COMPILATION_UNIT (rule blah when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Col1))) (VT_FROM_SOURCE something (. doIt))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Col2)))) then
+ partay();
+end))
+ <<
+rule blah
+
+ when
+
+ Col1() from something.doIt["key"]
+ Col2()
+ then
+ partay();
+end >>
+ -> (VT_COMPILATION_UNIT (rule blah when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Col1))) (VT_FROM_SOURCE something (. doIt ["key"]))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Col2)))) then
+ partay();
+end))
+ <<rule blah
+ when
+ Col1() from doIt1( foo,bar,42,"hello",{ a => "b"}, [a, "b", 42] )
+ .doIt2(bar, [a, "b", 42]).field["key"]
+ Col2()
+ then
+ partay();
+end >>
+ -> (VT_COMPILATION_UNIT (rule blah when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Col1))) (VT_FROM_SOURCE doIt1 ( foo,bar,42,"hello",{ a => "b"}, [a, "b", 42] ) (. doIt2 (bar, [a, "b", 42]) (. field ["key"])))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Col2)))) then
+ partay();
+end))
+ <<
+rule simple_rule
+ when
+ foo3 : Bar(a==3)
+ foo4 : Bar(a4:a==4)
+ Baz()
+ then
+ if ( a == b ) {
+ assert( foo3 );
+ } else {
+ retract( foo4 );
+ }
+ System.out.println( a4 );
+end>>
+ -> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo3 (VT_FACT (VT_DATA_TYPE Bar) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 3))))) (VT_PATTERN (VT_FACT_BINDING foo4 (VT_FACT (VT_DATA_TYPE Bar) (VT_BIND_FIELD a4 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 4)))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Baz)))) then
+ if ( a == b ) {
+ assert( foo3 );
+ } else {
+ retract( foo4 );
+ }
+ System.out.println( a4 );
+end))
+ <<#this is for showing off all the new multi restriction stuff
+
+
+
+
+rule simple_rule
+ when
+ Person(age > 30 && < 40)
+ Vehicle(type == "sedan" || == "wagon", age < 3)
+ then
+ consequence();
+end>>
+ -> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Vehicle) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (|| (== "sedan") (== "wagon"))) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 3))))) then
+ consequence();
+end))
+ <<package la
+
+
+rule simple_rule
+ when
+ Baz()
+ then
+ //woot
+ first
+
+ #
+
+ /* lala
+
+ */
+ second
+end>>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID la)) (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Baz)))) then
+ //woot
+ first
+
+ //
+
+ /* lala
+
+ */
+ second
+end))
+ <<
+rule simple_rule
+ when
+ foo3 : Bar(a==3) ; foo4 : Bar(a4:a==4) ; Baz()
+ then
+ if ( a == b ) {
+ assert( foo3 );
+ } else {
+ retract( foo4 );
+ }
+ System.out.println( a4 );
+end>>
+ -> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo3 (VT_FACT (VT_DATA_TYPE Bar) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 3))))) (VT_PATTERN (VT_FACT_BINDING foo4 (VT_FACT (VT_DATA_TYPE Bar) (VT_BIND_FIELD a4 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 4)))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Baz)))) then
+ if ( a == b ) {
+ assert( foo3 );
+ } else {
+ retract( foo4 );
+ }
+ System.out.println( a4 );
+end))
+ <<
+rule simple_rule
+ when
+ not Cheese(type == "stilton")
+ then
+ funky();
+end>>
+ -> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton")))))) then
+ funky();
+end))
+ <<package HR1
+
+import function abd.def.x
+import function qed.wah.*
+
+rule simple_rule
+ when
+ not ( Cheese(type == "stilton") )
+ exists ( Foo() )
+ then
+ funky();
+end>>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID HR1)) (VT_FUNCTION_IMPORT function (VT_IMPORT_ID abd def x)) (VT_FUNCTION_IMPORT function (VT_IMPORT_ID qed wah .*)) (rule simple_rule when (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton"))))) (exists (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo))))) then
+ funky();
+end))
+ <<package HR1
+
+rule simple_rule
+ when
+ not ( Cheese(type == "stilton") )
+ exists ( Foo() )
+ then
+ funky();
+end>>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID HR1)) (rule simple_rule when (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton"))))) (exists (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo))))) then
+ funky();
+end))
+ <<package HR2
+
+rule simple_rule
+ when
+ a : (not ( Cheese(type == "stilton") ))
+ exists ( Foo() )
+ then
+ funky();
+end>>
+ FAIL
+ <<
+
+query "simple_query"
+ foo3 : Bar(a==3)
+ foo4 : Bar(a4:a==4)
+ Baz()
+
+end>>
+ -> (VT_COMPILATION_UNIT (query "simple_query" (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo3 (VT_FACT (VT_DATA_TYPE Bar) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 3))))) (VT_PATTERN (VT_FACT_BINDING foo4 (VT_FACT (VT_DATA_TYPE Bar) (VT_BIND_FIELD a4 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 4)))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Baz))))))
+ <<
+package foo
+
+rule bar
+ when
+ Baz()
+ then
+ Boo()
+end
+
+query "simple_query"
+ foo3 : Bar(a==3)
+ foo4 : Bar(a4:a==4)
+ Baz()
+
+end
+
+rule bar2
+ when
+ Baz()
+ then
+ Boo()
+end
+
+query "simple_query2"
+ foo3 : Bar(a==3)
+ foo4 : Bar(a4:a==4)
+ Baz()
+
+end
+ >>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID foo)) (rule bar when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Baz)))) then
+ Boo()
+end) (query "simple_query" (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo3 (VT_FACT (VT_DATA_TYPE Bar) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 3))))) (VT_PATTERN (VT_FACT_BINDING foo4 (VT_FACT (VT_DATA_TYPE Bar) (VT_BIND_FIELD a4 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 4)))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Baz))))) (rule bar2 when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Baz)))) then
+ Boo()
+end) (query "simple_query2" (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo3 (VT_FACT (VT_DATA_TYPE Bar) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 3))))) (VT_PATTERN (VT_FACT_BINDING foo4 (VT_FACT (VT_DATA_TYPE Bar) (VT_BIND_FIELD a4 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 4)))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Baz))))))
+
+ <<package org.drools.test;
+
+import org.drools.integrationtests.Cheese;
+
+rule "Like Stilton"
+ when
+ Cheese( t:type == "stilton" )
+ then
+ System.out.println("I like " + t);
+end
+
+rule "Like Cheddar"
+ when
+ Cheese( t:type == "cheddar" )
+ then
+ System.out.println("I like " + t );
+end >>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools test)) (import (VT_IMPORT_ID org drools integrationtests Cheese)) (rule "Like Stilton" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_BIND_FIELD t (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton")))))) then
+ System.out.println("I like " + t);
+end) (rule "Like Cheddar" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_BIND_FIELD t (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "cheddar")))))) then
+ System.out.println("I like " + t );
+end))
+ <<package org.drools.test;
+
+import org.drools.Cheese;
+
+rule "like cheddar"
+ when
+ Cheese( $type:type )
+ then
+ System.out.println("I like " + $type);
+end >>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools test)) (import (VT_IMPORT_ID org drools Cheese)) (rule "like cheddar" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_BIND_FIELD $type (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type))))))) then
+ System.out.println("I like " + $type);
+end))
+ <<package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+rule "Who likes Stilton"
+ when
+ Cheese($type : type == "stilton")
+ $person : Person($name : name == "bob", likes == $type)
+ then
+ System.out.println( $name + " likes " + $type);
+end >>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools test)) (import (VT_IMPORT_ID org drools Cheese)) (import (VT_IMPORT_ID org drools Person)) (rule "Who likes Stilton" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_BIND_FIELD $type (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton"))))) (VT_PATTERN (VT_FACT_BINDING $person (VT_FACT (VT_DATA_TYPE Person) (VT_BIND_FIELD $name (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "bob"))) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT likes)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $type)))))))) then
+ System.out.println( $name + " likes " + $type);
+end))
+ <<
+import org.drools.Person
+
+rule simple_rule
+ when
+ Person(name == "mark") or
+ ( Person(type == "fan") and Cheese(type == "green") )
+ then
+ System.out.println( "Mark and Michael" + bar );
+end>>
+ -> (VT_COMPILATION_UNIT (import (VT_IMPORT_ID org drools Person)) (rule simple_rule when (VT_AND_IMPLICIT (or (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark")))) (and (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "fan")))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "green"))))))) then
+ System.out.println( "Mark and Michael" + bar );
+end))
+ <<
+import org.drools.Person
+
+rule simple_rule
+ when
+ Person(name == "mark") && Cheese(type == "stilton")
+ Person(name == "mark") || Cheese(type == "stilton")
+ then
+ System.out.println( "Mark and Michael" );
+end>>
+ -> (VT_COMPILATION_UNIT (import (VT_IMPORT_ID org drools Person)) (rule simple_rule when (VT_AND_IMPLICIT (&& (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark")))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton"))))) (|| (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark")))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton")))))) then
+ System.out.println( "Mark and Michael" );
+end))
+ <<
+import org.drools.Person
+
+rule simple_rule
+ when
+ foo : ( Person(name == "mark") or Person(type == "fan") )
+ Cheese(type == "green")
+ then
+ System.out.println( "Mark and Michael" + bar );
+end>>
+ -> (VT_COMPILATION_UNIT (import (VT_IMPORT_ID org drools Person)) (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo (or (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark"))) (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "fan")))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "green"))))) then
+ System.out.println( "Mark and Michael" + bar );
+end))
+ <<
+
+rule simple_rule
+ when
+ foo : ( Person(name == "mark")
+ or
+ Person(type == "fan") )
+ then
+ System.out.println( "Mark and Michael" + bar );
+end>>
+ -> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo (or (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark"))) (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "fan"))))))) then
+ System.out.println( "Mark and Michael" + bar );
+end))
+ <<rule simple_rule
+ when
+ foo : (
+ Person(name == "mark") or Person(type == "fan")
+ )
+ then
+ System.out.println( "Mark and Michael" + bar );
+end>>
+ -> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo (or (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark"))) (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "fan"))))))) then
+ System.out.println( "Mark and Michael" + bar );
+end))
+ <<
+rule simple_rule
+ when
+ ( (not Foo(x=="a") or Foo(x=="y") ) and ( Shoes() or Butt() ) )
+ then
+ go wild
+end>>
+ -> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (and (or (not (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT x)) (== "a"))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT x)) (== "y"))))) (or (VT_PATTERN (VT_FACT (VT_DATA_TYPE Shoes))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Butt)))))) then
+ go wild
+end))
+ <<
+rule simple_rule
+ when
+ eval(abc("foo") + 5)
+ Foo()
+ eval(qed())
+ Bar()
+ then
+ Kapow
+ Poof
+
+end>>
+ -> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (eval (abc("foo") + 5)) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo))) (eval (qed())) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Bar)))) then
+ Kapow
+ Poof
+
+end))
+ <<
+rule simple_rule
+ when
+ Foo()
+ Bar()
+ eval(abc("foo"))
+ then
+ Kapow
+
+end>>
+ -> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Bar))) (eval (abc("foo")))) then
+ Kapow
+
+end))
+ <<
+rule simple_rule
+ when
+ Foo(name== (a + b))
+ then
+ Kapow
+
+end>>
+ -> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== (a + b)))))) then
+ Kapow
+
+end))
+ <<
+rule simple_rule
+ when
+ Person( $age2:age -> ($age2 == $age1+2 ) )
+ then
+ foo bar
+end>>
+ -> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_BIND_FIELD $age2 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (-> ($age2 == $age1+2 ))))))) then
+ foo bar
+end))
+ <<package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List list;
+global java.lang.Integer five;
+
+rule "not rule test"
+ when
+ $person : Person( $likes:like )
+ not Cheese( type == $likes )
+ then
+ list.add( $person );
+end >>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools test)) (import (VT_IMPORT_ID org drools Cheese)) (global (VT_DATA_TYPE java util List) list) (global (VT_DATA_TYPE java lang Integer) five) (rule "not rule test" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING $person (VT_FACT (VT_DATA_TYPE Person) (VT_BIND_FIELD $likes (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT like))))))) (not (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $likes)))))))) then
+ list.add( $person );
+end))
+ <<package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.lang.String foo
+global java.lang.Integer bar;
+
+rule baz
+ when
+ Cheese( )
+ then
+
+end >>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools test)) (import (VT_IMPORT_ID org drools Cheese)) (global (VT_DATA_TYPE java lang String) foo) (global (VT_DATA_TYPE java lang Integer) bar) (rule baz when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese)))) then
+
+end))
+ <<
+import java.lang.String
+
+function String functionA(String s, Integer i) {
+
+ foo();
+
+}
+
+function void functionB() {
+ bar();
+}
+
+
+rule something
+ when
+ then
+end
+
+rule "one more thing"
+ when
+ then
+end
+
+
+
+ >>
+ -> (VT_COMPILATION_UNIT (import (VT_IMPORT_ID java lang String)) (function (VT_DATA_TYPE String) functionA (VT_PARAM_LIST (VT_DATA_TYPE String) s (VT_DATA_TYPE Integer) i) {
+
+ foo();
+
+}) (function (VT_DATA_TYPE void) functionB VT_PARAM_LIST {
+ bar();
+}) (rule something when VT_AND_IMPLICIT then
+end) (rule "one more thing" when VT_AND_IMPLICIT then
+end))
+ <<#this starts with a comment
+package foo.bar
+
+//and another comment
+
+/*
+yet
+ another
+ style
+*/
+
+rule "test"
+ when
+ then
+end>>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID foo bar)) (rule "test" when VT_AND_IMPLICIT then
+end))
+ <<
+
+
+rule simple_rule
+ #attributes keywork (and colon) is totally optional
+ salience 42
+ agenda-group "my_group"
+ no-loop
+ duration 42
+ activation-group "my_activation_group"
+ lock-on-active true
+ when
+ Foo()
+ then
+ bar();
+end>>
+ -> (VT_COMPILATION_UNIT (rule simple_rule (VT_RULE_ATTRIBUTES (salience 42) (agenda-group "my_group") no-loop (duration 42) (activation-group "my_activation_group") (lock-on-active true)) when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo)))) then
+ bar();
+end))
+ <<
+
+
+rule simple_rule
+ attributes:
+ salience 42, agenda-group "my_group", no-loop, lock-on-active, duration 42, activation-group "my_activation_group"
+ when
+ Foo()
+ then
+ bar();
+end>>
+ -> (VT_COMPILATION_UNIT (rule simple_rule (VT_RULE_ATTRIBUTES attributes (salience 42) (agenda-group "my_group") no-loop lock-on-active (duration 42) (activation-group "my_activation_group")) when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo)))) then
+ bar();
+end))
+ <<
+rule simple_rule
+ when
+ Foo(bar == Foo.BAR)
+ then
+end>>
+ -> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT bar)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT Foo) (VT_ACCESSOR_ELEMENT BAR))))))) then
+end))
+ <<rule one
+ when
+ exists Foo()
+ exits Bar()
+ then
+end
+
+rule two
+ when
+ ford = ford = ford
+ then
+end>>
+ FAIL
+ <<
+rule "another test"
+ when
+ s : String()
+ eval(s.equals("foo") && s.startsWith("f"))
+
+
+ then
+ list.add( s );
+end >>
+ -> (VT_COMPILATION_UNIT (rule "another test" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING s (VT_FACT (VT_DATA_TYPE String)))) (eval (s.equals("foo") && s.startsWith("f")))) then
+ list.add( s );
+end))
+ <<package nesting;
+
+
+
+
+rule "test something"
+
+ when
+ p: Person( name soundslike "Michael" )
+ then
+ p.name = "goober"
+ System.out.println(p.name)
+end>>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID nesting)) (rule "test something" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING p (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (soundslike "Michael")))))) then
+ p.name = "goober"
+ System.out.println(p.name)
+end))
+ <<package com.foo;
+
+agenda-group "x"
+
+import goo.ber
+import wee.waa
+
+
+dialect "java"
+
+
+
+
+rule bar
+ when
+ then
+end
+
+rule baz
+ dialect "mvel"
+ when
+ then
+end>>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID com foo)) (agenda-group "x") (import (VT_IMPORT_ID goo ber)) (import (VT_IMPORT_ID wee waa)) (dialect "java") (rule bar when VT_AND_IMPLICIT then
+end) (rule baz (VT_RULE_ATTRIBUTES (dialect "mvel")) when VT_AND_IMPLICIT then
+end))
+ <<
+package com.foo;
+
+import im.one
+
+import im.two
+
+rule foo
+ when
+ then
+end
+
+function cheeseIt() {
+
+}
+
+import im.three;
+
+rule bar
+ when
+ then
+end
+
+function uncheeseIt() {
+
+}
+
+import im.four;>>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID com foo)) (import (VT_IMPORT_ID im one)) (import (VT_IMPORT_ID im two)) (rule foo when VT_AND_IMPLICIT then
+end) (function cheeseIt VT_PARAM_LIST {
+
+}) (import (VT_IMPORT_ID im three)) (rule bar when VT_AND_IMPLICIT then
+end) (function uncheeseIt VT_PARAM_LIST {
+
+}) (import (VT_IMPORT_ID im four)))
+ <<
+rule "1. Do Stuff!"
+ when
+ then
+end
+
+rule "2. Do More Stuff!"
+ when
+ then
+end>>
+ -> (VT_COMPILATION_UNIT (rule "1. Do Stuff!" when VT_AND_IMPLICIT then
+end) (rule "2. Do More Stuff!" when VT_AND_IMPLICIT then
+end))
+ <<
+rule simple_rule
+ when
+ Foo()
+ Bar()
+ eval(
+
+
+
+ abc(
+
+ "foo") +
+ 5
+
+
+
+
+ )
+ then
+ Kapow
+ Poof
+
+end>>
+ -> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Bar))) (eval (
+
+
+
+ abc(
+
+ "foo") +
+ 5
+
+
+
+
+ ))) then
+ Kapow
+ Poof
+
+end))
+ <<
+rule simple_rule
+ when
+ eval(abc();)
+ then
+ Kapow
+ Poof
+end>>
+ -> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (eval (abc();))) then
+ Kapow
+ Poof
+end))
+ <<
+
+
+rule simple_rule
+ when
+ Foo(
+ bar == baz, la==laz
+ )
+ then
+ Kapow
+ Poof
+end
+ >>
+ -> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT bar)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT baz)))) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT la)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT laz))))))) then
+ Kapow
+ Poof
+end))
+ <<package org.drools.test;
+
+rule "Who likes Stilton"
+ when
+ com.cheeseco.Cheese($type : type == "stilton")
+ then
+ System.out.println( $name + " likes " + $type);
+end >>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools test)) (rule "Who likes Stilton" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE com cheeseco Cheese) (VT_BIND_FIELD $type (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton")))))) then
+ System.out.println( $name + " likes " + $type);
+end))
+ <<rule "AccumulateParserTest"
+when
+ Integer() from accumulate( Person( age > 21 ),
+ init( int x = 0; ),
+ action( x++; ),
+ result( new Integer(x) ) );
+then
+end>>
+ -> (VT_COMPILATION_UNIT (rule "AccumulateParserTest" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Integer))) (accumulate (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21)))) (VT_ACCUMULATE_INIT_CLAUSE (init ( int x = 0; )) (action ( x++; )) (result ( new Integer(x) )))))) then
+end))
+ <<rule "AccumulateParserTest"
+when
+ $counter:Integer() from accumulate( $person : Person( age > 21 ),
+ init( int x = 0; ),
+ action( x++; ),
+ result( new Integer(x) ) );
+then
+end>>
+ -> (VT_COMPILATION_UNIT (rule "AccumulateParserTest" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $counter (VT_FACT (VT_DATA_TYPE Integer)))) (accumulate (VT_PATTERN (VT_FACT_BINDING $person (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21))))) (VT_ACCUMULATE_INIT_CLAUSE (init ( int x = 0; )) (action ( x++; )) (result ( new Integer(x) )))))) then
+end))
+ <<rule "CollectParserTest"
+when
+ $personList : ArrayList() from collect( Person( age > 21 ) );
+then
+end>>
+ -> (VT_COMPILATION_UNIT (rule "CollectParserTest" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $personList (VT_FACT (VT_DATA_TYPE ArrayList)))) (collect (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21))))))) then
+end))
+ <<rule "test_Quotes"
+ when
+ InitialFact()
+ then
+ String s = "\"\n\t\\";
+end >>
+ -> (VT_COMPILATION_UNIT (rule "test_Quotes" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE InitialFact)))) then
+ String s = "\"\n\t\\";
+end))
+ <<rule "test nested CEs"
+ when
+ not ( State( $state : state ) and
+ not( Person( status == $state, $likes : likes ) and
+ Cheese( type == $likes ) ) )
+ Person( name == "Bob" )
+ ( Cheese( price == 10 ) or Cheese( type == "brie" ) )
+ then
+ results.add("OK");
+end>>
+ -> (VT_COMPILATION_UNIT (rule "test nested CEs" when (VT_AND_IMPLICIT (not (and (VT_PATTERN (VT_FACT (VT_DATA_TYPE State) (VT_BIND_FIELD $state (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT state)))))) (not (and (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT status)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $state)))) (VT_BIND_FIELD $likes (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT likes)))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $likes)))))))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "Bob")))) (or (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT price)) (== 10)))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "brie")))))) then
+ results.add("OK");
+end))
+ <<rule "ForallParserTest"
+when
+ forall( Person( age > 21, $likes : likes )
+ Cheese( type == $likes ) );
+then
+end>>
+ -> (VT_COMPILATION_UNIT (rule "ForallParserTest" when (VT_AND_IMPLICIT (forall (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21)) (VT_BIND_FIELD $likes (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT likes)))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $likes)))))))) then
+end))
+ <<#testing 'in' operator
+
+rule simple_rule
+ when
+ Person(age > 30 && < 40)
+ Vehicle(type in ( "sedan", "wagon" ), age < 3)
+ then
+ consequence();
+end>>
+ -> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Vehicle) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (in "sedan" "wagon")) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 3))))) then
+ consequence();
+end))
+ <<#testing not 'in' operator
+
+rule simple_rule
+ when
+ Person(age > 30 && < 40)
+ Vehicle(type not in ( "sedan", "wagon" ), age < 3)
+ then
+ consequence();
+end>>
+ -> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Vehicle) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (in not "sedan" "wagon")) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 3))))) then
+ consequence();
+end))
+ <<package org.drools;
+
+global java.util.List list;
+
+rule "rule1"
+when
+ Pattern1();
+ Pattern2() from x.y.z;
+then
+ System.out.println("Test");
+end;
+
+query "query1"
+ Pattern5();
+ Pattern6();
+ Pattern7();
+end;
+
+rule "rule2"
+when
+ Pattern3();
+ Pattern4() from collect( Pattern5() );
+then
+ System.out.println("Test");
+end;
+
+ >>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools)) (global (VT_DATA_TYPE java util List) list) (rule "rule1" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Pattern1))) (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Pattern2))) (VT_FROM_SOURCE x (. y (. z))))) then
+ System.out.println("Test");
+end;) (query "query1" (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Pattern5))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Pattern6))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Pattern7))))) (rule "rule2" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Pattern3))) (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Pattern4))) (collect (VT_PATTERN (VT_FACT (VT_DATA_TYPE Pattern5)))))) then
+ System.out.println("Test");
+end;))
+ <<package org.drools
+
+rule "Test Parse"
+
+when
+ eval( 3==3 )
+then
+ System.out.println("OK");
+end >>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools)) (rule "Test Parse" when (VT_AND_IMPLICIT (eval ( 3==3 ))) then
+ System.out.println("OK");
+end))
+ <<rule "AccumulateReverseParserTest"
+when
+ Integer() from accumulate( Person( age > 21 ),
+ init( int x = 0; ),
+ action( x++; ),
+ reverse( x--; ),
+ result( new Integer(x) ) );
+then
+end>>
+ -> (VT_COMPILATION_UNIT (rule "AccumulateReverseParserTest" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Integer))) (accumulate (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21)))) (VT_ACCUMULATE_INIT_CLAUSE (init ( int x = 0; )) (action ( x++; )) (reverse ( x--; )) (result ( new Integer(x) )))))) then
+end))
+ <<rule "AccumulateReverseParserTest"
+when
+ Number() from accumulate( Person( $age : age > 21 ),
+ average( $age ) );
+then
+end>>
+ -> (VT_COMPILATION_UNIT (rule "AccumulateReverseParserTest" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Number))) (accumulate (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_BIND_FIELD $age (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21))))) (VT_ACCUMULATE_ID_CLAUSE average ( $age ))))) then
+end))
+ <<rule "CollectParserTest"
+when
+ #bellow statement makes no sense, but is useful to test parsing recursiveness
+ $personList : ArrayList() from collect( $p : Person( age > 21 || age < 10 ) from collect( People() from $town.getPeople() ) );
+then
+end
+
+ >>
+ -> (VT_COMPILATION_UNIT (rule "CollectParserTest" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $personList (VT_FACT (VT_DATA_TYPE ArrayList)))) (collect (from (VT_PATTERN (VT_FACT_BINDING $p (VT_FACT (VT_DATA_TYPE Person) (|| (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 10)))))) (collect (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE People))) (VT_FROM_SOURCE $town (. getPeople ())))))))) then
+end))
+ <<rule "AccumulateParserTest"
+when
+ #bellow statement makes no sense, but is useful to test parsing recursiveness
+ $personList : ArrayList() from accumulate( Person( $age : age > 21 || < 10 ) from collect( People() from $town.getPeople() ),
+ max( $age ) );
+then
+end
+
+ >>
+ -> (VT_COMPILATION_UNIT (rule "AccumulateParserTest" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $personList (VT_FACT (VT_DATA_TYPE ArrayList)))) (accumulate (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (VT_BIND_FIELD $age (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (|| (> 21) (< 10)))))) (collect (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE People))) (VT_FROM_SOURCE $town (. getPeople ()))))) (VT_ACCUMULATE_ID_CLAUSE max ( $age ))))) then
+end))
+ <<package org.drools;
+
+rule "testing OR CE"
+when
+ $p : Person( name == "bob" )
+ $c : Cheese( type == $p.likes ) || Cheese( price == 10 )
+then
+ // do something
+end >>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools)) (rule "testing OR CE" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING $p (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "bob"))))) (|| (VT_PATTERN (VT_FACT_BINDING $c (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $p) (VT_ACCESSOR_ELEMENT likes))))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT price)) (== 10)))))) then
+ // do something
+end))
+ <<rule "another test" salience 10 when eval( true ) then System.out.println(1); end>>
+ -> (VT_COMPILATION_UNIT (rule "another test" (VT_RULE_ATTRIBUTES (salience 10)) when (VT_AND_IMPLICIT (eval ( true ))) then System.out.println(1); end))
+ <<rule "another test" salience 10 when eval( true ) then System.out.println(1);
+end>>
+ -> (VT_COMPILATION_UNIT (rule "another test" (VT_RULE_ATTRIBUTES (salience 10)) when (VT_AND_IMPLICIT (eval ( true ))) then System.out.println(1);
+end))
+ <<rule "AccumulateMultiPatternParserTest"
+when
+ $counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),
+ init( int x = 0; ),
+ action( x++; ),
+ result( new Integer(x) ) );
+then
+end>>
+ -> (VT_COMPILATION_UNIT (rule "AccumulateMultiPatternParserTest" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $counter (VT_FACT (VT_DATA_TYPE Integer)))) (accumulate (and (VT_PATTERN (VT_FACT_BINDING $person (VT_FACT (VT_DATA_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21))))) (VT_PATTERN (VT_FACT (VT_DATA_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $person) (VT_ACCESSOR_ELEMENT likes))))))) (VT_ACCUMULATE_INIT_CLAUSE (init ( int x = 0; )) (action ( x++; )) (result ( new Integer(x) )))))) then
+end))
+ <<package org.drools;
+
+rule "test rule"
+ salience 10
+ when
+ $c: WorkerPerformanceContext(eval)$c.getBalanceMonth() != null))
+ then
+ retract($p);
+end
+ >>
+ FAIL
+ <<package org.drools;
+
+rule "Avoid NPE on wrong syntax"
+when
+ not( Cheese( ( type == "stilton", price == 10 ) || ( type == "brie", price == 15 ) ) from $cheeseList )
+then
+ System.out.println("OK");
+end>>
+ FAIL
+ <<package org.drools;
+
+rule "test pluggable operators"
+when
+ $a : EventA()
+ $b : EventB( this after[1,10] $a )
+ $c : EventC( this finishes $b )
+ $d : EventD( this not starts $a )
+ $e : EventE( this not before [1, 10] $b )
+then
+end>>
+ -> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools)) (rule "test pluggable operators" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING $a (VT_FACT (VT_DATA_TYPE EventA)))) (VT_PATTERN (VT_FACT_BINDING $b (VT_FACT (VT_DATA_TYPE EventB) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT this)) (after [1,10] (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $a))))))) (VT_PATTERN (VT_FACT_BINDING $c (VT_FACT (VT_DATA_TYPE EventC) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT this)) (finishes (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $b))))))) (VT_PATTERN (VT_FACT_BINDING $d (VT_FACT (VT_DATA_TYPE EventD) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT this)) (starts not (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $a))))))) (VT_PATTERN (VT_FACT_BINDING $e (VT_FACT (VT_DATA_TYPE EventE) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT this)) (before not [1, 10] (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $b)))))))) then
+end))
+
+pattern_source:
+ <<StockTick( symbol=="ACME") from entry-point StreamA>>
+ -> (from (VT_PATTERN (VT_FACT (VT_DATA_TYPE StockTick) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT symbol)) (== "ACME")))) (entry-point StreamA))
+
+paren_chunk:
+ <<( foo )>>
+ -> ( foo )
+ <<(fnord())>>
+ -> (fnord())
+ <<( fnord( "cheese" ) )>>
+ -> ( fnord( "cheese" ) )
+ <<( %*9dkj)>>
+ -> ( %*9dkj)
+
normal_lhs_block:
"" -> "VT_AND_IMPLICIT"
<< $id : Something( duration == "foo") >>
@@ -365,6 +1568,10 @@
<<Person( ( age ( > 60 && < 70 ) || ( > 50 && < 55 ) && hair == "black" ) || ( age == 40 && hair == "pink" ) || ( age == 12 && ( hair == "yellow" || hair == "blue" ) ))>>
-> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE Person) (|| (|| (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (|| (&& (> 60) (< 70)) (&& (> 50) (< 55)))) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT hair)) (== "black"))) (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (== 40)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT hair)) (== "pink")))) (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (== 12)) (|| (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT hair)) (== "yellow")) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT hair)) (== "blue"))))))))
+ <<org . drools/*comment*/ .Message( text not matches $c#comment
+. property )
+>>
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_DATA_TYPE org drools Message) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT text)) (matches not (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $c) (VT_ACCESSOR_ELEMENT property)))))))
constraints:
<<$var : attr -> ( $var.equals("xyz") )>>
Modified: labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/gUnitTreeWalkerTest.testsuite
===================================================================
--- labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/gUnitTreeWalkerTest.testsuite 2008-05-09 10:26:23 UTC (rev 19919)
+++ labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/gUnitTreeWalkerTest.testsuite 2008-05-09 17:01:54 UTC (rev 19920)
@@ -4,6 +4,985 @@
package org.drools.lang;
}
+package_statement walks package_statement:
+ "package foo"
+ OK
+
+ "package foo.bar.baz;"
+ OK
+
+compilation_unit walks compilation_unit:
+ ""
+ OK
+ "package foo; import com.foo.Bar; import com.foo.Baz;"
+ OK
+ <<rule empty
+
+then
+
+end>>
+ OK
+ <<#the purpose of this is to see what happens when we have some partially damaged syntax
+#as the IDE uses the parsers AST to work out completion suggestions.
+package test
+
+
+rule simple_rule
+ when
+ foo3 : Bar(
+
+>>
+ FAIL
+ <<package test.templates
+
+template Cheese
+ String name
+ Integer age
+end
+
+template "Wine"
+ String name
+ String year
+ String[] accolades
+end
+
+
+rule "a rule"
+ when
+ Cheese(name == "Stilton", age==2001)
+ Wine(name == "Grange", age == "1978", accolades contains "world champion")
+ then
+ baz();
+end>>
+ OK
+ <<package foo
+
+rule rule_one
+ when
+ Foo()
+ then
+ if (speed > speedLimit ? true : false;)
+ pullEmOver();
+end>>
+ OK
+ <<package foo
+
+function String[] yourFunction(String args[]) {
+ baz();
+}
+
+rule "new rule"
+
+ when
+ Something()
+ then
+ yourFunction(new String[3] {"a","b","c"});
+
+end>>
+ OK
+ <<
+rule almost_empty
+ when
+ then
+end>>
+ OK
+ <<rule "quoted string name"
+ when
+ then
+end>>
+ OK
+ <<
+rule rule1
+ no-loop false
+ when
+ not Cheese(type == "stilton")
+ then
+ funky();
+end>>
+ OK
+ <<
+rule rule1
+ auto-focus true
+ when
+ not Cheese(type == "stilton")
+ then
+ funky();
+end>>
+ OK
+ <<
+rule rule1
+ ruleflow-group "a group"
+ when
+ not Cheese(type == "stilton")
+ then
+ funky();
+end>>
+ OK
+ <<
+
+rule myrule
+ when
+ then
+ int i = 0;
+ i = 1;
+ i / 1;
+ i == 1;
+ i(i);
+ i = 'i';
+ i.i.i;
+ i\i;
+ i<i;
+ i>i;
+ i="i";
+ ++i;
+ i++;
+ --i;
+ i--;
+ i += i;
+ i -= i;
+ i *= i;
+ i /= i;
+ int i = 5;
+ for(int j; j<i; ++j) {
+ System.out.println(j);
+ }
+ Object o = new String("Hello");
+ String s = (String) o;
+
+end>>
+ OK
+
+ <<#check that it can handle true/false literals, and
+#negative numbers
+rule simple_rule
+ when
+ Foo(bar == false)
+ Foo(boo > -42)
+ Foo(boo > -42.42)
+ then
+ cons();
+end>>
+ OK
+
+ <<package org.drools.test;
+
+import org.drools.Cheese;
+
+rule "simple rule"
+ when
+ Cheese( )
+ then
+end >>
+ OK
+ <<
+rule blah
+
+ when
+
+ Col1() from something.doIt( foo,bar,42,"hello",{ a => "b", "something" => 42, "a" => foo, x => {x=>y}},"end", [a, "b", 42] )
+ Col2()
+ then
+ partay();
+end >>
+ OK
+ <<
+rule blah
+
+ when
+
+ Col1() from doIt( foo,bar,42,"hello",{ a => "b", "something" => 42, "a" => foo, x => {x=>y}},"end", [a, "b", 42] )
+ Col2()
+ then
+ partay();
+end >>
+ OK
+ <<
+rule blah
+
+ when
+
+ Col1() from something.doIt
+ Col2()
+ then
+ partay();
+end >>
+ OK
+ <<
+rule blah
+
+ when
+
+ Col1() from something.doIt["key"]
+ Col2()
+ then
+ partay();
+end >>
+ OK
+ <<rule blah
+ when
+ Col1() from doIt1( foo,bar,42,"hello",{ a => "b"}, [a, "b", 42] )
+ .doIt2(bar, [a, "b", 42]).field["key"]
+ Col2()
+ then
+ partay();
+end >>
+ OK
+ <<
+rule simple_rule
+ when
+ foo3 : Bar(a==3)
+ foo4 : Bar(a4:a==4)
+ Baz()
+ then
+ if ( a == b ) {
+ assert( foo3 );
+ } else {
+ retract( foo4 );
+ }
+ System.out.println( a4 );
+end>>
+ OK
+ <<#this is for showing off all the new multi restriction stuff
+
+
+
+
+rule simple_rule
+ when
+ Person(age > 30 && < 40)
+ Vehicle(type == "sedan" || == "wagon", age < 3)
+ then
+ consequence();
+end>>
+ OK
+ <<package la
+
+
+rule simple_rule
+ when
+ Baz()
+ then
+ //woot
+ first
+
+ #
+
+ /* lala
+
+ */
+ second
+end>>
+ OK
+ <<
+rule simple_rule
+ when
+ foo3 : Bar(a==3) ; foo4 : Bar(a4:a==4) ; Baz()
+ then
+ if ( a == b ) {
+ assert( foo3 );
+ } else {
+ retract( foo4 );
+ }
+ System.out.println( a4 );
+end>>
+ OK
+ <<
+rule simple_rule
+ when
+ not Cheese(type == "stilton")
+ then
+ funky();
+end>>
+ OK
+ <<package HR1
+
+import function abd.def.x
+import function qed.wah.*
+
+rule simple_rule
+ when
+ not ( Cheese(type == "stilton") )
+ exists ( Foo() )
+ then
+ funky();
+end>>
+ OK
+ <<package HR1
+
+rule simple_rule
+ when
+ not ( Cheese(type == "stilton") )
+ exists ( Foo() )
+ then
+ funky();
+end>>
+ OK
+ <<package HR2
+
+rule simple_rule
+ when
+ a : (not ( Cheese(type == "stilton") ))
+ exists ( Foo() )
+ then
+ funky();
+end>>
+ FAIL
+ <<
+
+query "simple_query"
+ foo3 : Bar(a==3)
+ foo4 : Bar(a4:a==4)
+ Baz()
+
+end>>
+ OK
+ <<
+package foo
+
+rule bar
+ when
+ Baz()
+ then
+ Boo()
+end
+
+query "simple_query"
+ foo3 : Bar(a==3)
+ foo4 : Bar(a4:a==4)
+ Baz()
+
+end
+
+rule bar2
+ when
+ Baz()
+ then
+ Boo()
+end
+
+query "simple_query2"
+ foo3 : Bar(a==3)
+ foo4 : Bar(a4:a==4)
+ Baz()
+
+end
+ >>
+ OK
+ <<package org.drools.test;
+
+import org.drools.integrationtests.Cheese;
+
+rule "Like Stilton"
+ when
+ Cheese( t:type == "stilton" )
+ then
+ System.out.println("I like " + t);
+end
+
+rule "Like Cheddar"
+ when
+ Cheese( t:type == "cheddar" )
+ then
+ System.out.println("I like " + t );
+end >>
+ OK
+ <<package org.drools.test;
+
+import org.drools.Cheese;
+
+rule "like cheddar"
+ when
+ Cheese( $type:type )
+ then
+ System.out.println("I like " + $type);
+end >>
+ OK
+ <<package org.drools.test;
+
+import org.drools.Cheese;
+import org.drools.Person;
+
+rule "Who likes Stilton"
+ when
+ Cheese($type : type == "stilton")
+ $person : Person($name : name == "bob", likes == $type)
+ then
+ System.out.println( $name + " likes " + $type);
+end >>
+ OK
+ <<
+import org.drools.Person
+
+rule simple_rule
+ when
+ Person(name == "mark") or
+ ( Person(type == "fan") and Cheese(type == "green") )
+ then
+ System.out.println( "Mark and Michael" + bar );
+end>>
+ OK
+ <<
+import org.drools.Person
+
+rule simple_rule
+ when
+ Person(name == "mark") && Cheese(type == "stilton")
+ Person(name == "mark") || Cheese(type == "stilton")
+ then
+ System.out.println( "Mark and Michael" );
+end>>
+ OK
+ <<
+import org.drools.Person
+
+rule simple_rule
+ when
+ foo : ( Person(name == "mark") or Person(type == "fan") )
+ Cheese(type == "green")
+ then
+ System.out.println( "Mark and Michael" + bar );
+end>>
+ OK
+ <<
+
+rule simple_rule
+ when
+ foo : ( Person(name == "mark")
+ or
+ Person(type == "fan") )
+ then
+ System.out.println( "Mark and Michael" + bar );
+end>>
+ OK
+ <<rule simple_rule
+ when
+ foo : (
+ Person(name == "mark") or Person(type == "fan")
+ )
+ then
+ System.out.println( "Mark and Michael" + bar );
+end>>
+ OK
+ <<
+rule simple_rule
+ when
+ ( (not Foo(x=="a") or Foo(x=="y") ) and ( Shoes() or Butt() ) )
+ then
+ go wild
+end>>
+ OK
+ <<
+rule simple_rule
+ when
+ eval(abc("foo") + 5)
+ Foo()
+ eval(qed())
+ Bar()
+ then
+ Kapow
+ Poof
+
+end>>
+ OK
+ <<
+rule simple_rule
+ when
+ Foo()
+ Bar()
+ eval(abc("foo"))
+ then
+ Kapow
+
+end>>
+ OK
+ <<
+rule simple_rule
+ when
+ Foo(name== (a + b))
+ then
+ Kapow
+
+end>>
+ OK
+ <<
+rule simple_rule
+ when
+ Person( $age2:age -> ($age2 == $age1+2 ) )
+ then
+ foo bar
+end>>
+ OK
+ <<package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List list;
+global java.lang.Integer five;
+
+rule "not rule test"
+ when
+ $person : Person( $likes:like )
+ not Cheese( type == $likes )
+ then
+ list.add( $person );
+end >>
+ OK
+ <<package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.lang.String foo
+global java.lang.Integer bar;
+
+rule baz
+ when
+ Cheese( )
+ then
+
+end >>
+ OK
+ <<
+import java.lang.String
+
+function String functionA(String s, Integer i) {
+
+ foo();
+
+}
+
+function void functionB() {
+ bar();
+}
+
+
+rule something
+ when
+ then
+end
+
+rule "one more thing"
+ when
+ then
+end
+
+
+
+ >>
+ OK
+ <<#this starts with a comment
+package foo.bar
+
+//and another comment
+
+/*
+yet
+ another
+ style
+*/
+
+rule "test"
+ when
+ then
+end>>
+ OK
+ <<
+
+
+rule simple_rule
+ #attributes keywork (and colon) is totally optional
+ salience 42
+ agenda-group "my_group"
+ no-loop
+ duration 42
+ activation-group "my_activation_group"
+ lock-on-active true
+ when
+ Foo()
+ then
+ bar();
+end>>
+ OK
+ <<
+
+
+rule simple_rule
+ attributes:
+ salience 42, agenda-group "my_group", no-loop, lock-on-active, duration 42, activation-group "my_activation_group"
+ when
+ Foo()
+ then
+ bar();
+end>>
+ OK
+ <<
+rule simple_rule
+ when
+ Foo(bar == Foo.BAR)
+ then
+end>>
+ OK
+ <<rule one
+ when
+ exists Foo()
+ exits Bar()
+ then
+end
+
+rule two
+ when
+ ford = ford = ford
+ then
+end>>
+ FAIL
+ <<
+rule "another test"
+ when
+ s : String()
+ eval(s.equals("foo") && s.startsWith("f"))
+
+
+ then
+ list.add( s );
+end >>
+ OK
+ <<package nesting;
+
+
+
+
+rule "test something"
+
+ when
+ p: Person( name soundslike "Michael" )
+ then
+ p.name = "goober"
+ System.out.println(p.name)
+end>>
+ OK
+ <<package com.foo;
+
+agenda-group "x"
+
+import goo.ber
+import wee.waa
+
+
+dialect "java"
+
+
+
+
+rule bar
+ when
+ then
+end
+
+rule baz
+ dialect "mvel"
+ when
+ then
+end>>
+ OK
+ <<
+package com.foo;
+
+import im.one
+
+import im.two
+
+rule foo
+ when
+ then
+end
+
+function cheeseIt() {
+
+}
+
+import im.three;
+
+rule bar
+ when
+ then
+end
+
+function uncheeseIt() {
+
+}
+
+import im.four;>>
+ OK
+ <<
+rule "1. Do Stuff!"
+ when
+ then
+end
+
+rule "2. Do More Stuff!"
+ when
+ then
+end>>
+ OK
+ <<
+rule simple_rule
+ when
+ Foo()
+ Bar()
+ eval(
+
+
+
+ abc(
+
+ "foo") +
+ 5
+
+
+
+
+ )
+ then
+ Kapow
+ Poof
+
+end>>
+ OK
+ <<
+rule simple_rule
+ when
+ eval(abc();)
+ then
+ Kapow
+ Poof
+end>>
+ OK
+ <<
+
+
+rule simple_rule
+ when
+ Foo(
+ bar == baz, la==laz
+ )
+ then
+ Kapow
+ Poof
+end
+ >>
+ OK
+ <<package org.drools.test;
+
+rule "Who likes Stilton"
+ when
+ com.cheeseco.Cheese($type : type == "stilton")
+ then
+ System.out.println( $name + " likes " + $type);
+end >>
+ OK
+ <<rule "AccumulateParserTest"
+when
+ Integer() from accumulate( Person( age > 21 ),
+ init( int x = 0; ),
+ action( x++; ),
+ result( new Integer(x) ) );
+then
+end>>
+ OK
+ <<rule "AccumulateParserTest"
+when
+ $counter:Integer() from accumulate( $person : Person( age > 21 ),
+ init( int x = 0; ),
+ action( x++; ),
+ result( new Integer(x) ) );
+then
+end>>
+ OK
+ <<rule "CollectParserTest"
+when
+ $personList : ArrayList() from collect( Person( age > 21 ) );
+then
+end>>
+ OK
+ <<rule "test_Quotes"
+ when
+ InitialFact()
+ then
+ String s = "\"\n\t\\";
+end >>
+ OK
+ <<rule "test nested CEs"
+ when
+ not ( State( $state : state ) and
+ not( Person( status == $state, $likes : likes ) and
+ Cheese( type == $likes ) ) )
+ Person( name == "Bob" )
+ ( Cheese( price == 10 ) or Cheese( type == "brie" ) )
+ then
+ results.add("OK");
+end>>
+ OK
+ <<rule "ForallParserTest"
+when
+ forall( Person( age > 21, $likes : likes )
+ Cheese( type == $likes ) );
+then
+end>>
+ OK
+ <<#testing 'in' operator
+
+rule simple_rule
+ when
+ Person(age > 30 && < 40)
+ Vehicle(type in ( "sedan", "wagon" ), age < 3)
+ then
+ consequence();
+end>>
+ OK
+ <<#testing not 'in' operator
+
+rule simple_rule
+ when
+ Person(age > 30 && < 40)
+ Vehicle(type not in ( "sedan", "wagon" ), age < 3)
+ then
+ consequence();
+end>>
+ OK
+ <<package org.drools;
+
+global java.util.List list;
+
+rule "rule1"
+when
+ Pattern1();
+ Pattern2() from x.y.z;
+then
+ System.out.println("Test");
+end;
+
+query "query1"
+ Pattern5();
+ Pattern6();
+ Pattern7();
+end;
+
+rule "rule2"
+when
+ Pattern3();
+ Pattern4() from collect( Pattern5() );
+then
+ System.out.println("Test");
+end;
+
+ >>
+ OK
+ <<package org.drools
+
+rule "Test Parse"
+
+when
+ eval( 3==3 )
+then
+ System.out.println("OK");
+end >>
+ OK
+ <<rule "AccumulateReverseParserTest"
+when
+ Integer() from accumulate( Person( age > 21 ),
+ init( int x = 0; ),
+ action( x++; ),
+ reverse( x--; ),
+ result( new Integer(x) ) );
+then
+end>>
+ OK
+ <<rule "AccumulateReverseParserTest"
+when
+ Number() from accumulate( Person( $age : age > 21 ),
+ average( $age ) );
+then
+end>>
+ OK
+ <<rule "CollectParserTest"
+when
+ #bellow statement makes no sense, but is useful to test parsing recursiveness
+ $personList : ArrayList() from collect( $p : Person( age > 21 || age < 10 ) from collect( People() from $town.getPeople() ) );
+then
+end
+
+ >>
+ OK
+ <<rule "AccumulateParserTest"
+when
+ #bellow statement makes no sense, but is useful to test parsing recursiveness
+ $personList : ArrayList() from accumulate( Person( $age : age > 21 || < 10 ) from collect( People() from $town.getPeople() ),
+ max( $age ) );
+then
+end
+
+ >>
+ OK
+ <<package org.drools;
+
+rule "testing OR CE"
+when
+ $p : Person( name == "bob" )
+ $c : Cheese( type == $p.likes ) || Cheese( price == 10 )
+then
+ // do something
+end >>
+ OK
+ <<rule "another test" salience 10 when eval( true ) then System.out.println(1); end>>
+ OK
+ <<rule "another test" salience 10 when eval( true ) then System.out.println(1);
+end>>
+ OK
+ <<rule "AccumulateMultiPatternParserTest"
+when
+ $counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),
+ init( int x = 0; ),
+ action( x++; ),
+ result( new Integer(x) ) );
+then
+end>>
+ OK
+ <<package org.drools;
+
+rule "test rule"
+ salience 10
+ when
+ $c: WorkerPerformanceContext(eval)$c.getBalanceMonth() != null))
+ then
+ retract($p);
+end
+ >>
+ FAIL
+ <<package org.drools;
+
+rule "Avoid NPE on wrong syntax"
+when
+ not( Cheese( ( type == "stilton", price == 10 ) || ( type == "brie", price == 15 ) ) from $cheeseList )
+then
+ System.out.println("OK");
+end>>
+ FAIL
+ <<package org.drools;
+
+rule "test pluggable operators"
+when
+ $a : EventA()
+ $b : EventB( this after[1,10] $a )
+ $c : EventC( this finishes $b )
+ $d : EventD( this not starts $a )
+ $e : EventE( this not before [1, 10] $b )
+then
+end>>
+ OK
+
+lhs walks pattern_source:
+ <<StockTick( symbol=="ACME") from entry-point StreamA>>
+ OK
+
lhs_block walks normal_lhs_block:
""
OK
@@ -350,6 +1329,10 @@
<<Person( ( age ( > 60 && < 70 ) || ( > 50 && < 55 ) && hair == "black" ) || ( age == 40 && hair == "pink" ) || ( age == 12 && ( hair == "yellow" || hair == "blue" ) ))>>
OK
+ <<org . drools/*comment*/ .Message( text not matches $c#comment
+. property )
+>>
+ OK
fact_expression walks constraints:
<<$var : attr -> ( $var.equals("xyz") )>>
More information about the jboss-svn-commits
mailing list