[jboss-svn-commits] JBL Code SVN: r20314 - 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
Wed Jun 4 20:03:08 EDT 2008
Author: porcelli
Date: 2008-06-04 20:03:07 -0400 (Wed, 04 Jun 2008)
New Revision: 20314
Modified:
labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/TestDRL.java
labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/TestTree2TestDRL.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:
gUnit files now fully commented
Modified: labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/TestDRL.java
===================================================================
--- labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/TestDRL.java 2008-06-04 20:26:24 UTC (rev 20313)
+++ labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/TestDRL.java 2008-06-05 00:03:07 UTC (rev 20314)
@@ -1,20 +1,11 @@
package org.drools.lang;
-import java.io.IOException;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
-import java.io.PrintStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
import junit.framework.TestCase;
+import java.io.*;
+import java.lang.reflect.*;
+import org.antlr.runtime.*;
+import org.antlr.runtime.tree.*;
-import org.antlr.runtime.ANTLRFileStream;
-import org.antlr.runtime.ANTLRStringStream;
-import org.antlr.runtime.CharStream;
-import org.antlr.runtime.CommonTokenStream;
-import org.antlr.runtime.tree.CommonTree;
-
public class TestDRL extends TestCase {
String stdout;
String stderr;
@@ -821,622 +812,622 @@
}
public void testNormal_lhs_block90() throws Exception {
- // test input: " $id : Something( duration == \"foo\") "
- Object retval = execParser("normal_lhs_block", " $id : Something( duration == \"foo\") ", false);
+ // 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);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING $id (VT_FACT (VT_PATTERN_TYPE Something) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT duration)) (== \"foo\"))))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Country) (VT_BIND_FIELD $cities (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT city)))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT city)) (memberOf (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $cities)))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
- Object expecting = "FAIL";
+ // 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);
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Country) (VT_BIND_FIELD $cities (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT city)))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT city)) (memberOf not (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $cities)))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: " Person( age < 42 && location==\"atlanta\") "
+ Object retval = execParser("normal_lhs_block", " Person( age < 42 && location==\"atlanta\") ", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_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\")))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 42)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== \"atlanta\"))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
public void testNormal_lhs_block93() throws Exception {
- // test input: "Foo()"
- Object retval = execParser("normal_lhs_block", "Foo()", false);
+ // test input: " Person( age < 42 || location==\"atlanta\") "
+ Object retval = execParser("normal_lhs_block", " Person( age < 42 || location==\"atlanta\") ", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (|| (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 42)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== \"atlanta\"))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
public void testNormal_lhs_block94() throws Exception {
- // test input: "not Cheese(type == \"stilton\")"
- Object retval = execParser("normal_lhs_block", "not Cheese(type == \"stilton\")", false);
+ // 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);
- Object expecting = "(VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\"))))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (|| (|| (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 42)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== \"atlanta\"))) (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 20)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== \"Seatle\")))) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== \"Chicago\"))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // 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);
- Object expecting = "(VT_AND_IMPLICIT (or (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 42)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== \"atlanta\")))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"bob\"))))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (|| (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 42)) (|| (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== \"atlanta\")) (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 20)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== \"Seatle\"))))) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== \"Chicago\"))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // 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);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT bar)) (== false)))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT boo)) (> -42)))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT boo)) (> -42.42)))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (|| (|| (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (== 70)) (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\"))))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
public void testNormal_lhs_block97() throws Exception {
- // test input: "Cheese( )"
- Object retval = execParser("normal_lhs_block", "Cheese( )", false);
+ // 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);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (|| (matches \"mark\") (matches \"bob\"))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // 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);
- Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Col2))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE City) (VT_BIND_FIELD $city (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT city)))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Country) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT cities)) (contains not (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $city)))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: " Message( text not matches '[abc]*' ) "
+ Object retval = execParser("normal_lhs_block", " Message( text not matches '[abc]*' ) ", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Col2))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Message) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT text)) (matches not '[abc]*')))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "Foo( bar > 1 || == 1 )"
+ Object retval = execParser("normal_lhs_block", "Foo( bar > 1 || == 1 )", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Col1))) (VT_FROM_SOURCE something (. doIt))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Col2))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT bar)) (|| (> 1) (== 1))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // 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);
- Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Col1))) (VT_FROM_SOURCE something (. doIt [\"key\"]))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Col2))))";
+ Object expecting = "(VT_AND_IMPLICIT (or (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person)))) (and (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Meat))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Wine))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // 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);
- Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Col2))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_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\"))))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // 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_BINDING foo3 (VT_FACT (VT_PATTERN_TYPE Bar) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 3))))) (VT_PATTERN (VT_FACT_BINDING foo4 (VT_FACT (VT_PATTERN_TYPE Bar) (VT_BIND_FIELD a4 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 4)))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Baz))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_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 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);
+ // test input: " $id : Something( duration == \"foo\") "
+ Object retval = execParser("normal_lhs_block", " $id : Something( duration == \"foo\") ", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Vehicle) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (|| (== \"sedan\") (== \"wagon\"))) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 3)))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING $id (VT_FACT (VT_PATTERN_TYPE Something) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT duration)) (== \"foo\"))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo3 (VT_FACT (VT_PATTERN_TYPE Bar) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 3))))) (VT_PATTERN (VT_FACT_BINDING foo4 (VT_FACT (VT_PATTERN_TYPE Bar) (VT_BIND_FIELD a4 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 4)))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Baz))))";
+ // test input: "foo3 : Bar("
+ Object retval = execParser("normal_lhs_block", "foo3 : Bar(", false);
+ Object actual = examineParserExecResult(28, retval);
+ Object expecting = "FAIL";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\nCheese(name == \"Stilton\", age==2001)\nWine(name == \"Grange\", age == \"1978\", accolades contains \"world champion\")\n"
+ Object retval = execParser("normal_lhs_block", "\nCheese(name == \"Stilton\", age==2001)\nWine(name == \"Grange\", age == \"1978\", accolades contains \"world champion\")\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\"))))) (exists (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo)))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_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\")))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "Foo()"
+ Object retval = execParser("normal_lhs_block", "Foo()", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\"))))) (exists (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo)))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
- Object expecting = "FAIL";
+ // test input: "not Cheese(type == \"stilton\")"
+ Object retval = execParser("normal_lhs_block", "not Cheese(type == \"stilton\")", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\"))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
public void testNormal_lhs_block109() throws Exception {
- // test input: " Cheese( t:type == \"cheddar\" ) "
- Object retval = execParser("normal_lhs_block", " Cheese( t:type == \"cheddar\" ) ", false);
+ // test input: "\nPerson(age < 42, location==\"atlanta\") \nor\nPerson(name==\"bob\")\n"
+ Object retval = execParser("normal_lhs_block", "\nPerson(age < 42, location==\"atlanta\") \nor\nPerson(name==\"bob\")\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_BIND_FIELD t (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"cheddar\"))))))";
+ Object expecting = "(VT_AND_IMPLICIT (or (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 42)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== \"atlanta\")))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"bob\"))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
public void testNormal_lhs_block110() throws Exception {
- // test input: "Cheese( $type:type )"
- Object retval = execParser("normal_lhs_block", "Cheese( $type:type )", false);
+ // test input: "\nFoo(bar == false)\nFoo(boo > -42)\nFoo(boo > -42.42)\n"
+ Object retval = execParser("normal_lhs_block", "\nFoo(bar == false)\nFoo(boo > -42)\nFoo(boo > -42.42)\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_BIND_FIELD $type (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)))))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT bar)) (== false)))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT boo)) (> -42)))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT boo)) (> -42.42)))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "Cheese( )"
+ Object retval = execParser("normal_lhs_block", "Cheese( )", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_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))))))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\nCol1() from something.doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\nCol2()\n"
+ Object retval = execParser("normal_lhs_block", "\nCol1() from something.doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\nCol2()\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (or (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"mark\")))) (and (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"fan\")))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"green\")))))))";
+ Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Col2))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\nCol1() from doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\nCol2()\n"
+ Object retval = execParser("normal_lhs_block", "\nCol1() from doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\nCol2()\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (&& (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"mark\")))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\"))))) (|| (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"mark\")))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\"))))))";
+ Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Col2))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\nCol1() from something.doIt\nCol2()\n"
+ Object retval = execParser("normal_lhs_block", "\nCol1() from something.doIt\nCol2()\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo (or (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"mark\"))) (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"fan\")))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"green\")))))";
+ Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Col1))) (VT_FROM_SOURCE something (. doIt))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Col2))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\nCol1() from something.doIt[\"key\"]\nCol2()\n"
+ Object retval = execParser("normal_lhs_block", "\nCol1() from something.doIt[\"key\"]\nCol2()\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo (or (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"mark\"))) (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"fan\")))))))";
+ Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Col1))) (VT_FROM_SOURCE something (. doIt [\"key\"]))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Col2))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\nCol1() from doIt1( foo,bar,42,\"hello\",{ a => \"b\"}, [a, \"b\", 42] )\n .doIt2(bar, [a, \"b\", 42]).field[\"key\"]\nCol2()\n"
+ Object retval = execParser("normal_lhs_block", "\nCol1() from doIt1( foo,bar,42,\"hello\",{ a => \"b\"}, [a, \"b\", 42] )\n .doIt2(bar, [a, \"b\", 42]).field[\"key\"]\nCol2()\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo (or (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"mark\"))) (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"fan\")))))))";
+ Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Col2))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\nfoo3 : Bar(a==3)\nfoo4 : Bar(a4:a==4)\nBaz()\n"
+ Object retval = execParser("normal_lhs_block", "\nfoo3 : Bar(a==3)\nfoo4 : Bar(a4:a==4)\nBaz()\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (and (or (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT x)) (== \"a\"))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT x)) (== \"y\"))))) (or (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Shoes))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Butt))))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo3 (VT_FACT (VT_PATTERN_TYPE Bar) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 3))))) (VT_PATTERN (VT_FACT_BINDING foo4 (VT_FACT (VT_PATTERN_TYPE Bar) (VT_BIND_FIELD a4 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 4)))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Baz))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\nPerson(age > 30 && < 40)\nVehicle(type == \"sedan\" || == \"wagon\", age < 3)\n"
+ Object retval = execParser("normal_lhs_block", "\nPerson(age > 30 && < 40)\nVehicle(type == \"sedan\" || == \"wagon\", age < 3)\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (eval (abc(\"foo\") + 5)) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo))) (eval (qed())) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Bar))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Vehicle) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (|| (== \"sedan\") (== \"wagon\"))) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 3)))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // 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);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Bar))) (eval (abc(\"foo\"))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo3 (VT_FACT (VT_PATTERN_TYPE Bar) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 3))))) (VT_PATTERN (VT_FACT_BINDING foo4 (VT_FACT (VT_PATTERN_TYPE Bar) (VT_BIND_FIELD a4 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 4)))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Baz))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
public void testNormal_lhs_block120() throws Exception {
- // test input: "Foo(name== (a + b))"
- Object retval = execParser("normal_lhs_block", "Foo(name== (a + b))", false);
+ // test input: "\nnot ( Cheese(type == \"stilton\") )\nexists ( Foo() )\n"
+ Object retval = execParser("normal_lhs_block", "\nnot ( Cheese(type == \"stilton\") )\nexists ( Foo() )\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== (a + b))))))";
+ Object expecting = "(VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\"))))) (exists (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo)))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\nnot ( Cheese(type == \"stilton\") )\nexists ( Foo() )\n"
+ Object retval = execParser("normal_lhs_block", "\nnot ( Cheese(type == \"stilton\") )\nexists ( Foo() )\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_BIND_FIELD $age2 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)))) (-> ($age2 == $age1+2 )))))";
+ Object expecting = "(VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\"))))) (exists (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo)))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT bar)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT Foo) (VT_ACCESSOR_ELEMENT BAR)))))))";
+ // test input: "\na : (not ( Cheese(type == \"stilton\") ))\nexists ( Foo() )\n"
+ Object retval = execParser("normal_lhs_block", "\na : (not ( Cheese(type == \"stilton\") ))\nexists ( Foo() )\n", false);
+ Object actual = examineParserExecResult(28, retval);
+ Object expecting = "FAIL";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: " Cheese( t:type == \"cheddar\" ) "
+ Object retval = execParser("normal_lhs_block", " Cheese( t:type == \"cheddar\" ) ", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING p (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (soundslike \"Michael\"))))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_BIND_FIELD t (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"cheddar\"))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "Cheese( $type:type )"
+ Object retval = execParser("normal_lhs_block", "Cheese( $type:type )", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo))) (VT_PATTERN (VT_FACT (VT_PATTERN_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 )))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_BIND_FIELD $type (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
public void testNormal_lhs_block125() throws Exception {
- // test input: "eval(abc();)"
- Object retval = execParser("normal_lhs_block", "eval(abc();)", false);
- Object actual = examineParserExecResult(28, retval);
- Object expecting = "FAIL";
+ // test input: "\n Cheese($type : type == \"stilton\")\n $person : Person($name : name == \"bob\", likes == $type) \n"
+ Object retval = execParser("normal_lhs_block", "\n Cheese($type : type == \"stilton\")\n $person : Person($name : name == \"bob\", likes == $type) \n", false);
+ Object actual = examineParserExecResult(10, retval);
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_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))))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\nPerson(name == \"mark\") or \n( Person(type == \"fan\") and Cheese(type == \"green\") )\n"
+ Object retval = execParser("normal_lhs_block", "\nPerson(name == \"mark\") or \n( Person(type == \"fan\") and Cheese(type == \"green\") )\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_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)))))))";
+ Object expecting = "(VT_AND_IMPLICIT (or (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"mark\")))) (and (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"fan\")))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"green\")))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\nPerson(name == \"mark\") && Cheese(type == \"stilton\")\nPerson(name == \"mark\") || Cheese(type == \"stilton\")\n"
+ Object retval = execParser("normal_lhs_block", "\nPerson(name == \"mark\") && Cheese(type == \"stilton\")\nPerson(name == \"mark\") || Cheese(type == \"stilton\")\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE com cheeseco Cheese) (VT_BIND_FIELD $type (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\"))))))";
+ Object expecting = "(VT_AND_IMPLICIT (&& (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"mark\")))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\"))))) (|| (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"mark\")))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\"))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\nfoo : ( Person(name == \"mark\") or Person(type == \"fan\") ) \nCheese(type == \"green\")\n"
+ Object retval = execParser("normal_lhs_block", "\nfoo : ( Person(name == \"mark\") or Person(type == \"fan\") ) \nCheese(type == \"green\")\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Integer))) (accumulate (VT_PATTERN (VT_FACT (VT_PATTERN_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) ))))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo (or (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"mark\"))) (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"fan\")))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"green\")))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\nfoo : ( Person(name == \"mark\") \n\tor \n\tPerson(type == \"fan\") )\n"
+ Object retval = execParser("normal_lhs_block", "\nfoo : ( Person(name == \"mark\") \n\tor \n\tPerson(type == \"fan\") )\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $counter (VT_FACT (VT_PATTERN_TYPE Integer)))) (accumulate (VT_PATTERN (VT_FACT_BINDING $person (VT_FACT (VT_PATTERN_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) ))))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo (or (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"mark\"))) (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"fan\")))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\nfoo : ( \n\tPerson(name == \"mark\") or Person(type == \"fan\") \n\t)\n"
+ Object retval = execParser("normal_lhs_block", "\nfoo : ( \n\tPerson(name == \"mark\") or Person(type == \"fan\") \n\t)\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $personList (VT_FACT (VT_PATTERN_TYPE ArrayList)))) (collect (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21)))))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo (or (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"mark\"))) (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"fan\")))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\n ( (not Foo(x==\"a\") or Foo(x==\"y\") ) and ( Shoes() or Butt() ) )\n"
+ Object retval = execParser("normal_lhs_block", "\n ( (not Foo(x==\"a\") or Foo(x==\"y\") ) and ( Shoes() or Butt() ) )\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (not (and (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE State) (VT_BIND_FIELD $state (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT state)))))) (not (and (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $likes)))))))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"Bob\")))) (or (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT price)) (== 10)))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"brie\"))))))";
+ Object expecting = "(VT_AND_IMPLICIT (and (or (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT x)) (== \"a\"))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT x)) (== \"y\"))))) (or (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Shoes))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Butt))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\neval(abc(\"foo\") + 5)\nFoo()\neval(qed())\nBar()\n"
+ Object retval = execParser("normal_lhs_block", "\neval(abc(\"foo\") + 5)\nFoo()\neval(qed())\nBar()\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (forall (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $likes))))))))";
+ Object expecting = "(VT_AND_IMPLICIT (eval (abc(\"foo\") + 5)) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo))) (eval (qed())) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Bar))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\nFoo()\nBar()\neval(abc(\"foo\"))\n"
+ Object retval = execParser("normal_lhs_block", "\nFoo()\nBar()\neval(abc(\"foo\"))\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Country) (VT_BIND_FIELD $cities (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT city)))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT city)) (memberOf (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $cities)))))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Bar))) (eval (abc(\"foo\"))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "Foo(name== (a + b))"
+ Object retval = execParser("normal_lhs_block", "Foo(name== (a + b))", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Country) (VT_BIND_FIELD $cities (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT city)))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT city)) (memberOf not (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $cities)))))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== (a + b))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // 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);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Vehicle) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (in \"sedan\" \"wagon\")) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 3)))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_BIND_FIELD $age2 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)))) (-> ($age2 == $age1+2 )))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "Foo(bar == Foo.BAR)"
+ Object retval = execParser("normal_lhs_block", "Foo(bar == Foo.BAR)", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_PATTERN_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)))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT bar)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT Foo) (VT_ACCESSOR_ELEMENT BAR)))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\np: Person( name soundslike \"Michael\" )\n"
+ Object retval = execParser("normal_lhs_block", "\np: Person( name soundslike \"Michael\" )\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 42)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== \"atlanta\"))))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING p (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (soundslike \"Michael\"))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\nFoo()\nBar()\neval(\n\n\n\n abc(\n \n \"foo\") + \n 5\n \n \n \n \n )\n"
+ Object retval = execParser("normal_lhs_block", "\nFoo()\nBar()\neval(\n\n\n\n abc(\n \n \"foo\") + \n 5\n \n \n \n \n )\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (|| (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 42)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== \"atlanta\"))))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Bar))) (eval (\n\n\n\n abc(\n \n \"foo\") + \n 5\n \n \n \n \n )))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (|| (|| (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 42)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== \"atlanta\"))) (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 20)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== \"Seatle\")))) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== \"Chicago\"))))))";
+ // test input: "eval(abc();)"
+ Object retval = execParser("normal_lhs_block", "eval(abc();)", false);
+ Object actual = examineParserExecResult(28, retval);
+ Object expecting = "FAIL";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\nFoo(\n bar == baz, la==laz\n )\n "
+ Object retval = execParser("normal_lhs_block", "\nFoo(\n bar == baz, la==laz\n )\n ", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (|| (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 42)) (|| (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== \"atlanta\")) (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 20)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== \"Seatle\"))))) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== \"Chicago\"))))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_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)))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // 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);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (|| (|| (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (== 70)) (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\"))))))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE com cheeseco Cheese) (VT_BIND_FIELD $type (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"stilton\"))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\n Integer() from accumulate( Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\n"
+ Object retval = execParser("normal_lhs_block", "\n Integer() from accumulate( Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (|| (matches \"mark\") (matches \"bob\"))))))";
+ Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Integer))) (accumulate (VT_PATTERN (VT_FACT (VT_PATTERN_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) ))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // 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"
+ 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", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE City) (VT_BIND_FIELD $city (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT city)))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Country) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT cities)) (contains not (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $city)))))))";
+ Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $counter (VT_FACT (VT_PATTERN_TYPE Integer)))) (accumulate (VT_PATTERN (VT_FACT_BINDING $person (VT_FACT (VT_PATTERN_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) ))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // 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);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Message) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT text)) (matches not '[abc]*')))))";
+ Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $personList (VT_FACT (VT_PATTERN_TYPE ArrayList)))) (collect (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21)))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
public void testNormal_lhs_block145() throws Exception {
- // test input: "Foo( bar > 1 || == 1 )"
- Object retval = execParser("normal_lhs_block", "Foo( bar > 1 || == 1 )", false);
+ // test input: "\n\tnot ( State( $state : state ) and\n not( Person( status == $state, $likes : likes ) and\n Cheese( type == $likes ) ) )\n Person( name == \"Bob\" )\n ( Cheese( price == 10 ) or Cheese( type == \"brie\" ) )\n"
+ Object retval = execParser("normal_lhs_block", "\n\tnot ( State( $state : state ) and\n not( Person( status == $state, $likes : likes ) and\n Cheese( type == $likes ) ) )\n Person( name == \"Bob\" )\n ( Cheese( price == 10 ) or Cheese( type == \"brie\" ) )\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT bar)) (|| (> 1) (== 1))))))";
+ Object expecting = "(VT_AND_IMPLICIT (not (and (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE State) (VT_BIND_FIELD $state (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT state)))))) (not (and (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $likes)))))))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"Bob\")))) (or (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT price)) (== 10)))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== \"brie\"))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\n forall( Person( age > 21, $likes : likes )\n Cheese( type == $likes ) );\n"
+ Object retval = execParser("normal_lhs_block", "\n forall( Person( age > 21, $likes : likes )\n Cheese( type == $likes ) );\n", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern1))) (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern2))) (VT_FROM_SOURCE x (. y (. z)))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern5))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern6))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern7))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern3))) (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern4))) (collect (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern5))))))";
+ Object expecting = "(VT_AND_IMPLICIT (forall (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $likes))))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
public void testNormal_lhs_block147() throws Exception {
- // test input: " eval( 3==3 ) "
- Object retval = execParser("normal_lhs_block", " eval( 3==3 ) ", false);
+ // 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);
- Object expecting = "(VT_AND_IMPLICIT (eval ( 3==3 )))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Vehicle) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (in \"sedan\" \"wagon\")) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 3)))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // 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);
- Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Integer))) (accumulate (VT_PATTERN (VT_FACT (VT_PATTERN_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) ))))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_PATTERN_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)))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\n\t\tPattern1();\n\t\tPattern2() from x.y.z;\n\t\tPattern5();\n\t\tPattern6();\n\t\tPattern7();\n\t\tPattern3();\n\t\tPattern4() from collect( Pattern5() );\n\t\t"
+ Object retval = execParser("normal_lhs_block", "\n\t\tPattern1();\n\t\tPattern2() from x.y.z;\n\t\tPattern5();\n\t\tPattern6();\n\t\tPattern7();\n\t\tPattern3();\n\t\tPattern4() from collect( Pattern5() );\n\t\t", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Number))) (accumulate (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_BIND_FIELD $age (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21))))) (VT_ACCUMULATE_ID_CLAUSE average ( $age )))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern1))) (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern2))) (VT_FROM_SOURCE x (. y (. z)))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern5))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern6))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern7))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern3))) (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern4))) (collect (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern5))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: " eval( 3==3 ) "
+ Object retval = execParser("normal_lhs_block", " eval( 3==3 ) ", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $personList (VT_FACT (VT_PATTERN_TYPE ArrayList)))) (collect (from (VT_PATTERN (VT_FACT_BINDING $p (VT_FACT (VT_PATTERN_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_PATTERN_TYPE People))) (VT_FROM_SOURCE $town (. getPeople ()))))))))";
+ Object expecting = "(VT_AND_IMPLICIT (eval ( 3==3 )))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\n\t\tInteger() from accumulate( Person( age > 21 ),\n\t\t init( int x = 0; ),\n\t\t action( x++; ),\n\t\t reverse( x--; ),\n\t\t result( new Integer(x) ) );\n\t\t"
+ Object retval = execParser("normal_lhs_block", "\n\t\tInteger() from accumulate( Person( age > 21 ),\n\t\t init( int x = 0; ),\n\t\t action( x++; ),\n\t\t reverse( x--; ),\n\t\t result( new Integer(x) ) );\n\t\t", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $personList (VT_FACT (VT_PATTERN_TYPE ArrayList)))) (accumulate (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_BIND_FIELD $age (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (|| (> 21) (< 10)))))) (collect (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE People))) (VT_FROM_SOURCE $town (. getPeople ()))))) (VT_ACCUMULATE_ID_CLAUSE max ( $age )))))";
+ Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Integer))) (accumulate (VT_PATTERN (VT_FACT (VT_PATTERN_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) ))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\n\t Number() from accumulate( Person( $age : age > 21 ),\n\t average( $age ) );\n\t\t"
+ Object retval = execParser("normal_lhs_block", "\n\t Number() from accumulate( Person( $age : age > 21 ),\n\t average( $age ) );\n\t\t", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING $p (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"bob\"))))) (|| (VT_PATTERN (VT_FACT_BINDING $c (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT price)) (== 10))))))";
+ Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Number))) (accumulate (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_BIND_FIELD $age (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21))))) (VT_ACCUMULATE_ID_CLAUSE average ( $age )))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\n\t #bellow statement makes no sense, but is useful to test parsing recursiveness\n\t $personList : ArrayList() from collect( $p : Person( age > 21 || age < 10 ) from collect( People() from $town.getPeople() ) );\n\t\t"
+ Object retval = execParser("normal_lhs_block", "\n\t #bellow statement makes no sense, but is useful to test parsing recursiveness\n\t $personList : ArrayList() from collect( $p : Person( age > 21 || age < 10 ) from collect( People() from $town.getPeople() ) );\n\t\t", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (or (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person)))) (and (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Meat))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Wine))))))";
+ Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $personList (VT_FACT (VT_PATTERN_TYPE ArrayList)))) (collect (from (VT_PATTERN (VT_FACT_BINDING $p (VT_FACT (VT_PATTERN_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_PATTERN_TYPE People))) (VT_FROM_SOURCE $town (. getPeople ()))))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\n\t $personList : ArrayList() from accumulate( Person( $age : age > 21 || < 10 ) from collect( People() from $town.getPeople() ),\n\t max( $age ) );\n\t\t"
+ Object retval = execParser("normal_lhs_block", "\n\t $personList : ArrayList() from accumulate( Person( $age : age > 21 || < 10 ) from collect( People() from $town.getPeople() ),\n\t max( $age ) );\n\t\t", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $counter (VT_FACT (VT_PATTERN_TYPE Integer)))) (accumulate (and (VT_PATTERN (VT_FACT_BINDING $person (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21))))) (VT_PATTERN (VT_FACT (VT_PATTERN_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) ))))))";
+ Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $personList (VT_FACT (VT_PATTERN_TYPE ArrayList)))) (accumulate (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_BIND_FIELD $age (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (|| (> 21) (< 10)))))) (collect (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE People))) (VT_FROM_SOURCE $town (. getPeople ()))))) (VT_ACCUMULATE_ID_CLAUSE max ( $age )))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\n\t $p : Person( name == \"bob\" )\n\t $c : Cheese( type == $p.likes ) || Cheese( price == 10 )\n\t "
+ Object retval = execParser("normal_lhs_block", "\n\t $p : Person( name == \"bob\" )\n\t $c : Cheese( type == $p.likes ) || Cheese( price == 10 )\n\t ", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING $a (VT_FACT (VT_PATTERN_TYPE EventA)))) (VT_PATTERN (VT_FACT_BINDING $b (VT_FACT (VT_PATTERN_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_PATTERN_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_PATTERN_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_PATTERN_TYPE EventE) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT this)) (before not [1, 10] (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $b))))))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING $p (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== \"bob\"))))) (|| (VT_PATTERN (VT_FACT_BINDING $c (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT price)) (== 10))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\n\t\t $counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),\n\t\t init( int x = 0; ),\n\t\t action( x++; ),\n\t\t result( new Integer(x) ) );\n\t\t\t"
+ Object retval = execParser("normal_lhs_block", "\n\t\t $counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),\n\t\t init( int x = 0; ),\n\t\t action( x++; ),\n\t\t result( new Integer(x) ) );\n\t\t\t", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE StockTick) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT symbol)) (== \"ACME\")))) (entry-point StreamA)))";
+ Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $counter (VT_FACT (VT_PATTERN_TYPE Integer)))) (accumulate (and (VT_PATTERN (VT_FACT_BINDING $person (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21))))) (VT_PATTERN (VT_FACT (VT_PATTERN_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) ))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // test input: "\n\t\t $a : EventA()\n\t\t $b : EventB( this after[1,10] $a )\n\t\t $c : EventC( this finishes $b )\n\t\t $d : EventD( this not starts $a )\n\t\t $e : EventE( this not before [1, 10] $b )\n\t\t\t"
+ Object retval = execParser("normal_lhs_block", "\n\t\t $a : EventA()\n\t\t $b : EventB( this after[1,10] $a )\n\t\t $c : EventC( this finishes $b )\n\t\t $d : EventD( this not starts $a )\n\t\t $e : EventE( this not before [1, 10] $b )\n\t\t\t", false);
Object actual = examineParserExecResult(10, retval);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_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\"))))))))";
+ Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING $a (VT_FACT (VT_PATTERN_TYPE EventA)))) (VT_PATTERN (VT_FACT_BINDING $b (VT_FACT (VT_PATTERN_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_PATTERN_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_PATTERN_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_PATTERN_TYPE EventE) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT this)) (before not [1, 10] (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $b))))))))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
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);
+ // 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);
- Object expecting = "(VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_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)))))))";
+ Object expecting = "(VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE StockTick) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT symbol)) (== \"ACME\")))) (entry-point StreamA)))";
assertEquals("testing rule "+"normal_lhs_block", expecting, actual);
}
@@ -1533,7 +1524,7 @@
if ( parser.hasErrors() ) {
this.stderr = parser.getErrors().toString();
return this.stderr;
- }
+ }
if ( stdoutVacuum.toString().length()>0 ) {
this.stdout = stdoutVacuum.toString();
}
Modified: labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/TestTree2TestDRL.java
===================================================================
--- labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/TestTree2TestDRL.java 2008-06-04 20:26:24 UTC (rev 20313)
+++ labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/TestTree2TestDRL.java 2008-06-05 00:03:07 UTC (rev 20314)
@@ -1,21 +1,11 @@
package org.drools.lang;
-import java.io.IOException;
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
-import java.io.PrintStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
import junit.framework.TestCase;
+import java.io.*;
+import java.lang.reflect.*;
+import org.antlr.runtime.*;
+import org.antlr.runtime.tree.*;
-import org.antlr.runtime.ANTLRFileStream;
-import org.antlr.runtime.ANTLRStringStream;
-import org.antlr.runtime.CharStream;
-import org.antlr.runtime.CommonTokenStream;
-import org.antlr.runtime.tree.CommonTree;
-import org.antlr.runtime.tree.CommonTreeNodeStream;
-
public class TestTree2TestDRL extends TestCase {
String stdout;
String stderr;
@@ -786,8 +776,8 @@
}
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);
+ // 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);
Object expecting = "OK";
@@ -795,17 +785,17 @@
}
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);
- Object expecting = "FAIL";
+ // 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);
+ Object expecting = "OK";
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
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);
+ // 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);
Object expecting = "OK";
@@ -813,8 +803,8 @@
}
public void testLhs_block_walks_Normal_lhs_block89() throws Exception {
- // test input: "Foo()"
- Object retval = execTreeParser("lhs_block", "normal_lhs_block", "Foo()", false);
+ // 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);
Object expecting = "OK";
@@ -822,8 +812,8 @@
}
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);
+ // 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);
Object expecting = "OK";
@@ -831,8 +821,8 @@
}
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);
+ // 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);
Object expecting = "OK";
@@ -840,8 +830,8 @@
}
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);
+ // 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);
Object expecting = "OK";
@@ -849,8 +839,8 @@
}
public void testLhs_block_walks_Normal_lhs_block93() throws Exception {
- // test input: "Cheese( )"
- Object retval = execTreeParser("lhs_block", "normal_lhs_block", "Cheese( )", false);
+ // 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);
Object expecting = "OK";
@@ -858,8 +848,8 @@
}
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);
+ // 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);
Object expecting = "OK";
@@ -867,8 +857,8 @@
}
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);
+ // 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);
Object expecting = "OK";
@@ -876,8 +866,8 @@
}
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);
+ // test input: "Foo( bar > 1 || == 1 )"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "Foo( bar > 1 || == 1 )", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -885,8 +875,8 @@
}
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);
+ // 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);
Object expecting = "OK";
@@ -894,8 +884,8 @@
}
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);
+ // 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);
Object expecting = "OK";
@@ -903,8 +893,8 @@
}
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);
+ // 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";
@@ -912,8 +902,8 @@
}
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);
+ // test input: " $id : Something( duration == \"foo\") "
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", " $id : Something( duration == \"foo\") ", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -921,17 +911,17 @@
}
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);
- Object expecting = "OK";
+ // test input: "foo3 : Bar("
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "foo3 : Bar(", false);
+ Object actual = examineParserExecResult(28, retval);
+ Object expecting = "FAIL";
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
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);
+ // test input: "\nCheese(name == \"Stilton\", age==2001)\nWine(name == \"Grange\", age == \"1978\", accolades contains \"world champion\")\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\nCheese(name == \"Stilton\", age==2001)\nWine(name == \"Grange\", age == \"1978\", accolades contains \"world champion\")\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -939,8 +929,8 @@
}
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);
+ // test input: "Foo()"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "Foo()", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -948,17 +938,17 @@
}
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);
- Object expecting = "FAIL";
+ // test input: "not Cheese(type == \"stilton\")"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "not Cheese(type == \"stilton\")", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
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);
+ // test input: "\nPerson(age < 42, location==\"atlanta\") \nor\nPerson(name==\"bob\")\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\nPerson(age < 42, location==\"atlanta\") \nor\nPerson(name==\"bob\")\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -966,8 +956,8 @@
}
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);
+ // test input: "\nFoo(bar == false)\nFoo(boo > -42)\nFoo(boo > -42.42)\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\nFoo(bar == false)\nFoo(boo > -42)\nFoo(boo > -42.42)\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -975,8 +965,8 @@
}
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);
+ // test input: "Cheese( )"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "Cheese( )", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -984,8 +974,8 @@
}
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);
+ // test input: "\nCol1() from something.doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\nCol2()\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\nCol1() from something.doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\nCol2()\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -993,8 +983,8 @@
}
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);
+ // test input: "\nCol1() from doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\nCol2()\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\nCol1() from doIt( foo,bar,42,\"hello\",{ a => \"b\", \"something\" => 42, \"a\" => foo, x => {x=>y}},\"end\", [a, \"b\", 42] )\nCol2()\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1002,8 +992,8 @@
}
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);
+ // test input: "\nCol1() from something.doIt\nCol2()\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\nCol1() from something.doIt\nCol2()\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1011,8 +1001,8 @@
}
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);
+ // test input: "\nCol1() from something.doIt[\"key\"]\nCol2()\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\nCol1() from something.doIt[\"key\"]\nCol2()\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1020,8 +1010,8 @@
}
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);
+ // test input: "\nCol1() from doIt1( foo,bar,42,\"hello\",{ a => \"b\"}, [a, \"b\", 42] )\n .doIt2(bar, [a, \"b\", 42]).field[\"key\"]\nCol2()\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\nCol1() from doIt1( foo,bar,42,\"hello\",{ a => \"b\"}, [a, \"b\", 42] )\n .doIt2(bar, [a, \"b\", 42]).field[\"key\"]\nCol2()\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1029,8 +1019,8 @@
}
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);
+ // test input: "\nfoo3 : Bar(a==3)\nfoo4 : Bar(a4:a==4)\nBaz()\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\nfoo3 : Bar(a==3)\nfoo4 : Bar(a4:a==4)\nBaz()\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1038,8 +1028,8 @@
}
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);
+ // test input: "\nPerson(age > 30 && < 40)\nVehicle(type == \"sedan\" || == \"wagon\", age < 3)\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\nPerson(age > 30 && < 40)\nVehicle(type == \"sedan\" || == \"wagon\", age < 3)\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1047,8 +1037,8 @@
}
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);
+ // 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);
Object expecting = "OK";
@@ -1056,8 +1046,8 @@
}
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);
+ // test input: "\nnot ( Cheese(type == \"stilton\") )\nexists ( Foo() )\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\nnot ( Cheese(type == \"stilton\") )\nexists ( Foo() )\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1065,8 +1055,8 @@
}
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);
+ // test input: "\nnot ( Cheese(type == \"stilton\") )\nexists ( Foo() )\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\nnot ( Cheese(type == \"stilton\") )\nexists ( Foo() )\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1074,17 +1064,17 @@
}
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);
- Object expecting = "OK";
+ // test input: "\na : (not ( Cheese(type == \"stilton\") ))\nexists ( Foo() )\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\na : (not ( Cheese(type == \"stilton\") ))\nexists ( Foo() )\n", false);
+ Object actual = examineParserExecResult(28, retval);
+ Object expecting = "FAIL";
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
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);
+ // test input: " Cheese( t:type == \"cheddar\" ) "
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", " Cheese( t:type == \"cheddar\" ) ", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1092,8 +1082,8 @@
}
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);
+ // test input: "Cheese( $type:type )"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "Cheese( $type:type )", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1101,17 +1091,17 @@
}
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(28, retval);
- Object expecting = "FAIL";
+ // test input: "\n Cheese($type : type == \"stilton\")\n $person : Person($name : name == \"bob\", likes == $type) \n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n Cheese($type : type == \"stilton\")\n $person : Person($name : name == \"bob\", likes == $type) \n", false);
+ Object actual = examineParserExecResult(27, retval);
+ Object expecting = "OK";
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
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);
+ // test input: "\nPerson(name == \"mark\") or \n( Person(type == \"fan\") and Cheese(type == \"green\") )\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\nPerson(name == \"mark\") or \n( Person(type == \"fan\") and Cheese(type == \"green\") )\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1119,8 +1109,8 @@
}
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);
+ // test input: "\nPerson(name == \"mark\") && Cheese(type == \"stilton\")\nPerson(name == \"mark\") || Cheese(type == \"stilton\")\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\nPerson(name == \"mark\") && Cheese(type == \"stilton\")\nPerson(name == \"mark\") || Cheese(type == \"stilton\")\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1128,8 +1118,8 @@
}
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);
+ // test input: "\nfoo : ( Person(name == \"mark\") or Person(type == \"fan\") ) \nCheese(type == \"green\")\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\nfoo : ( Person(name == \"mark\") or Person(type == \"fan\") ) \nCheese(type == \"green\")\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1137,8 +1127,8 @@
}
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);
+ // test input: "\nfoo : ( Person(name == \"mark\") \n\tor \n\tPerson(type == \"fan\") )\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\nfoo : ( Person(name == \"mark\") \n\tor \n\tPerson(type == \"fan\") )\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1146,8 +1136,8 @@
}
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);
+ // test input: "\nfoo : ( \n\tPerson(name == \"mark\") or Person(type == \"fan\") \n\t)\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\nfoo : ( \n\tPerson(name == \"mark\") or Person(type == \"fan\") \n\t)\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1155,8 +1145,8 @@
}
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);
+ // test input: "\n ( (not Foo(x==\"a\") or Foo(x==\"y\") ) and ( Shoes() or Butt() ) )\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n ( (not Foo(x==\"a\") or Foo(x==\"y\") ) and ( Shoes() or Butt() ) )\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1164,8 +1154,8 @@
}
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);
+ // test input: "\neval(abc(\"foo\") + 5)\nFoo()\neval(qed())\nBar()\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\neval(abc(\"foo\") + 5)\nFoo()\neval(qed())\nBar()\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1173,8 +1163,8 @@
}
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);
+ // test input: "\nFoo()\nBar()\neval(abc(\"foo\"))\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\nFoo()\nBar()\neval(abc(\"foo\"))\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1182,8 +1172,8 @@
}
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);
+ // test input: "Foo(name== (a + b))"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "Foo(name== (a + b))", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1191,8 +1181,8 @@
}
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);
+ // 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);
Object expecting = "OK";
@@ -1200,8 +1190,8 @@
}
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);
+ // test input: "Foo(bar == Foo.BAR)"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "Foo(bar == Foo.BAR)", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1209,8 +1199,8 @@
}
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);
+ // test input: "\np: Person( name soundslike \"Michael\" )\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\np: Person( name soundslike \"Michael\" )\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1218,8 +1208,8 @@
}
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);
+ // test input: "\nFoo()\nBar()\neval(\n\n\n\n abc(\n \n \"foo\") + \n 5\n \n \n \n \n )\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\nFoo()\nBar()\neval(\n\n\n\n abc(\n \n \"foo\") + \n 5\n \n \n \n \n )\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1227,17 +1217,17 @@
}
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);
- Object expecting = "OK";
+ // test input: "eval(abc();)"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "eval(abc();)", false);
+ Object actual = examineParserExecResult(28, retval);
+ Object expecting = "FAIL";
assertEquals("testing rule "+"lhs_block", expecting, actual);
}
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);
+ // test input: "\nFoo(\n bar == baz, la==laz\n )\n "
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\nFoo(\n bar == baz, la==laz\n )\n ", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1245,8 +1235,8 @@
}
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);
+ // 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);
Object expecting = "OK";
@@ -1254,8 +1244,8 @@
}
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);
+ // test input: "\n Integer() from accumulate( Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n Integer() from accumulate( Person( age > 21 ),\n init( int x = 0; ),\n action( x++; ),\n result( new Integer(x) ) );\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1263,8 +1253,8 @@
}
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);
+ // 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"
+ 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", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1272,8 +1262,8 @@
}
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);
+ // 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);
Object expecting = "OK";
@@ -1281,8 +1271,8 @@
}
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);
+ // test input: "\n\tnot ( State( $state : state ) and\n not( Person( status == $state, $likes : likes ) and\n Cheese( type == $likes ) ) )\n Person( name == \"Bob\" )\n ( Cheese( price == 10 ) or Cheese( type == \"brie\" ) )\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\tnot ( State( $state : state ) and\n not( Person( status == $state, $likes : likes ) and\n Cheese( type == $likes ) ) )\n Person( name == \"Bob\" )\n ( Cheese( price == 10 ) or Cheese( type == \"brie\" ) )\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1290,8 +1280,8 @@
}
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);
+ // test input: "\n forall( Person( age > 21, $likes : likes )\n Cheese( type == $likes ) );\n"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n forall( Person( age > 21, $likes : likes )\n Cheese( type == $likes ) );\n", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1299,8 +1289,8 @@
}
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);
+ // 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);
Object expecting = "OK";
@@ -1308,8 +1298,8 @@
}
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);
+ // 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);
Object expecting = "OK";
@@ -1317,8 +1307,8 @@
}
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);
+ // test input: "\n\t\tPattern1();\n\t\tPattern2() from x.y.z;\n\t\tPattern5();\n\t\tPattern6();\n\t\tPattern7();\n\t\tPattern3();\n\t\tPattern4() from collect( Pattern5() );\n\t\t"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\t\tPattern1();\n\t\tPattern2() from x.y.z;\n\t\tPattern5();\n\t\tPattern6();\n\t\tPattern7();\n\t\tPattern3();\n\t\tPattern4() from collect( Pattern5() );\n\t\t", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1326,8 +1316,8 @@
}
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);
+ // test input: " eval( 3==3 ) "
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", " eval( 3==3 ) ", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1335,8 +1325,8 @@
}
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);
+ // test input: "\n\t\tInteger() from accumulate( Person( age > 21 ),\n\t\t init( int x = 0; ),\n\t\t action( x++; ),\n\t\t reverse( x--; ),\n\t\t result( new Integer(x) ) );\n\t\t"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\t\tInteger() from accumulate( Person( age > 21 ),\n\t\t init( int x = 0; ),\n\t\t action( x++; ),\n\t\t reverse( x--; ),\n\t\t result( new Integer(x) ) );\n\t\t", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1344,8 +1334,8 @@
}
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);
+ // test input: "\n\t Number() from accumulate( Person( $age : age > 21 ),\n\t average( $age ) );\n\t\t"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\t Number() from accumulate( Person( $age : age > 21 ),\n\t average( $age ) );\n\t\t", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1353,8 +1343,8 @@
}
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);
+ // test input: "\n\t #bellow statement makes no sense, but is useful to test parsing recursiveness\n\t $personList : ArrayList() from collect( $p : Person( age > 21 || age < 10 ) from collect( People() from $town.getPeople() ) );\n\t\t"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\t #bellow statement makes no sense, but is useful to test parsing recursiveness\n\t $personList : ArrayList() from collect( $p : Person( age > 21 || age < 10 ) from collect( People() from $town.getPeople() ) );\n\t\t", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1362,8 +1352,8 @@
}
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);
+ // test input: "\n\t $personList : ArrayList() from accumulate( Person( $age : age > 21 || < 10 ) from collect( People() from $town.getPeople() ),\n\t max( $age ) );\n\t\t"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\t $personList : ArrayList() from accumulate( Person( $age : age > 21 || < 10 ) from collect( People() from $town.getPeople() ),\n\t max( $age ) );\n\t\t", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1371,8 +1361,8 @@
}
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);
+ // test input: "\n\t $p : Person( name == \"bob\" )\n\t $c : Cheese( type == $p.likes ) || Cheese( price == 10 )\n\t "
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\t $p : Person( name == \"bob\" )\n\t $c : Cheese( type == $p.likes ) || Cheese( price == 10 )\n\t ", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1380,8 +1370,8 @@
}
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);
+ // test input: "\n\t\t $counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),\n\t\t init( int x = 0; ),\n\t\t action( x++; ),\n\t\t result( new Integer(x) ) );\n\t\t\t"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\t\t $counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),\n\t\t init( int x = 0; ),\n\t\t action( x++; ),\n\t\t result( new Integer(x) ) );\n\t\t\t", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1389,8 +1379,8 @@
}
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);
+ // test input: "\n\t\t $a : EventA()\n\t\t $b : EventB( this after[1,10] $a )\n\t\t $c : EventC( this finishes $b )\n\t\t $d : EventD( this not starts $a )\n\t\t $e : EventE( this not before [1, 10] $b )\n\t\t\t"
+ Object retval = execTreeParser("lhs_block", "normal_lhs_block", "\n\t\t $a : EventA()\n\t\t $b : EventB( this after[1,10] $a )\n\t\t $c : EventC( this finishes $b )\n\t\t $d : EventD( this not starts $a )\n\t\t $e : EventE( this not before [1, 10] $b )\n\t\t\t", false);
Object actual = examineParserExecResult(27, retval);
Object expecting = "OK";
@@ -1398,8 +1388,8 @@
}
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);
+ // 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);
Object expecting = "OK";
@@ -1407,15 +1397,6 @@
}
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);
@@ -1438,7 +1419,6 @@
CommonTokenStream tokens = new CommonTokenStream(lexer);
DRLParser parser = new DRLParser(tokens);
parser.setTreeAdaptor(new DroolsTreeAdaptor());
-
/** Use Reflection to get rule method from parser */
Method ruleName = Class.forName("org.drools.lang.DRLParser").getMethod(testRuleName);
@@ -1522,7 +1502,7 @@
if ( parser.hasErrors() ) {
this.stderr = parser.getErrors().toString();
return this.stderr;
- }
+ }
if ( stdoutVacuum.toString().length()>0 ) {
this.stdout = stdoutVacuum.toString();
}
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-06-04 20:26:24 UTC (rev 20313)
+++ labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/gUnitTest.testsuite 2008-06-05 00:03:07 UTC (rev 20314)
@@ -5,18 +5,33 @@
}
package_statement:
+
+/**
+ * test Package One Segment
+ */
"package foo"
-> (package (VT_PACKAGE_ID foo))
+/**
+ * test Package Multiple Segments
+ */
"package foo.bar.baz;"
-> (package (VT_PACKAGE_ID foo bar baz))
compilation_unit:
+/**
+ * test Empty Compilation Unit
+ */
""
-> "VT_COMPILATION_UNIT"
+/**
+ * test 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)))
-
+/**
+ * test Empty Rule
+ */
<<rule empty
then
@@ -25,6 +40,9 @@
-> (VT_COMPILATION_UNIT (rule empty then
end))
+/**
+ * test Damaged syntax
+ */
<<#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
@@ -36,6 +54,9 @@
>>
FAIL
+/**
+ * test Templates
+ */
<<package test.templates
template Cheese
@@ -60,6 +81,9 @@
-> (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) end) (template "Wine" (VT_SLOT (VT_DATA_TYPE String) name) (VT_SLOT (VT_DATA_TYPE String) year) (VT_SLOT (VT_DATA_TYPE String [ ]) accolades) end) (rule "a rule" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_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))
+/**
+ * test Ternary Expression
+ */
<<package foo
rule rule_one
@@ -73,6 +97,9 @@
if (speed > speedLimit ? true : false;)
pullEmOver();
end))
+/**
+ * test Function With Arrays
+ */
<<package foo
function String[] yourFunction(String args[]) {
@@ -93,6 +120,9 @@
yourFunction(new String[3] {"a","b","c"});
end))
+/**
+ * test Almost Empty Rule
+ */
<<
rule almost_empty
when
@@ -100,12 +130,18 @@
end>>
-> (VT_COMPILATION_UNIT (rule almost_empty when VT_AND_IMPLICIT then
end))
+/**
+ * test Quoted String Name Rule
+ */
<<rule "quoted string name"
when
then
end>>
-> (VT_COMPILATION_UNIT (rule "quoted string name" when VT_AND_IMPLICIT then
end))
+/**
+ * test No Loop
+ */
<<
rule rule1
no-loop false
@@ -117,6 +153,9 @@
-> (VT_COMPILATION_UNIT (rule rule1 (VT_RULE_ATTRIBUTES (no-loop false)) when (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton")))))) then
funky();
end))
+/**
+ * test Auto focus
+ */
<<
rule rule1
auto-focus true
@@ -128,6 +167,9 @@
-> (VT_COMPILATION_UNIT (rule rule1 (VT_RULE_ATTRIBUTES (auto-focus true)) when (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton")))))) then
funky();
end))
+/**
+ * test Rule Flow Group
+ */
<<
rule rule1
ruleflow-group "a group"
@@ -139,6 +181,9 @@
-> (VT_COMPILATION_UNIT (rule rule1 (VT_RULE_ATTRIBUTES (ruleflow-group "a group")) when (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton")))))) then
funky();
end))
+/**
+ * test Consequence With Declaration
+ */
<<
rule myrule
@@ -199,7 +244,9 @@
String s = (String) o;
end))
-
+/**
+ * test Literal Bool And Negative Numbers Rule
+ */
<<#check that it can handle true/false literals, and
#negative numbers
rule simple_rule
@@ -225,6 +272,9 @@
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_PATTERN_TYPE Cheese)))) then
end))
+/**
+ * test Simple Method Call With From
+ */
<<
rule blah
@@ -238,6 +288,9 @@
-> (VT_COMPILATION_UNIT (rule blah when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Col2)))) then
partay();
end))
+/**
+ * test Simple Function Call With From
+ */
<<
rule blah
@@ -251,6 +304,9 @@
-> (VT_COMPILATION_UNIT (rule blah when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Col2)))) then
partay();
end))
+/**
+ * test Simple Accessor With From
+ */
<<
rule blah
@@ -264,6 +320,9 @@
-> (VT_COMPILATION_UNIT (rule blah when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Col1))) (VT_FROM_SOURCE something (. doIt))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Col2)))) then
partay();
end))
+/**
+ * test Simple Accessor And Arg With From
+ */
<<
rule blah
@@ -277,6 +336,9 @@
-> (VT_COMPILATION_UNIT (rule blah when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Col1))) (VT_FROM_SOURCE something (. doIt ["key"]))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Col2)))) then
partay();
end))
+/**
+ * test Complex Chained Acessor
+ */
<<rule blah
when
Col1() from doIt1( foo,bar,42,"hello",{ a => "b"}, [a, "b", 42] )
@@ -288,6 +350,9 @@
-> (VT_COMPILATION_UNIT (rule blah when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Col2)))) then
partay();
end))
+/**
+ * test Simple Rule
+ */
<<
rule simple_rule
when
@@ -310,6 +375,9 @@
}
System.out.println( a4 );
end))
+/**
+ * test Restrictions Multiple
+ */
<<#this is for showing off all the new multi restriction stuff
@@ -325,6 +393,9 @@
-> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_PATTERN_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))
+/**
+ * test Line Number Including Comments In RHS
+ */
<<package la
@@ -353,6 +424,9 @@
*/
second
end))
+/**
+ * test Lhs Semicolon Delim
+ */
<<
rule simple_rule
when
@@ -373,6 +447,9 @@
}
System.out.println( a4 );
end))
+/**
+ * test Not Node
+ */
<<
rule simple_rule
when
@@ -383,6 +460,9 @@
-> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton")))))) then
funky();
end))
+/**
+ * test Function Import
+ */
<<package HR1
import function abd.def.x
@@ -398,6 +478,9 @@
-> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID HR1)) (import function (VT_IMPORT_ID abd def x)) (import function (VT_IMPORT_ID qed wah .*)) (rule simple_rule when (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton"))))) (exists (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo))))) then
funky();
end))
+/**
+ * test Not Exist With Brackets
+ */
<<package HR1
rule simple_rule
@@ -410,6 +493,9 @@
-> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID HR1)) (rule simple_rule when (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton"))))) (exists (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo))))) then
funky();
end))
+/**
+ * test Damaged syntax
+ */
<<package HR2
rule simple_rule
@@ -420,6 +506,9 @@
funky();
end>>
FAIL
+/**
+ * test Simple Query
+ */
<<
query "simple_query"
@@ -429,6 +518,9 @@
end>>
-> (VT_COMPILATION_UNIT (query "simple_query" (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo3 (VT_FACT (VT_PATTERN_TYPE Bar) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 3))))) (VT_PATTERN (VT_FACT_BINDING foo4 (VT_FACT (VT_PATTERN_TYPE Bar) (VT_BIND_FIELD a4 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 4)))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Baz)))) end))
+/**
+ * test Query Rule Mixed
+ */
<<
package foo
@@ -466,6 +558,9 @@
Boo()
end) (query "simple_query2" (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo3 (VT_FACT (VT_PATTERN_TYPE Bar) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 3))))) (VT_PATTERN (VT_FACT_BINDING foo4 (VT_FACT (VT_PATTERN_TYPE Bar) (VT_BIND_FIELD a4 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 4)))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Baz)))) end))
+/**
+ * test Multiple Rules
+ */
<<package org.drools.test;
import org.drools.integrationtests.Cheese;
@@ -488,6 +583,9 @@
end) (rule "Like Cheddar" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_BIND_FIELD t (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "cheddar")))))) then
System.out.println("I like " + t );
end))
+/**
+ * test Basic Binding
+ */
<<package org.drools.test;
import org.drools.Cheese;
@@ -501,6 +599,9 @@
-> (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_PATTERN_TYPE Cheese) (VT_BIND_FIELD $type (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type))))))) then
System.out.println("I like " + $type);
end))
+/**
+ * test Bound Variables
+ */
<<package org.drools.test;
import org.drools.Cheese;
@@ -516,6 +617,9 @@
-> (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_PATTERN_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_PATTERN_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))
+/**
+ * test Or Nesting
+ */
<<
import org.drools.Person
@@ -529,6 +633,9 @@
-> (VT_COMPILATION_UNIT (import (VT_IMPORT_ID org drools Person)) (rule simple_rule when (VT_AND_IMPLICIT (or (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark")))) (and (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "fan")))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "green"))))))) then
System.out.println( "Mark and Michael" + bar );
end))
+/**
+ * test And Or Rules
+ */
<<
import org.drools.Person
@@ -542,6 +649,9 @@
-> (VT_COMPILATION_UNIT (import (VT_IMPORT_ID org drools Person)) (rule simple_rule when (VT_AND_IMPLICIT (&& (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark")))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton"))))) (|| (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark")))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton")))))) then
System.out.println( "Mark and Michael" );
end))
+/**
+ * test Or With Binding
+ */
<<
import org.drools.Person
@@ -555,6 +665,9 @@
-> (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_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark"))) (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "fan")))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "green"))))) then
System.out.println( "Mark and Michael" + bar );
end))
+/**
+ * test Or Binding Complex
+ */
<<
rule simple_rule
@@ -568,6 +681,9 @@
-> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo (or (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark"))) (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "fan"))))))) then
System.out.println( "Mark and Michael" + bar );
end))
+/**
+ * test Or Binding With Brackets
+ */
<<rule simple_rule
when
foo : (
@@ -579,6 +695,9 @@
-> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo (or (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark"))) (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "fan"))))))) then
System.out.println( "Mark and Michael" + bar );
end))
+/**
+ * test Brackets Precedence
+ */
<<
rule simple_rule
when
@@ -589,6 +708,9 @@
-> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (and (or (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT x)) (== "a"))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT x)) (== "y"))))) (or (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Shoes))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Butt)))))) then
go wild
end))
+/**
+ * test Eval Multiple
+ */
<<
rule simple_rule
when
@@ -606,6 +728,9 @@
Poof
end))
+/**
+ * test With Eval
+ */
<<
rule simple_rule
when
@@ -620,6 +745,9 @@
Kapow
end))
+/**
+ * test With Retval
+ */
<<
rule simple_rule
when
@@ -632,6 +760,9 @@
Kapow
end))
+/**
+ * test With Predicate
+ */
<<
rule simple_rule
when
@@ -642,6 +773,9 @@
-> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_BIND_FIELD $age2 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)))) (-> ($age2 == $age1+2 ))))) then
foo bar
end))
+/**
+ * test Not With Constraint
+ */
<<package org.drools.test;
import org.drools.Cheese;
@@ -659,6 +793,9 @@
-> (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_PATTERN_TYPE Person) (VT_BIND_FIELD $likes (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT like))))))) (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $likes)))))))) then
list.add( $person );
end))
+/**
+ * test Global
+ */
<<package org.drools.test;
import org.drools.Cheese;
@@ -675,6 +812,9 @@
-> (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_PATTERN_TYPE Cheese)))) then
end))
+/**
+ * test Functions
+ */
<<
import java.lang.String
@@ -711,6 +851,10 @@
}) (rule something when VT_AND_IMPLICIT then
end) (rule "one more thing" when VT_AND_IMPLICIT then
end))
+
+/**
+ * test Comment
+ */
<<#this starts with a comment
package foo.bar
@@ -728,6 +872,9 @@
end>>
-> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID foo bar)) (rule "test" when VT_AND_IMPLICIT then
end))
+/**
+ * test Attributes
+ */
<<
@@ -747,6 +894,9 @@
-> (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_PATTERN_TYPE Foo)))) then
bar();
end))
+/**
+ * test Attributes alternate Syntax
+ */
<<
@@ -761,6 +911,9 @@
-> (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_PATTERN_TYPE Foo)))) then
bar();
end))
+/**
+ * test Enumeration
+ */
<<
rule simple_rule
when
@@ -769,6 +922,9 @@
end>>
-> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT bar)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT Foo) (VT_ACCESSOR_ELEMENT BAR))))))) then
end))
+/**
+ * test Syntax Damage
+ */
<<rule one
when
exists Foo()
@@ -782,6 +938,9 @@
then
end>>
FAIL
+/**
+ * test Extra Lhs Newline
+ */
<<
rule "another test"
when
@@ -795,6 +954,9 @@
-> (VT_COMPILATION_UNIT (rule "another test" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING s (VT_FACT (VT_PATTERN_TYPE String)))) (eval (s.equals("foo") && s.startsWith("f")))) then
list.add( s );
end))
+/**
+ * test Sounds Like
+ */
<<package nesting;
@@ -812,6 +974,9 @@
p.name = "goober"
System.out.println(p.name)
end))
+/**
+ * test Package Attributes
+ */
<<package com.foo;
agenda-group "x"
@@ -838,6 +1003,9 @@
-> (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))
+/**
+ * test Statement Ordering 1
+ */
<<
package com.foo;
@@ -873,6 +1041,9 @@
end) (function uncheeseIt VT_PARAM_LIST {
}) (import (VT_IMPORT_ID im four)))
+/**
+ * test Rule Names Starting With Numbers
+ */
<<
rule "1. Do Stuff!"
when
@@ -886,6 +1057,9 @@
-> (VT_COMPILATION_UNIT (rule "1. Do Stuff!" when VT_AND_IMPLICIT then
end) (rule "2. Do More Stuff!" when VT_AND_IMPLICIT then
end))
+/**
+ * test Eval With Newline
+ */
<<
rule simple_rule
when
@@ -926,6 +1100,9 @@
Poof
end))
+/**
+ * test Syntax Damage
+ */
<<
rule simple_rule
when
@@ -935,6 +1112,9 @@
Poof
end>>
FAIL
+/**
+ * test End Position
+ */
<<
@@ -952,6 +1132,9 @@
Kapow
Poof
end))
+/**
+ * test Qualified Classname
+ */
<<package org.drools.test;
rule "Who likes Stilton"
@@ -963,6 +1146,9 @@
-> (VT_COMPILATION_UNIT (package (VT_PACKAGE_ID org drools test)) (rule "Who likes Stilton" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_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))
+/**
+ * test Accumulate
+ */
<<rule "AccumulateParserTest"
when
Integer() from accumulate( Person( age > 21 ),
@@ -973,6 +1159,9 @@
end>>
-> (VT_COMPILATION_UNIT (rule "AccumulateParserTest" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Integer))) (accumulate (VT_PATTERN (VT_FACT (VT_PATTERN_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))
+/**
+ * test Accumulate With Bindings
+ */
<<rule "AccumulateParserTest"
when
$counter:Integer() from accumulate( $person : Person( age > 21 ),
@@ -983,6 +1172,9 @@
end>>
-> (VT_COMPILATION_UNIT (rule "AccumulateParserTest" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $counter (VT_FACT (VT_PATTERN_TYPE Integer)))) (accumulate (VT_PATTERN (VT_FACT_BINDING $person (VT_FACT (VT_PATTERN_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))
+/**
+ * test Collect
+ */
<<rule "CollectParserTest"
when
$personList : ArrayList() from collect( Person( age > 21 ) );
@@ -999,6 +1191,9 @@
-> (VT_COMPILATION_UNIT (rule "test_Quotes" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE InitialFact)))) then
String s = "\"\n\t\\";
end))
+/**
+ * test Nested CEs
+ */
<<rule "test nested CEs"
when
not ( State( $state : state ) and
@@ -1012,6 +1207,9 @@
-> (VT_COMPILATION_UNIT (rule "test nested CEs" when (VT_AND_IMPLICIT (not (and (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE State) (VT_BIND_FIELD $state (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT state)))))) (not (and (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $likes)))))))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "Bob")))) (or (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT price)) (== 10)))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "brie")))))) then
results.add("OK");
end))
+/**
+ * test For All
+ */
<<rule "ForallParserTest"
when
forall( Person( age > 21, $likes : likes )
@@ -1020,6 +1218,9 @@
end>>
-> (VT_COMPILATION_UNIT (rule "ForallParserTest" when (VT_AND_IMPLICIT (forall (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $likes)))))))) then
end))
+/**
+ * test In Operator
+ */
<<#testing 'in' operator
rule simple_rule
@@ -1032,6 +1233,9 @@
-> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_PATTERN_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))
+/**
+ * test Not In Operator
+ */
<<#testing not 'in' operator
rule simple_rule
@@ -1044,6 +1248,9 @@
-> (VT_COMPILATION_UNIT (rule simple_rule when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_PATTERN_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))
+/**
+ * test Semicolon
+ */
<<package org.drools;
global java.util.List list;
@@ -1076,6 +1283,9 @@
end;) (query "query1" (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern5))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern6))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern7)))) end) (rule "rule2" when (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern3))) (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern4))) (collect (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern5)))))) then
System.out.println("Test");
end;))
+/**
+ * test Eval
+ */
<<package org.drools
rule "Test Parse"
@@ -1088,6 +1298,9 @@
-> (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))
+/**
+ * test Accumulate Reverse
+ */
<<rule "AccumulateReverseParserTest"
when
Integer() from accumulate( Person( age > 21 ),
@@ -1099,6 +1312,9 @@
end>>
-> (VT_COMPILATION_UNIT (rule "AccumulateReverseParserTest" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Integer))) (accumulate (VT_PATTERN (VT_FACT (VT_PATTERN_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))
+/**
+ * test Accumulate External Function
+ */
<<rule "AccumulateReverseParserTest"
when
Number() from accumulate( Person( $age : age > 21 ),
@@ -1107,6 +1323,9 @@
end>>
-> (VT_COMPILATION_UNIT (rule "AccumulateReverseParserTest" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Number))) (accumulate (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_BIND_FIELD $age (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21))))) (VT_ACCUMULATE_ID_CLAUSE average ( $age ))))) then
end))
+/**
+ * test Collect With Nested From
+ */
<<rule "CollectParserTest"
when
#bellow statement makes no sense, but is useful to test parsing recursiveness
@@ -1117,6 +1336,9 @@
>>
-> (VT_COMPILATION_UNIT (rule "CollectParserTest" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $personList (VT_FACT (VT_PATTERN_TYPE ArrayList)))) (collect (from (VT_PATTERN (VT_FACT_BINDING $p (VT_FACT (VT_PATTERN_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_PATTERN_TYPE People))) (VT_FROM_SOURCE $town (. getPeople ())))))))) then
end))
+/**
+ * test Accumulate With Nested From
+ */
<<rule "AccumulateParserTest"
when
#bellow statement makes no sense, but is useful to test parsing recursiveness
@@ -1128,6 +1350,9 @@
>>
-> (VT_COMPILATION_UNIT (rule "AccumulateParserTest" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $personList (VT_FACT (VT_PATTERN_TYPE ArrayList)))) (accumulate (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_BIND_FIELD $age (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (|| (> 21) (< 10)))))) (collect (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE People))) (VT_FROM_SOURCE $town (. getPeople ()))))) (VT_ACCUMULATE_ID_CLAUSE max ( $age ))))) then
end))
+/**
+ * test Or CE
+ */
<<package org.drools;
rule "testing OR CE"
@@ -1140,12 +1365,21 @@
-> (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_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "bob"))))) (|| (VT_PATTERN (VT_FACT_BINDING $c (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT price)) (== 10)))))) then
// do something
end))
+/**
+ * test Rule Single Line
+ */
<<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))
+/**
+ * test Rule Two Lines
+ */
<<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))
+/**
+ * test Accumulate Multi Pattern
+ */
<<rule "AccumulateMultiPatternParserTest"
when
$counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),
@@ -1156,6 +1390,9 @@
end>>
-> (VT_COMPILATION_UNIT (rule "AccumulateMultiPatternParserTest" when (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $counter (VT_FACT (VT_PATTERN_TYPE Integer)))) (accumulate (and (VT_PATTERN (VT_FACT_BINDING $person (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21))))) (VT_PATTERN (VT_FACT (VT_PATTERN_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))
+/**
+ * test Syntax Damage
+ */
<<package org.drools;
rule "test rule"
@@ -1167,6 +1404,9 @@
end
>>
FAIL
+/**
+ * test Syntax Damage
+ */
<<package org.drools;
rule "Avoid NPE on wrong syntax"
@@ -1176,6 +1416,10 @@
System.out.println("OK");
end>>
FAIL
+
+/**
+ * test Pluggable Operators
+ */
<<package org.drools;
rule "test pluggable operators"
@@ -1191,349 +1435,116 @@
end))
pattern_source:
+/**
+ * test Entry Point
+ */
<<StockTick( symbol=="ACME") from entry-point StreamA>>
-> (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE StockTick) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT symbol)) (== "ACME")))) (entry-point StreamA))
paren_chunk:
+/**
+ * test Chunk Without Parens
+ */
<<( foo )>>
-> ( foo )
+/**
+ * test Chunk With Parens
+ */
<<(fnord())>>
-> (fnord())
+/**
+ * test Chunk With Parens And Quoted String
+ */
<<( fnord( "cheese" ) )>>
-> ( fnord( "cheese" ) )
+/**
+ * test Chunk With Random Charac5ters
+ */
<<( %*9dkj)>>
-> ( %*9dkj)
normal_lhs_block:
+/**
+ * test Empty lhs
+ */
"" -> "VT_AND_IMPLICIT"
- << $id : Something( duration == "foo") >>
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING $id (VT_FACT (VT_PATTERN_TYPE Something) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT duration)) (== "foo"))))))
- "foo3 : Bar(" FAIL
+/**
+ * test Member Of
+ */
<<
- Cheese(name == "Stilton", age==2001)
- Wine(name == "Grange", age == "1978", accolades contains "world champion")
- >> -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_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")))))
- "Foo()"
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo))))
- <<not Cheese(type == "stilton")>>
- -> (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton"))))))
- <<
- Person(age < 42, location=="atlanta")
- or
- Person(name=="bob")
- >>
- -> (VT_AND_IMPLICIT (or (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 42)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== "atlanta")))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "bob"))))))
- <<
- Foo(bar == false)
- Foo(boo > -42)
- Foo(boo > -42.42)
- >>
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT bar)) (== false)))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT boo)) (> -42)))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT boo)) (> -42.42)))))
- "Cheese( )"
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese))))
-
- <<
- Col1() from something.doIt( foo,bar,42,"hello",{ a => "b", "something" => 42, "a" => foo, x => {x=>y}},"end", [a, "b", 42] )
- Col2()
- >>
- -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Col2))))
- <<
- Col1() from doIt( foo,bar,42,"hello",{ a => "b", "something" => 42, "a" => foo, x => {x=>y}},"end", [a, "b", 42] )
- Col2()
- >>
- -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Col2))))
- <<
- Col1() from something.doIt
- Col2()
- >>
- -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Col1))) (VT_FROM_SOURCE something (. doIt))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Col2))))
- <<
- Col1() from something.doIt["key"]
- Col2()
- >>
- -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Col1))) (VT_FROM_SOURCE something (. doIt ["key"]))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Col2))))
- <<
- Col1() from doIt1( foo,bar,42,"hello",{ a => "b"}, [a, "b", 42] )
- .doIt2(bar, [a, "b", 42]).field["key"]
- Col2()
- >>
- -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Col2))))
- <<
- foo3 : Bar(a==3)
- foo4 : Bar(a4:a==4)
- Baz()
- >>
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo3 (VT_FACT (VT_PATTERN_TYPE Bar) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 3))))) (VT_PATTERN (VT_FACT_BINDING foo4 (VT_FACT (VT_PATTERN_TYPE Bar) (VT_BIND_FIELD a4 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 4)))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Baz))))
- <<
- Person(age > 30 && < 40)
- Vehicle(type == "sedan" || == "wagon", age < 3)
- >>
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Vehicle) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (|| (== "sedan") (== "wagon"))) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 3)))))
- " foo3 : Bar(a==3) ; foo4 : Bar(a4:a==4) ; Baz()"
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo3 (VT_FACT (VT_PATTERN_TYPE Bar) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 3))))) (VT_PATTERN (VT_FACT_BINDING foo4 (VT_FACT (VT_PATTERN_TYPE Bar) (VT_BIND_FIELD a4 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 4)))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Baz))))
- <<
- not ( Cheese(type == "stilton") )
- exists ( Foo() )
- >>
- -> (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton"))))) (exists (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo)))))
- <<
- not ( Cheese(type == "stilton") )
- exists ( Foo() )
- >>
- -> (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton"))))) (exists (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo)))))
- <<
- a : (not ( Cheese(type == "stilton") ))
- exists ( Foo() )
- >>
- FAIL
- << Cheese( t:type == "cheddar" ) >>
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_BIND_FIELD t (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "cheddar"))))))
-
- "Cheese( $type:type )"
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_BIND_FIELD $type (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)))))))
- <<
- Cheese($type : type == "stilton")
- $person : Person($name : name == "bob", likes == $type)
- >>
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_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))))))))
- <<
- Person(name == "mark") or
- ( Person(type == "fan") and Cheese(type == "green") )
- >>
- -> (VT_AND_IMPLICIT (or (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark")))) (and (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "fan")))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "green")))))))
- <<
- Person(name == "mark") && Cheese(type == "stilton")
- Person(name == "mark") || Cheese(type == "stilton")
- >>
- -> (VT_AND_IMPLICIT (&& (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark")))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton"))))) (|| (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark")))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton"))))))
- <<
- foo : ( Person(name == "mark") or Person(type == "fan") )
- Cheese(type == "green")
- >>
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo (or (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark"))) (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "fan")))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "green")))))
- <<
- foo : ( Person(name == "mark")
- or
- Person(type == "fan") )
- >>
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo (or (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark"))) (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "fan")))))))
- <<
- foo : (
- Person(name == "mark") or Person(type == "fan")
- )
- >>
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo (or (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark"))) (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "fan")))))))
- <<
- ( (not Foo(x=="a") or Foo(x=="y") ) and ( Shoes() or Butt() ) )
- >>
- -> (VT_AND_IMPLICIT (and (or (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT x)) (== "a"))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT x)) (== "y"))))) (or (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Shoes))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Butt))))))
- <<
- eval(abc("foo") + 5)
- Foo()
- eval(qed())
- Bar()
- >>
- -> (VT_AND_IMPLICIT (eval (abc("foo") + 5)) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo))) (eval (qed())) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Bar))))
- <<
- Foo()
- Bar()
- eval(abc("foo"))
- >>
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Bar))) (eval (abc("foo"))))
- "Foo(name== (a + b))"
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== (a + b))))))
-
- "Person( $age2:age -> ($age2 == $age1+2 ) )"
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_BIND_FIELD $age2 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)))) (-> ($age2 == $age1+2 )))))
-
- "Foo(bar == Foo.BAR)"
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT bar)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT Foo) (VT_ACCESSOR_ELEMENT BAR)))))))
- <<
- p: Person( name soundslike "Michael" )
- >>
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING p (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (soundslike "Michael"))))))
-
- <<
- Foo()
- Bar()
- eval(
-
-
-
- abc(
-
- "foo") +
- 5
-
-
-
-
- )
- >>
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Bar))) (eval (
-
-
-
- abc(
-
- "foo") +
- 5
-
-
-
-
- )))
-
- "eval(abc();)"
- FAIL
-
- <<
- Foo(
- bar == baz, la==laz
- )
- >>
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_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)))))))
-
- <<com.cheeseco.Cheese($type : type == "stilton")>>
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE com cheeseco Cheese) (VT_BIND_FIELD $type (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton"))))))
-
- <<
- Integer() from accumulate( Person( age > 21 ),
- init( int x = 0; ),
- action( x++; ),
- result( new Integer(x) ) );
- >>
- -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Integer))) (accumulate (VT_PATTERN (VT_FACT (VT_PATTERN_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) ))))))
-
- <<
- $counter:Integer() from accumulate( $person : Person( age > 21 ),
- init( int x = 0; ),
- action( x++; ),
- result( new Integer(x) ) );
- >>
- -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $counter (VT_FACT (VT_PATTERN_TYPE Integer)))) (accumulate (VT_PATTERN (VT_FACT_BINDING $person (VT_FACT (VT_PATTERN_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) ))))))
-
- "$personList : ArrayList() from collect( Person( age > 21 ) );"
- -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $personList (VT_FACT (VT_PATTERN_TYPE ArrayList)))) (collect (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21)))))))
-
-
- <<
- 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" ) )
- >>
- -> (VT_AND_IMPLICIT (not (and (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE State) (VT_BIND_FIELD $state (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT state)))))) (not (and (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $likes)))))))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "Bob")))) (or (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT price)) (== 10)))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "brie"))))))
-
- <<
- forall( Person( age > 21, $likes : likes )
- Cheese( type == $likes ) );
- >>
- -> (VT_AND_IMPLICIT (forall (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $likes))))))))
-
- <<
Country( $cities : city )
Person( city memberOf $cities )
>>
-> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Country) (VT_BIND_FIELD $cities (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT city)))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT city)) (memberOf (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $cities)))))))
-
+/**
+ * test Not Member Of
+ */
<<
Country( $cities : city )
Person( city not memberOf $cities )
>>
-> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Country) (VT_BIND_FIELD $cities (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT city)))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT city)) (memberOf not (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $cities)))))))
-
- <<
- Person(age > 30 && < 40)
- Vehicle(type in ( "sedan", "wagon" ), age < 3)
- >>
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Vehicle) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (in "sedan" "wagon")) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 3)))))
-
- <<
- Person(age > 30 && < 40)
- Vehicle(type not in ( "sedan", "wagon" ), age < 3)
- >>
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_PATTERN_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)))))
-
+/**
+ * test Constraint And Connective
+ */
<< Person( age < 42 && location=="atlanta") >>
-> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 42)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== "atlanta"))))))
+/**
+ * test Constraint Or Connective
+ */
<< Person( age < 42 || location=="atlanta") >>
-> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (|| (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 42)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== "atlanta"))))))
-
+
+/**
+ * test Constraint Connectives Precedence
+ */
<<Person( age < 42 && location=="atlanta" || age > 20 && location=="Seatle" || location == "Chicago")>>
-> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (|| (|| (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 42)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== "atlanta"))) (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 20)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== "Seatle")))) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== "Chicago"))))))
-
+
+/**
+ * test Constraint Connectives Precedence With Bracks
+ */
<<Person( age < 42 && ( location=="atlanta" || age > 20 && location=="Seatle") || location == "Chicago")>>
-> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (|| (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 42)) (|| (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== "atlanta")) (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 20)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== "Seatle"))))) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== "Chicago"))))))
+/**
+ * test Constraint Connectives Precedence With Bracks2
+ */
<< Person( ( age == 70 && hair == "black" ) || ( age == 40 && hair == "pink" ) || ( age == 12 && ( hair == "yellow" || hair == "blue" ) ) ) >>
-> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (|| (|| (&& (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (== 70)) (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"))))))))
+/**
+ * test Constraint Connectives Matches
+ */
<< Person( name matches "mark" || matches "bob" ) >>
-> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (|| (matches "mark") (matches "bob"))))))
-
+
+/**
+ * test Not Contains
+ */
<<
City( $city : city )
Country( cities not contains $city )
>>
-> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE City) (VT_BIND_FIELD $city (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT city)))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Country) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT cities)) (contains not (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $city)))))))
+/**
+ * test Not Matches
+ */
<< Message( text not matches '[abc]*' ) >>
-> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Message) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT text)) (matches not '[abc]*')))))
+/**
+ * test Restrictions
+ */
<<Foo( bar > 1 || == 1 )>>
-> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT bar)) (|| (> 1) (== 1))))))
-
- <<
- Pattern1();
- Pattern2() from x.y.z;
- Pattern5();
- Pattern6();
- Pattern7();
- Pattern3();
- Pattern4() from collect( Pattern5() );
- >>
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern1))) (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern2))) (VT_FROM_SOURCE x (. y (. z)))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern5))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern6))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern7))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern3))) (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern4))) (collect (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern5))))))
-
- << eval( 3==3 ) >>
- -> (VT_AND_IMPLICIT (eval ( 3==3 )))
-
- <<
- Integer() from accumulate( Person( age > 21 ),
- init( int x = 0; ),
- action( x++; ),
- reverse( x--; ),
- result( new Integer(x) ) );
- >>
- -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Integer))) (accumulate (VT_PATTERN (VT_FACT (VT_PATTERN_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) ))))))
-
- <<
- Number() from accumulate( Person( $age : age > 21 ),
- average( $age ) );
- >>
- -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Number))) (accumulate (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_BIND_FIELD $age (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21))))) (VT_ACCUMULATE_ID_CLAUSE average ( $age )))))
+/**
+ * test Rule Parse Lhs 3
+ */
<<
- #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() ) );
- >>
- -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $personList (VT_FACT (VT_PATTERN_TYPE ArrayList)))) (collect (from (VT_PATTERN (VT_FACT_BINDING $p (VT_FACT (VT_PATTERN_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_PATTERN_TYPE People))) (VT_FROM_SOURCE $town (. getPeople ()))))))))
-
- <<
- $personList : ArrayList() from accumulate( Person( $age : age > 21 || < 10 ) from collect( People() from $town.getPeople() ),
- max( $age ) );
- >>
- -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $personList (VT_FACT (VT_PATTERN_TYPE ArrayList)))) (accumulate (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_BIND_FIELD $age (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (|| (> 21) (< 10)))))) (collect (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE People))) (VT_FROM_SOURCE $town (. getPeople ()))))) (VT_ACCUMULATE_ID_CLAUSE max ( $age )))))
-
- <<
- $p : Person( name == "bob" )
- $c : Cheese( type == $p.likes ) || Cheese( price == 10 )
- >>
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING $p (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "bob"))))) (|| (VT_PATTERN (VT_FACT_BINDING $c (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT price)) (== 10))))))
-
- <<
(or
not Person()
(and Cheese()
@@ -1542,34 +1553,331 @@
>>
-> (VT_AND_IMPLICIT (or (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person)))) (and (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Meat))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Wine))))))
- <<
- $counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),
- init( int x = 0; ),
- action( x++; ),
- result( new Integer(x) ) );
- >>
- -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $counter (VT_FACT (VT_PATTERN_TYPE Integer)))) (accumulate (and (VT_PATTERN (VT_FACT_BINDING $person (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21))))) (VT_PATTERN (VT_FACT (VT_PATTERN_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) ))))))
-
- <<
- $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 )
- >>
- -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING $a (VT_FACT (VT_PATTERN_TYPE EventA)))) (VT_PATTERN (VT_FACT_BINDING $b (VT_FACT (VT_PATTERN_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_PATTERN_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_PATTERN_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_PATTERN_TYPE EventE) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT this)) (before not [1, 10] (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $b))))))))
-
- <<StockTick( symbol=="ACME") from entry-point StreamA>>
- -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE StockTick) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT symbol)) (== "ACME")))) (entry-point StreamA)))
-
+/**
+ * test Restriction Connectives
+ */
<<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_PATTERN_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"))))))))
+/**
+ * test Accessor Paths
+ */
<<org . drools/*comment*/ .Message( text not matches $c#comment
. property )
>>
-> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_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)))))))
+/**
+ * test General Lhs
+ */
+<< $id : Something( duration == "foo") >>
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING $id (VT_FACT (VT_PATTERN_TYPE Something) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT duration)) (== "foo"))))))
+"foo3 : Bar(" FAIL
+<<
+Cheese(name == "Stilton", age==2001)
+Wine(name == "Grange", age == "1978", accolades contains "world champion")
+>> -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_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")))))
+"Foo()"
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo))))
+<<not Cheese(type == "stilton")>>
+ -> (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton"))))))
+<<
+Person(age < 42, location=="atlanta")
+or
+Person(name=="bob")
+>>
+ -> (VT_AND_IMPLICIT (or (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 42)) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT location)) (== "atlanta")))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "bob"))))))
+<<
+Foo(bar == false)
+Foo(boo > -42)
+Foo(boo > -42.42)
+>>
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT bar)) (== false)))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT boo)) (> -42)))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT boo)) (> -42.42)))))
+"Cheese( )"
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese))))
+
+<<
+Col1() from something.doIt( foo,bar,42,"hello",{ a => "b", "something" => 42, "a" => foo, x => {x=>y}},"end", [a, "b", 42] )
+Col2()
+>>
+ -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Col2))))
+<<
+Col1() from doIt( foo,bar,42,"hello",{ a => "b", "something" => 42, "a" => foo, x => {x=>y}},"end", [a, "b", 42] )
+Col2()
+>>
+ -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Col2))))
+<<
+Col1() from something.doIt
+Col2()
+>>
+ -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Col1))) (VT_FROM_SOURCE something (. doIt))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Col2))))
+<<
+Col1() from something.doIt["key"]
+Col2()
+>>
+ -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Col1))) (VT_FROM_SOURCE something (. doIt ["key"]))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Col2))))
+<<
+Col1() from doIt1( foo,bar,42,"hello",{ a => "b"}, [a, "b", 42] )
+ .doIt2(bar, [a, "b", 42]).field["key"]
+Col2()
+>>
+ -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Col2))))
+<<
+foo3 : Bar(a==3)
+foo4 : Bar(a4:a==4)
+Baz()
+>>
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo3 (VT_FACT (VT_PATTERN_TYPE Bar) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 3))))) (VT_PATTERN (VT_FACT_BINDING foo4 (VT_FACT (VT_PATTERN_TYPE Bar) (VT_BIND_FIELD a4 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 4)))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Baz))))
+<<
+Person(age > 30 && < 40)
+Vehicle(type == "sedan" || == "wagon", age < 3)
+>>
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Vehicle) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (|| (== "sedan") (== "wagon"))) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 3)))))
+" foo3 : Bar(a==3) ; foo4 : Bar(a4:a==4) ; Baz()"
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo3 (VT_FACT (VT_PATTERN_TYPE Bar) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 3))))) (VT_PATTERN (VT_FACT_BINDING foo4 (VT_FACT (VT_PATTERN_TYPE Bar) (VT_BIND_FIELD a4 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT a)) (== 4)))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Baz))))
+<<
+not ( Cheese(type == "stilton") )
+exists ( Foo() )
+>>
+ -> (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton"))))) (exists (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo)))))
+<<
+not ( Cheese(type == "stilton") )
+exists ( Foo() )
+>>
+ -> (VT_AND_IMPLICIT (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton"))))) (exists (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo)))))
+<<
+a : (not ( Cheese(type == "stilton") ))
+exists ( Foo() )
+>>
+ FAIL
+<< Cheese( t:type == "cheddar" ) >>
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_BIND_FIELD t (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "cheddar"))))))
+
+"Cheese( $type:type )"
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_BIND_FIELD $type (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)))))))
+<<
+ Cheese($type : type == "stilton")
+ $person : Person($name : name == "bob", likes == $type)
+>>
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_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))))))))
+<<
+Person(name == "mark") or
+( Person(type == "fan") and Cheese(type == "green") )
+>>
+ -> (VT_AND_IMPLICIT (or (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark")))) (and (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "fan")))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "green")))))))
+<<
+Person(name == "mark") && Cheese(type == "stilton")
+Person(name == "mark") || Cheese(type == "stilton")
+>>
+ -> (VT_AND_IMPLICIT (&& (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark")))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton"))))) (|| (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark")))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton"))))))
+<<
+foo : ( Person(name == "mark") or Person(type == "fan") )
+Cheese(type == "green")
+>>
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo (or (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark"))) (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "fan")))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "green")))))
+<<
+foo : ( Person(name == "mark")
+ or
+ Person(type == "fan") )
+>>
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo (or (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark"))) (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "fan")))))))
+<<
+foo : (
+ Person(name == "mark") or Person(type == "fan")
+ )
+>>
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING foo (or (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "mark"))) (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "fan")))))))
+<<
+ ( (not Foo(x=="a") or Foo(x=="y") ) and ( Shoes() or Butt() ) )
+>>
+ -> (VT_AND_IMPLICIT (and (or (not (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT x)) (== "a"))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT x)) (== "y"))))) (or (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Shoes))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Butt))))))
+<<
+eval(abc("foo") + 5)
+Foo()
+eval(qed())
+Bar()
+>>
+ -> (VT_AND_IMPLICIT (eval (abc("foo") + 5)) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo))) (eval (qed())) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Bar))))
+<<
+Foo()
+Bar()
+eval(abc("foo"))
+>>
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Bar))) (eval (abc("foo"))))
+"Foo(name== (a + b))"
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== (a + b))))))
+
+"Person( $age2:age -> ($age2 == $age1+2 ) )"
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_BIND_FIELD $age2 (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)))) (-> ($age2 == $age1+2 )))))
+
+"Foo(bar == Foo.BAR)"
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT bar)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT Foo) (VT_ACCESSOR_ELEMENT BAR)))))))
+<<
+p: Person( name soundslike "Michael" )
+>>
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING p (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (soundslike "Michael"))))))
+
+<<
+Foo()
+Bar()
+eval(
+
+
+
+ abc(
+
+ "foo") +
+ 5
+
+
+
+
+ )
+>>
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Foo))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Bar))) (eval (
+
+
+
+ abc(
+
+ "foo") +
+ 5
+
+
+
+
+ )))
+
+"eval(abc();)"
+ FAIL
+
+<<
+Foo(
+ bar == baz, la==laz
+ )
+ >>
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_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)))))))
+
+<<com.cheeseco.Cheese($type : type == "stilton")>>
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE com cheeseco Cheese) (VT_BIND_FIELD $type (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "stilton"))))))
+
+<<
+ Integer() from accumulate( Person( age > 21 ),
+ init( int x = 0; ),
+ action( x++; ),
+ result( new Integer(x) ) );
+>>
+ -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Integer))) (accumulate (VT_PATTERN (VT_FACT (VT_PATTERN_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) ))))))
+
+<<
+ $counter:Integer() from accumulate( $person : Person( age > 21 ),
+ init( int x = 0; ),
+ action( x++; ),
+ result( new Integer(x) ) );
+>>
+ -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $counter (VT_FACT (VT_PATTERN_TYPE Integer)))) (accumulate (VT_PATTERN (VT_FACT_BINDING $person (VT_FACT (VT_PATTERN_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) ))))))
+
+"$personList : ArrayList() from collect( Person( age > 21 ) );"
+ -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $personList (VT_FACT (VT_PATTERN_TYPE ArrayList)))) (collect (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21)))))))
+
+
+<<
+ 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" ) )
+>>
+ -> (VT_AND_IMPLICIT (not (and (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE State) (VT_BIND_FIELD $state (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT state)))))) (not (and (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $likes)))))))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "Bob")))) (or (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT price)) (== 10)))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== "brie"))))))
+
+<<
+ forall( Person( age > 21, $likes : likes )
+ Cheese( type == $likes ) );
+>>
+ -> (VT_AND_IMPLICIT (forall (VT_PATTERN (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (== (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $likes))))))))
+
+
+ <<
+ Person(age > 30 && < 40)
+ Vehicle(type in ( "sedan", "wagon" ), age < 3)
+ >>
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Vehicle) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT type)) (in "sedan" "wagon")) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (< 3)))))
+
+ <<
+ Person(age > 30 && < 40)
+ Vehicle(type not in ( "sedan", "wagon" ), age < 3)
+ >>
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (&& (> 30) (< 40))))) (VT_PATTERN (VT_FACT (VT_PATTERN_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)))))
+
+ <<
+ Pattern1();
+ Pattern2() from x.y.z;
+ Pattern5();
+ Pattern6();
+ Pattern7();
+ Pattern3();
+ Pattern4() from collect( Pattern5() );
+ >>
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern1))) (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern2))) (VT_FROM_SOURCE x (. y (. z)))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern5))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern6))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern7))) (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern3))) (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern4))) (collect (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Pattern5))))))
+
+ << eval( 3==3 ) >>
+ -> (VT_AND_IMPLICIT (eval ( 3==3 )))
+
+ <<
+ Integer() from accumulate( Person( age > 21 ),
+ init( int x = 0; ),
+ action( x++; ),
+ reverse( x--; ),
+ result( new Integer(x) ) );
+ >>
+ -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Integer))) (accumulate (VT_PATTERN (VT_FACT (VT_PATTERN_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) ))))))
+
+ <<
+ Number() from accumulate( Person( $age : age > 21 ),
+ average( $age ) );
+ >>
+ -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Number))) (accumulate (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_BIND_FIELD $age (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21))))) (VT_ACCUMULATE_ID_CLAUSE average ( $age )))))
+
+ <<
+ #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() ) );
+ >>
+ -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $personList (VT_FACT (VT_PATTERN_TYPE ArrayList)))) (collect (from (VT_PATTERN (VT_FACT_BINDING $p (VT_FACT (VT_PATTERN_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_PATTERN_TYPE People))) (VT_FROM_SOURCE $town (. getPeople ()))))))))
+
+ <<
+ $personList : ArrayList() from accumulate( Person( $age : age > 21 || < 10 ) from collect( People() from $town.getPeople() ),
+ max( $age ) );
+ >>
+ -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $personList (VT_FACT (VT_PATTERN_TYPE ArrayList)))) (accumulate (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE Person) (VT_BIND_FIELD $age (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (|| (> 21) (< 10)))))) (collect (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE People))) (VT_FROM_SOURCE $town (. getPeople ()))))) (VT_ACCUMULATE_ID_CLAUSE max ( $age )))))
+
+ <<
+ $p : Person( name == "bob" )
+ $c : Cheese( type == $p.likes ) || Cheese( price == 10 )
+ >>
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING $p (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT name)) (== "bob"))))) (|| (VT_PATTERN (VT_FACT_BINDING $c (VT_FACT (VT_PATTERN_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_PATTERN_TYPE Cheese) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT price)) (== 10))))))
+ <<
+ $counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),
+ init( int x = 0; ),
+ action( x++; ),
+ result( new Integer(x) ) );
+ >>
+ -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT_BINDING $counter (VT_FACT (VT_PATTERN_TYPE Integer)))) (accumulate (and (VT_PATTERN (VT_FACT_BINDING $person (VT_FACT (VT_PATTERN_TYPE Person) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT age)) (> 21))))) (VT_PATTERN (VT_FACT (VT_PATTERN_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) ))))))
+
+ <<
+ $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 )
+ >>
+ -> (VT_AND_IMPLICIT (VT_PATTERN (VT_FACT_BINDING $a (VT_FACT (VT_PATTERN_TYPE EventA)))) (VT_PATTERN (VT_FACT_BINDING $b (VT_FACT (VT_PATTERN_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_PATTERN_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_PATTERN_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_PATTERN_TYPE EventE) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT this)) (before not [1, 10] (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT $b))))))))
+
+ <<StockTick( symbol=="ACME") from entry-point StreamA>>
+ -> (VT_AND_IMPLICIT (from (VT_PATTERN (VT_FACT (VT_PATTERN_TYPE StockTick) (VT_FIELD (VT_ACCESSOR_PATH (VT_ACCESSOR_ELEMENT symbol)) (== "ACME")))) (entry-point StreamA)))
+
+/**
+ * test Constraint
+ */
constraints:
<<eval( $var.equals("xyz") )>>
-> (eval ( $var.equals("xyz") ))
\ No newline at end of file
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-06-04 20:26:24 UTC (rev 20313)
+++ labs/jbossrules/branches/parser-rewrite/drools-compiler/src/test/java/org/drools/lang/gUnitTreeWalkerTest.testsuite 2008-06-05 00:03:07 UTC (rev 20314)
@@ -5,23 +5,43 @@
}
package_statement walks package_statement:
+
+/**
+ * test Package One Segment
+ */
"package foo"
OK
+/**
+ * test Package Multiple Segments
+ */
"package foo.bar.baz;"
OK
compilation_unit walks compilation_unit:
+/**
+ * test Empty Compilation Unit
+ */
""
OK
+/**
+ * test Compilation Unit
+ */
"package foo; import com.foo.Bar; import com.foo.Baz;"
OK
+/**
+ * test Empty Rule
+ */
<<rule empty
then
end>>
OK
+
+/**
+ * test Damaged syntax
+ */
<<#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
@@ -33,6 +53,9 @@
>>
FAIL
+/**
+ * test Templates
+ */
<<package test.templates
template Cheese
@@ -55,6 +78,9 @@
baz();
end>>
OK
+/**
+ * test Ternary Expression
+ */
<<package foo
rule rule_one
@@ -65,6 +91,9 @@
pullEmOver();
end>>
OK
+/**
+ * test Function With Arrays
+ */
<<package foo
function String[] yourFunction(String args[]) {
@@ -80,17 +109,26 @@
end>>
OK
+/**
+ * test Almost Empty Rule
+ */
<<
rule almost_empty
when
then
end>>
OK
+/**
+ * test Quoted String Name Rule
+ */
<<rule "quoted string name"
when
then
end>>
OK
+/**
+ * test No Loop
+ */
<<
rule rule1
no-loop false
@@ -100,6 +138,9 @@
funky();
end>>
OK
+/**
+ * test Auto focus
+ */
<<
rule rule1
auto-focus true
@@ -109,6 +150,9 @@
funky();
end>>
OK
+/**
+ * test Rule Flow Group
+ */
<<
rule rule1
ruleflow-group "a group"
@@ -118,6 +162,9 @@
funky();
end>>
OK
+/**
+ * test Consequence With Declaration
+ */
<<
rule myrule
@@ -151,7 +198,9 @@
end>>
OK
-
+/**
+ * test Literal Bool And Negative Numbers Rule
+ */
<<#check that it can handle true/false literals, and
#negative numbers
rule simple_rule
@@ -163,8 +212,7 @@
cons();
end>>
OK
-
- <<package org.drools.test;
+<<package org.drools.test;
import org.drools.Cheese;
@@ -174,6 +222,9 @@
then
end >>
OK
+/**
+ * test Simple Method Call With From
+ */
<<
rule blah
@@ -185,6 +236,9 @@
partay();
end >>
OK
+/**
+ * test Simple Function Call With From
+ */
<<
rule blah
@@ -196,6 +250,9 @@
partay();
end >>
OK
+/**
+ * test Simple Accessor With From
+ */
<<
rule blah
@@ -207,6 +264,9 @@
partay();
end >>
OK
+/**
+ * test Simple Accessor And Arg With From
+ */
<<
rule blah
@@ -218,6 +278,9 @@
partay();
end >>
OK
+/**
+ * test Complex Chained Acessor
+ */
<<rule blah
when
Col1() from doIt1( foo,bar,42,"hello",{ a => "b"}, [a, "b", 42] )
@@ -227,6 +290,9 @@
partay();
end >>
OK
+/**
+ * test Simple Rule
+ */
<<
rule simple_rule
when
@@ -242,6 +308,9 @@
System.out.println( a4 );
end>>
OK
+/**
+ * test Restrictions Multiple
+ */
<<#this is for showing off all the new multi restriction stuff
@@ -255,6 +324,9 @@
consequence();
end>>
OK
+/**
+ * test Line Number Including Comments In RHS
+ */
<<package la
@@ -273,6 +345,9 @@
second
end>>
OK
+/**
+ * test Lhs Semicolon Delim
+ */
<<
rule simple_rule
when
@@ -286,6 +361,9 @@
System.out.println( a4 );
end>>
OK
+/**
+ * test Not Node
+ */
<<
rule simple_rule
when
@@ -294,6 +372,9 @@
funky();
end>>
OK
+/**
+ * test Function Import
+ */
<<package HR1
import function abd.def.x
@@ -307,6 +388,9 @@
funky();
end>>
OK
+/**
+ * test Not Exist With Brackets
+ */
<<package HR1
rule simple_rule
@@ -317,6 +401,9 @@
funky();
end>>
OK
+/**
+ * test Damaged syntax
+ */
<<package HR2
rule simple_rule
@@ -327,6 +414,9 @@
funky();
end>>
FAIL
+/**
+ * test Simple Query
+ */
<<
query "simple_query"
@@ -336,6 +426,9 @@
end>>
OK
+/**
+ * test Query Rule Mixed
+ */
<<
package foo
@@ -368,6 +461,9 @@
end
>>
OK
+/**
+ * test Multiple Rules
+ */
<<package org.drools.test;
import org.drools.integrationtests.Cheese;
@@ -386,6 +482,9 @@
System.out.println("I like " + t );
end >>
OK
+/**
+ * test Basic Binding
+ */
<<package org.drools.test;
import org.drools.Cheese;
@@ -397,6 +496,9 @@
System.out.println("I like " + $type);
end >>
OK
+/**
+ * test Bound Variables
+ */
<<package org.drools.test;
import org.drools.Cheese;
@@ -410,6 +512,9 @@
System.out.println( $name + " likes " + $type);
end >>
OK
+/**
+ * test Or Nesting
+ */
<<
import org.drools.Person
@@ -421,6 +526,9 @@
System.out.println( "Mark and Michael" + bar );
end>>
OK
+/**
+ * test And Or Rules
+ */
<<
import org.drools.Person
@@ -432,6 +540,9 @@
System.out.println( "Mark and Michael" );
end>>
OK
+/**
+ * test Or With Binding
+ */
<<
import org.drools.Person
@@ -443,6 +554,9 @@
System.out.println( "Mark and Michael" + bar );
end>>
OK
+/**
+ * test Or Binding Complex
+ */
<<
rule simple_rule
@@ -454,6 +568,9 @@
System.out.println( "Mark and Michael" + bar );
end>>
OK
+/**
+ * test Or Binding With Brackets
+ */
<<rule simple_rule
when
foo : (
@@ -463,6 +580,9 @@
System.out.println( "Mark and Michael" + bar );
end>>
OK
+/**
+ * test Brackets Precedence
+ */
<<
rule simple_rule
when
@@ -471,6 +591,9 @@
go wild
end>>
OK
+/**
+ * test Eval Multiple
+ */
<<
rule simple_rule
when
@@ -484,6 +607,9 @@
end>>
OK
+/**
+ * test With Eval
+ */
<<
rule simple_rule
when
@@ -495,6 +621,9 @@
end>>
OK
+/**
+ * test With Retval
+ */
<<
rule simple_rule
when
@@ -504,6 +633,9 @@
end>>
OK
+/**
+ * test With Predicate
+ */
<<
rule simple_rule
when
@@ -512,6 +644,9 @@
foo bar
end>>
OK
+/**
+ * test Not With Constraint
+ */
<<package org.drools.test;
import org.drools.Cheese;
@@ -527,6 +662,9 @@
list.add( $person );
end >>
OK
+/**
+ * test Global
+ */
<<package org.drools.test;
import org.drools.Cheese;
@@ -541,6 +679,9 @@
end >>
OK
+/**
+ * test Functions
+ */
<<
import java.lang.String
@@ -569,6 +710,9 @@
>>
OK
+/**
+ * test Comment
+ */
<<#this starts with a comment
package foo.bar
@@ -585,6 +729,9 @@
then
end>>
OK
+/**
+ * test Attributes
+ */
<<
@@ -602,6 +749,9 @@
bar();
end>>
OK
+/**
+ * test Attributes alternate Syntax
+ */
<<
@@ -614,6 +764,9 @@
bar();
end>>
OK
+/**
+ * test Enumeration
+ */
<<
rule simple_rule
when
@@ -621,6 +774,9 @@
then
end>>
OK
+/**
+ * test Syntax Damage
+ */
<<rule one
when
exists Foo()
@@ -634,6 +790,9 @@
then
end>>
FAIL
+/**
+ * test Extra Lhs Newline
+ */
<<
rule "another test"
when
@@ -645,6 +804,9 @@
list.add( s );
end >>
OK
+/**
+ * test Sounds Like
+ */
<<package nesting;
@@ -659,6 +821,9 @@
System.out.println(p.name)
end>>
OK
+/**
+ * test Package Attributes
+ */
<<package com.foo;
agenda-group "x"
@@ -683,6 +848,9 @@
then
end>>
OK
+/**
+ * test Statement Ordering 1
+ */
<<
package com.foo;
@@ -712,6 +880,9 @@
import im.four;>>
OK
+/**
+ * test Rule Names Starting With Numbers
+ */
<<
rule "1. Do Stuff!"
when
@@ -723,6 +894,9 @@
then
end>>
OK
+/**
+ * test Eval With Newline
+ */
<<
rule simple_rule
when
@@ -747,6 +921,9 @@
end>>
OK
+/**
+ * test Syntax Damage
+ */
<<
rule simple_rule
when
@@ -756,6 +933,9 @@
Poof
end>>
FAIL
+/**
+ * test End Position
+ */
<<
@@ -770,6 +950,9 @@
end
>>
OK
+/**
+ * test Qualified Classname
+ */
<<package org.drools.test;
rule "Who likes Stilton"
@@ -779,6 +962,9 @@
System.out.println( $name + " likes " + $type);
end >>
OK
+/**
+ * test Accumulate
+ */
<<rule "AccumulateParserTest"
when
Integer() from accumulate( Person( age > 21 ),
@@ -788,6 +974,9 @@
then
end>>
OK
+/**
+ * test Accumulate With Bindings
+ */
<<rule "AccumulateParserTest"
when
$counter:Integer() from accumulate( $person : Person( age > 21 ),
@@ -797,6 +986,9 @@
then
end>>
OK
+/**
+ * test Collect
+ */
<<rule "CollectParserTest"
when
$personList : ArrayList() from collect( Person( age > 21 ) );
@@ -810,6 +1002,9 @@
String s = "\"\n\t\\";
end >>
OK
+/**
+ * test Nested CEs
+ */
<<rule "test nested CEs"
when
not ( State( $state : state ) and
@@ -821,6 +1016,9 @@
results.add("OK");
end>>
OK
+/**
+ * test For All
+ */
<<rule "ForallParserTest"
when
forall( Person( age > 21, $likes : likes )
@@ -828,6 +1026,9 @@
then
end>>
OK
+/**
+ * test In Operator
+ */
<<#testing 'in' operator
rule simple_rule
@@ -838,6 +1039,9 @@
consequence();
end>>
OK
+/**
+ * test Not In Operator
+ */
<<#testing not 'in' operator
rule simple_rule
@@ -848,6 +1052,9 @@
consequence();
end>>
OK
+/**
+ * test Semicolon
+ */
<<package org.drools;
global java.util.List list;
@@ -876,6 +1083,9 @@
>>
OK
+/**
+ * test Eval
+ */
<<package org.drools
rule "Test Parse"
@@ -886,6 +1096,9 @@
System.out.println("OK");
end >>
OK
+/**
+ * test Accumulate Reverse
+ */
<<rule "AccumulateReverseParserTest"
when
Integer() from accumulate( Person( age > 21 ),
@@ -896,6 +1109,9 @@
then
end>>
OK
+/**
+ * test Accumulate External Function
+ */
<<rule "AccumulateReverseParserTest"
when
Number() from accumulate( Person( $age : age > 21 ),
@@ -903,6 +1119,9 @@
then
end>>
OK
+/**
+ * test Collect With Nested From
+ */
<<rule "CollectParserTest"
when
#bellow statement makes no sense, but is useful to test parsing recursiveness
@@ -912,6 +1131,9 @@
>>
OK
+/**
+ * test Accumulate With Nested From
+ */
<<rule "AccumulateParserTest"
when
#bellow statement makes no sense, but is useful to test parsing recursiveness
@@ -922,6 +1144,9 @@
>>
OK
+/**
+ * test Or CE
+ */
<<package org.drools;
rule "testing OR CE"
@@ -932,11 +1157,21 @@
// do something
end >>
OK
+/**
+ * test Rule Single Line
+ */
<<rule "another test" salience 10 when eval( true ) then System.out.println(1); end>>
OK
+/**
+ * test Rule Two Lines
+ */
<<rule "another test" salience 10 when eval( true ) then System.out.println(1);
end>>
OK
+
+/**
+ * test Accumulate Multi Pattern
+ */
<<rule "AccumulateMultiPatternParserTest"
when
$counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),
@@ -946,6 +1181,9 @@
then
end>>
OK
+/**
+ * test Syntax Damage
+ */
<<package org.drools;
rule "test rule"
@@ -957,6 +1195,9 @@
end
>>
FAIL
+/**
+ * test Syntax Damage
+ */
<<package org.drools;
rule "Avoid NPE on wrong syntax"
@@ -966,6 +1207,10 @@
System.out.println("OK");
end>>
FAIL
+
+/**
+ * test Pluggable Operators
+ */
<<package org.drools;
rule "test pluggable operators"
@@ -980,325 +1225,95 @@
OK
lhs walks pattern_source:
+/**
+ * test Entry Point
+ */
<<StockTick( symbol=="ACME") from entry-point StreamA>>
OK
lhs_block walks normal_lhs_block:
- ""
- OK
- << $id : Something( duration == "foo") >>
- OK
- "foo3 : Bar(" FAIL
- <<
- Cheese(name == "Stilton", age==2001)
- Wine(name == "Grange", age == "1978", accolades contains "world champion")
- >>
- OK
- "Foo()"
- OK
- <<not Cheese(type == "stilton")>>
- OK
- <<
- Person(age < 42, location=="atlanta")
- or
- Person(name=="bob")
- >>
- OK
- <<
- Foo(bar == false)
- Foo(boo > -42)
- Foo(boo > -42.42)
- >>
- OK
- "Cheese( )"
- OK
- <<
- Col1() from something.doIt( foo,bar,42,"hello",{ a => "b", "something" => 42, "a" => foo, x => {x=>y}},"end", [a, "b", 42] )
- Col2()
- >>
- OK
- <<
- Col1() from doIt( foo,bar,42,"hello",{ a => "b", "something" => 42, "a" => foo, x => {x=>y}},"end", [a, "b", 42] )
- Col2()
- >>
- OK
- <<
- Col1() from something.doIt
- Col2()
- >>
- OK
- <<
- Col1() from something.doIt["key"]
- Col2()
- >>
- OK
- <<
- Col1() from doIt1( foo,bar,42,"hello",{ a => "b"}, [a, "b", 42] )
- .doIt2(bar, [a, "b", 42]).field["key"]
- Col2()
- >>
- OK
- <<
- foo3 : Bar(a==3)
- foo4 : Bar(a4:a==4)
- Baz()
- >>
- OK
- <<
- Person(age > 30 && < 40)
- Vehicle(type == "sedan" || == "wagon", age < 3)
- >>
- OK
- " foo3 : Bar(a==3) ; foo4 : Bar(a4:a==4) ; Baz()"
- OK
- <<
- not ( Cheese(type == "stilton") )
- exists ( Foo() )
- >>
- OK
- <<
- not ( Cheese(type == "stilton") )
- exists ( Foo() )
- >>
- OK
- <<
- a : (not ( Cheese(type == "stilton") ))
- exists ( Foo() )
- >>
- FAIL
- << Cheese( t:type == "cheddar" ) >>
- OK
- "Cheese( $type:type )"
- OK
+/**
+ * test Empty lhs
+ */
+ "" OK
+/**
+ * test Member Of
+ */
<<
- Cheese($type : type == "stilton")
- $person : Person($name : name == "bob", likes == $type)
- >>
- OK
- <<
- Person(name == "mark") or
- ( Person(type == "fan") and Cheese(type == "green") )
- >>
- OK
- <<
- Person(name == "mark") && Cheese(type == "stilton")
- Person(name == "mark") || Cheese(type == "stilton")
- >>
- OK
- <<
- foo : ( Person(name == "mark") or Person(type == "fan") )
- Cheese(type == "green")
- >>
- OK
- <<
- foo : ( Person(name == "mark")
- or
- Person(type == "fan") )
- >>
- OK
- <<
- foo : (
- Person(name == "mark") or Person(type == "fan")
- )
- >>
- OK
- <<
- ( (not Foo(x=="a") or Foo(x=="y") ) and ( Shoes() or Butt() ) )
- >>
- OK
- <<
- eval(abc("foo") + 5)
- Foo()
- eval(qed())
- Bar()
- >>
- OK
- <<
- Foo()
- Bar()
- eval(abc("foo"))
- >>
- OK
- "Foo(name== (a + b))"
- OK
-
- "Person( $age2:age -> ($age2 == $age1+2 ) )"
- OK
-
- "Foo(bar == Foo.BAR)"
- OK
- <<
- p: Person( name soundslike "Michael" )
- >>
- OK
- <<
- Foo()
- Bar()
- eval(
-
-
-
- abc(
-
- "foo") +
- 5
-
-
-
-
- )
- >>
- OK
-
- "eval(abc();)"
- FAIL
- <<
- Foo(
- bar == baz, la==laz
- )
- >>
- OK
-
- <<com.cheeseco.Cheese($type : type == "stilton")>>
- OK
-
- <<
- Integer() from accumulate( Person( age > 21 ),
- init( int x = 0; ),
- action( x++; ),
- result( new Integer(x) ) );
- >>
- OK
-
- <<
- $counter:Integer() from accumulate( $person : Person( age > 21 ),
- init( int x = 0; ),
- action( x++; ),
- result( new Integer(x) ) );
- >>
- OK
-
- "$personList : ArrayList() from collect( Person( age > 21 ) );"
- OK
-
- <<
- 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" ) )
- >>
- OK
-
- <<
- forall( Person( age > 21, $likes : likes )
- Cheese( type == $likes ) );
- >>
- OK
-
- <<
Country( $cities : city )
Person( city memberOf $cities )
>>
OK
-
+/**
+ * test Not Member Of
+ */
<<
Country( $cities : city )
Person( city not memberOf $cities )
>>
OK
-
- <<
- Person(age > 30 && < 40)
- Vehicle(type in ( "sedan", "wagon" ), age < 3)
- >>
- OK
-
- <<
- Person(age > 30 && < 40)
- Vehicle(type not in ( "sedan", "wagon" ), age < 3)
- >>
- OK
-
+/**
+ * test Constraint And Connective
+ */
<< Person( age < 42 && location=="atlanta") >>
OK
+/**
+ * test Constraint Or Connective
+ */
<< Person( age < 42 || location=="atlanta") >>
OK
-
+
+/**
+ * test Constraint Connectives Precedence
+ */
<<Person( age < 42 && location=="atlanta" || age > 20 && location=="Seatle" || location == "Chicago")>>
OK
-
+
+/**
+ * test Constraint Connectives Precedence With Bracks
+ */
<<Person( age < 42 && ( location=="atlanta" || age > 20 && location=="Seatle") || location == "Chicago")>>
OK
+/**
+ * test Constraint Connectives Precedence With Bracks2
+ */
<< Person( ( age == 70 && hair == "black" ) || ( age == 40 && hair == "pink" ) || ( age == 12 && ( hair == "yellow" || hair == "blue" ) ) ) >>
OK
+/**
+ * test Constraint Connectives Matches
+ */
<< Person( name matches "mark" || matches "bob" ) >>
OK
-
+
+/**
+ * test Not Contains
+ */
<<
City( $city : city )
Country( cities not contains $city )
>>
OK
+/**
+ * test Not Matches
+ */
<< Message( text not matches '[abc]*' ) >>
OK
+/**
+ * test Restrictions
+ */
<<Foo( bar > 1 || == 1 )>>
OK
-
- <<
- Pattern1();
- Pattern2() from x.y.z;
- Pattern5();
- Pattern6();
- Pattern7();
- Pattern3();
- Pattern4() from collect( Pattern5() );
- >>
- OK
-
- << eval( 3==3 ) >>
- OK
-
- <<
- Integer() from accumulate( Person( age > 21 ),
- init( int x = 0; ),
- action( x++; ),
- reverse( x--; ),
- result( new Integer(x) ) );
- >>
- OK
-
- <<
- Number() from accumulate( Person( $age : age > 21 ),
- average( $age ) );
- >>
- OK
+/**
+ * test Rule Parse Lhs 3
+ */
<<
- #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() ) );
- >>
- OK
-
- <<
- $personList : ArrayList() from accumulate( Person( $age : age > 21 || < 10 ) from collect( People() from $town.getPeople() ),
- max( $age ) );
- >>
- OK
-
- <<
- $p : Person( name == "bob" )
- $c : Cheese( type == $p.likes ) || Cheese( price == 10 )
- >>
- OK
-
- <<
(or
not Person()
(and Cheese()
@@ -1307,36 +1322,319 @@
>>
OK
- <<
- $counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),
- init( int x = 0; ),
- action( x++; ),
- result( new Integer(x) ) );
- >>
+/**
+ * test Restriction Connectives
+ */
+ <<Person( ( age ( > 60 && < 70 ) || ( > 50 && < 55 ) && hair == "black" ) || ( age == 40 && hair == "pink" ) || ( age == 12 && ( hair == "yellow" || hair == "blue" ) ))>>
OK
+
+/**
+ * test Accessor Paths
+ */
+ <<org . drools/*comment*/ .Message( text not matches $c#comment
+. property )
+>>
+ OK
+
+/**
+ * test General Lhs
+ */
+<< $id : Something( duration == "foo") >>
+ OK
+"foo3 : Bar(" FAIL
+<<
+Cheese(name == "Stilton", age==2001)
+Wine(name == "Grange", age == "1978", accolades contains "world champion")
+>> OK
+"Foo()"
+ OK
+<<not Cheese(type == "stilton")>>
+ OK
+<<
+Person(age < 42, location=="atlanta")
+or
+Person(name=="bob")
+>>
+ OK
+<<
+Foo(bar == false)
+Foo(boo > -42)
+Foo(boo > -42.42)
+>>
+ OK
+"Cheese( )"
+ OK
+<<
+Col1() from something.doIt( foo,bar,42,"hello",{ a => "b", "something" => 42, "a" => foo, x => {x=>y}},"end", [a, "b", 42] )
+Col2()
+>>
+ OK
+<<
+Col1() from doIt( foo,bar,42,"hello",{ a => "b", "something" => 42, "a" => foo, x => {x=>y}},"end", [a, "b", 42] )
+Col2()
+>>
+ OK
+<<
+Col1() from something.doIt
+Col2()
+>>
+ OK
+<<
+Col1() from something.doIt["key"]
+Col2()
+>>
+ OK
+<<
+Col1() from doIt1( foo,bar,42,"hello",{ a => "b"}, [a, "b", 42] )
+ .doIt2(bar, [a, "b", 42]).field["key"]
+Col2()
+>>
+ OK
+<<
+foo3 : Bar(a==3)
+foo4 : Bar(a4:a==4)
+Baz()
+>>
+ OK
+<<
+Person(age > 30 && < 40)
+Vehicle(type == "sedan" || == "wagon", age < 3)
+>>
+ OK
+" foo3 : Bar(a==3) ; foo4 : Bar(a4:a==4) ; Baz()"
+ OK
+<<
+not ( Cheese(type == "stilton") )
+exists ( Foo() )
+>>
+ OK
+<<
+not ( Cheese(type == "stilton") )
+exists ( Foo() )
+>>
+ OK
+<<
+a : (not ( Cheese(type == "stilton") ))
+exists ( Foo() )
+>>
+ FAIL
+<< Cheese( t:type == "cheddar" ) >>
+ OK
+
+"Cheese( $type:type )"
+ OK
+<<
+ Cheese($type : type == "stilton")
+ $person : Person($name : name == "bob", likes == $type)
+>>
+ OK
+<<
+Person(name == "mark") or
+( Person(type == "fan") and Cheese(type == "green") )
+>>
+ OK
+<<
+Person(name == "mark") && Cheese(type == "stilton")
+Person(name == "mark") || Cheese(type == "stilton")
+>>
+ OK
+<<
+foo : ( Person(name == "mark") or Person(type == "fan") )
+Cheese(type == "green")
+>>
+ OK
+<<
+foo : ( Person(name == "mark")
+ or
+ Person(type == "fan") )
+>>
+ OK
+<<
+foo : (
+ Person(name == "mark") or Person(type == "fan")
+ )
+>>
+ OK
+<<
+ ( (not Foo(x=="a") or Foo(x=="y") ) and ( Shoes() or Butt() ) )
+>>
+ OK
+<<
+eval(abc("foo") + 5)
+Foo()
+eval(qed())
+Bar()
+>>
+ OK
+<<
+Foo()
+Bar()
+eval(abc("foo"))
+>>
+ OK
+"Foo(name== (a + b))"
+ OK
+
+"Person( $age2:age -> ($age2 == $age1+2 ) )"
+ OK
+
+"Foo(bar == Foo.BAR)"
+ OK
+<<
+p: Person( name soundslike "Michael" )
+>>
+ OK
+
+<<
+Foo()
+Bar()
+eval(
+
+
+
+ abc(
+
+ "foo") +
+ 5
+
+
+
+
+ )
+>>
+ OK
+
+"eval(abc();)"
+ FAIL
+
+<<
+Foo(
+ bar == baz, la==laz
+ )
+ >>
+ OK
+
+<<com.cheeseco.Cheese($type : type == "stilton")>>
+ OK
+
+<<
+ Integer() from accumulate( Person( age > 21 ),
+ init( int x = 0; ),
+ action( x++; ),
+ result( new Integer(x) ) );
+>>
+ OK
+
+<<
+ $counter:Integer() from accumulate( $person : Person( age > 21 ),
+ init( int x = 0; ),
+ action( x++; ),
+ result( new Integer(x) ) );
+>>
+ OK
+
+"$personList : ArrayList() from collect( Person( age > 21 ) );"
+ OK
+
+
+<<
+ 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" ) )
+>>
+ OK
+
+<<
+ forall( Person( age > 21, $likes : likes )
+ Cheese( type == $likes ) );
+>>
+ OK
+
+
<<
- $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 )
+ Person(age > 30 && < 40)
+ Vehicle(type in ( "sedan", "wagon" ), age < 3)
>>
OK
- <<StockTick( symbol=="ACME") from entry-point StreamA>>
+ <<
+ Person(age > 30 && < 40)
+ Vehicle(type not in ( "sedan", "wagon" ), age < 3)
+ >>
OK
- <<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
+ <<
+ Pattern1();
+ Pattern2() from x.y.z;
+ Pattern5();
+ Pattern6();
+ Pattern7();
+ Pattern3();
+ Pattern4() from collect( Pattern5() );
+ >>
+ OK
+ << eval( 3==3 ) >>
+ OK
+
+ <<
+ Integer() from accumulate( Person( age > 21 ),
+ init( int x = 0; ),
+ action( x++; ),
+ reverse( x--; ),
+ result( new Integer(x) ) );
+ >>
+ OK
+
+ <<
+ Number() from accumulate( Person( $age : age > 21 ),
+ average( $age ) );
+ >>
+ OK
+
+ <<
+ #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() ) );
+ >>
+ OK
+
+ <<
+ $personList : ArrayList() from accumulate( Person( $age : age > 21 || < 10 ) from collect( People() from $town.getPeople() ),
+ max( $age ) );
+ >>
+ OK
+
+ <<
+ $p : Person( name == "bob" )
+ $c : Cheese( type == $p.likes ) || Cheese( price == 10 )
+ >>
+ OK
+ <<
+ $counter:Integer() from accumulate( $person : Person( age > 21 ) and Cheese( type == $person.likes ),
+ init( int x = 0; ),
+ action( x++; ),
+ result( new Integer(x) ) );
+ >>
+ OK
+
+ <<
+ $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 )
+ >>
+ OK
+
+ <<StockTick( symbol=="ACME") from entry-point StreamA>>
+ OK
+
+/**
+ * test Constraint
+ */
fact_expression walks constraints:
- <<$var : attr -> ( $var.equals("xyz") )>>
- OK
-
<<eval( $var.equals("xyz") )>>
OK
\ No newline at end of file
More information about the jboss-svn-commits
mailing list