Added basic return clause tests
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization@622 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/ret-01.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-01.aql
index 0c7e73e..72fb94a 100644
--- a/asterix-app/src/test/resources/runtimets/queries/flwor/ret-01.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-01.aql
@@ -4,5 +4,9 @@
* Date : 7th July 2012
*/
+// return string length
+
+write output to nc1:"rttest/flwor_ret-01.adm";
+
for $x in ["ten","twenty","thirty","forty","fifty","sixty","seventy","ninety"]
return string-length($x)
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/ret-02.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-02.aql
new file mode 100644
index 0000000..5201cc5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-02.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : Test return clause of the FLWOR expression
+ * Expected Result : Success
+ * Date : 7th July 2012
+ */
+
+// Return a string
+
+write output to nc1:"rttest/flwor_ret-02.adm";
+
+for $x in [true]
+return "this is a test string"
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/ret-03.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-03.aql
new file mode 100644
index 0000000..e51f787
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-03.aql
@@ -0,0 +1,11 @@
+/*
+ * Description : Test return clause of the FLWOR expression
+ * : Tes if expression then expression else expression in the return clause
+ * Expected Result : Success
+ * Date : 26th July 2012
+ */
+
+write output to nc1:"rttest/flwor_ret-03.adm";
+
+for $x in [true]
+return (if(true) then "YES" else "NO")
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/ret-04.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-04.aql
new file mode 100644
index 0000000..5974ed4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-04.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : Test return clause of the FLWOR expression
+ * : Tes if expression then expression else expression in the return clause
+ * Expected Result : Success
+ * Date : 26th July 2012
+ */
+
+write output to nc1:"rttest/flwor_ret-04.adm";
+
+
+let $a := 12345
+return (if($a > 999) then "GREATER" else "LESSER")
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/ret-05.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-05.aql
new file mode 100644
index 0000000..4f6249b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-05.aql
@@ -0,0 +1,11 @@
+/*
+ * Description : Test return clause of the FLWOR expression
+ * : For + Return within return clause
+ * Expected Result : Success
+ * Date : 26th July 2012
+ */
+
+write output to nc1:"rttest/flwor_ret-05.adm";
+
+let $b := 12345
+return (for $a in [[1,2,3],[4,5,6,7],[8,9],[0,4,5],[6,7,1],[2,3,4],[5,6,7],[8,9,0]] return $a)
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/ret-06.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-06.aql
new file mode 100644
index 0000000..e164cd3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-06.aql
@@ -0,0 +1,11 @@
+/*
+ * Description : Test return clause of the FLWOR expression
+ * : Return an un-ordered list
+ * Expected Result : Success
+ * Date : 26th July 2012
+ */
+
+write output to nc1:"rttest/flwor_ret-06.adm";
+
+let $b := 12345
+return {{"Welcome","UCI","Anteater","DBH","ICS"}}
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/ret-07.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-07.aql
new file mode 100644
index 0000000..73c86cc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-07.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : Test return clause of the FLWOR expression
+ * Expected Result : Success
+ * Date : 26th July 2012
+ */
+
+// return nothing
+
+write output to nc1:"rttest/flwor_ret-07.adm";
+
+let $b := true
+return {}
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/ret-08.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-08.aql
new file mode 100644
index 0000000..0b67dca
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-08.aql
@@ -0,0 +1,13 @@
+/*
+ * Description : Test return clause of the FLWOR expression
+ * Expected Result : Success
+ * Date : 26th July 2012
+ */
+
+// for and return in return clause
+
+write output to nc1:"rttest/flwor_ret-08.adm";
+
+for $a in [1,2,3,4,5,6,7,8]
+return {"a":$a,"inner-for":(for $b in [11,22,33,44,55,66,77,88] return $b)}
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/ret-09.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-09.aql
new file mode 100644
index 0000000..a186c99
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-09.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : Test return clause of the FLWOR expression
+ * Expected Result : Success
+ * Date : 26th July 2012
+ */
+
+// return a constant
+
+write output to nc1:"rttest/flwor_ret-09.adm";
+
+let $b:=true
+return 1
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/ret-10.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-10.aql
new file mode 100644
index 0000000..cc05a11
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-10.aql
@@ -0,0 +1,13 @@
+/*
+ * Description : Test return clause of the FLWOR expression
+ * Expected Result : Success
+ * Date : 26th July 2012
+ */
+
+// nested for and return within another for
+
+write output to nc1:"rttest/flwor_ret-10.adm";
+
+for $a in
+ for $b in [1,2,3,4,5,6,7,8,9,0] return $b
+return $a
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/ret-11.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-11.aql
new file mode 100644
index 0000000..3f54a13
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-11.aql
@@ -0,0 +1,10 @@
+/*
+ * Description : Test return clause of the FLWOR expression
+ * Expected Result : Success
+ * Date : 26th July 2012
+ */
+
+write output to nc1:"rttest/flwor_ret-11.adm";
+
+for $a in [1,2,3,4,5,6,7,8,9]
+return ($a + 1)
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/ret-12.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-12.aql
new file mode 100644
index 0000000..7ce8e90
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-12.aql
@@ -0,0 +1,10 @@
+/*
+ * Description : Test return clause of the FLWOR expression
+ * Expected Result : Success
+ * Date : 26th July 2012
+ */
+
+write output to nc1:"rttest/flwor_ret-12.adm";
+
+for $a in [1,2,3,4,5,6,7,8,9]
+return ($a - 1)
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/ret-13.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-13.aql
new file mode 100644
index 0000000..cc16cb3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-13.aql
@@ -0,0 +1,10 @@
+/*
+ * Description : Test return clause of the FLWOR expression
+ * Expected Result : Success
+ * Date : 26th July 2012
+ */
+
+write output to nc1:"rttest/flwor_ret-13.adm";
+
+for $a in [1,2,3,4,5,6,7,8,9]
+return ($a * 9)
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/ret-14.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-14.aql
new file mode 100644
index 0000000..4716e71
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-14.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : Test return clause of the FLWOR expression
+ * Expected Result : Success
+ * Date : 26th July 2012
+ */
+
+// Return record
+
+write output to nc1:"rttest/flwor_ret-14.adm";
+
+let $a := true
+return {"name":"John Doe", "age":26,"sex":"M","salary":50000,"dept":"HR"}
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/ret-15.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-15.aql
new file mode 100644
index 0000000..e17312d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-15.aql
@@ -0,0 +1,15 @@
+/*
+ * Description : Test return clause of the FLWOR expression
+ * Expected Result : Success
+ * Date : 30th July 2012
+ */
+
+// Return op1 and op2 or op3 and op4
+
+write output to nc1:"rttest/flwor_ret-15.adm";
+
+let $a := true
+let $b := false
+let $c := true
+let $d := false
+return ($a and $b or $c and $d)
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/ret-16.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-16.aql
new file mode 100644
index 0000000..185d7b6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-16.aql
@@ -0,0 +1,15 @@
+/*
+ * Description : Test return clause of the FLWOR expression
+ * Expected Result : Success
+ * Date : 30th July 2012
+ */
+
+// Return arithmetic-expr1 and arithmetic-expr2
+
+write output to nc1:"rttest/flwor_ret-16.adm";
+
+let $a := 100 + 100
+let $b := 13.4 * 14.97
+let $c := 9999 + 98677
+let $d := 34.67 / 5.324
+return (($a*$d) and ($b / $c))
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/ret-17.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-17.aql
new file mode 100644
index 0000000..f384f81
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-17.aql
@@ -0,0 +1,15 @@
+/*
+ * Description : Test return clause of the FLWOR expression
+ * Expected Result : Success
+ * Date : 30th July 2012
+ */
+
+// Return arithmetic-expr1 and arithmetic-expr2
+
+write output to nc1:"rttest/flwor_ret-17.adm";
+
+let $a := 100 + 100
+let $b := 13.4 * 14.97
+let $c := 9999 + 98677
+let $d := 34.67 / 5.324
+return (($a*$d) and ($b / $c))
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/ret-18.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-18.aql
new file mode 100644
index 0000000..cf858f8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-18.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : Test return clause of the FLWOR expression
+ * Expected Result : Success
+ * Date : 30th July 2012
+ */
+
+// Return an item from the ordered list
+
+write output to nc1:"rttest/flwor_ret-18.adm";
+
+let $a := [1,2,3,4,5,6,7]
+return $a[6]
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/ret-19.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-19.aql
new file mode 100644
index 0000000..4cfa63b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-19.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : Test return clause of the FLWOR expression
+ * Expected Result : Success
+ * Date : 30th July 2012
+ */
+
+// Return an item from the ordered list
+
+write output to nc1:"rttest/flwor_ret-19.adm";
+
+let $a := [[1,2,3,4,5,6,7],[7,8,9,10]]
+return $a[0]