Added FLWOR expr tests

git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization@559 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/for17.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/for17.aql
new file mode 100644
index 0000000..9e05da3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/for17.aql
@@ -0,0 +1,11 @@
+/*
+ * Description     : Test union of two lists
+ * Expected Result : Success
+ * Date            : 24th July 2012
+ */
+
+(for $a in [{"id":1234,"name":"John Doe","age":56,"salary":50000,"dept":"HR"}]
+return $a)
+union
+(for $b in [{"id":3424,"name":"Roger Sanders","age":46,"salary":60000,"dept":"Publishing"}]
+return $b)
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/let28.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/let28.aql
new file mode 100644
index 0000000..2f1b7ce
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/let28.aql
@@ -0,0 +1,8 @@
+/*
+ * Description     : Test let clause and floating point literals
+ * Expected Result : Success
+ * Date            : 24th July 2012
+ */
+
+let $a := [137.8932f,156f,.98781f, 436.219F,.89217F,16789F]
+return $a
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/let29.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/let29.aql
new file mode 100644
index 0000000..55d6319
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/let29.aql
@@ -0,0 +1,8 @@
+/*
+ * Description     : Test let clause and double literals
+ * Expected Result : Success
+ * Date            : 24th July 2012
+ */
+
+let $a := [137.8932,.98781,436.219,.89217,-234.324]
+return $a
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/let30.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/let30.aql
new file mode 100644
index 0000000..eebc11f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/let30.aql
@@ -0,0 +1,12 @@
+/*
+ * Description     : Test union of two lists, bind each list to a variable
+ * Expected Result : Success
+ * Date            : 24th July 2012
+ */
+
+// $a and $b are ordered lists with one Record each.
+
+let $a := [{"id":1234,"name":"John Doe","age":56,"salary":50000,"dept":"HR"}]
+let $b := [{"id":3424,"name":"Roger Sanders","age":46,"salary":60000,"dept":"Publishing"}]
+let $c := $a union $b
+return $c
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/let31.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/let31.aql
new file mode 100644
index 0000000..84ac278
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/let31.aql
@@ -0,0 +1,12 @@
+/*
+ * Description     : Test union of two lists, bind each list to a variable
+ * Expected Result : Success
+ * Date            : 24th July 2012
+ */
+
+// $a and $b hold one Record each.
+
+let $a := {"id":1234,"name":"John Doe","age":56,"salary":50000,"dept":"HR"}
+let $b := {"id":3424,"name":"Roger Sanders","age":46,"salary":60000,"dept":"Publishing"}
+let $c := $a union $b
+return $c
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/let32.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/let32.aql
new file mode 100644
index 0000000..0881fde
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/let32.aql
@@ -0,0 +1,11 @@
+/*
+ * Description     : Test union of two lists, bind each list to a variable
+ * Expected Result : Success
+ * Date            : 24th July 2012
+ */
+
+let $m := (for $a in [{"id":1234,"name":"John Doe","age":56,"salary":50000,"dept":"HR"}]
+return $a)
+let $n := (for $b in [{"id":3424,"name":"Roger Sanders","age":46,"salary":60000,"dept":"Publishing"}]
+return $b)
+return $m union $n
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-01.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-01.aql
new file mode 100644
index 0000000..a5aec23
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-01.aql
@@ -0,0 +1,9 @@
+/*
+ * Description     : Test order by clause of FLWOR
+ * Expected Result : Success
+ * Date            : 24th July 2012
+ */
+
+for $a in ["two","four","six","eight","ten","twenty","undo"]
+order by $a desc
+return $a
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-02.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-02.aql
new file mode 100644
index 0000000..4cc087c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-02.aql
@@ -0,0 +1,9 @@
+/*
+ * Description     : Test order by clause of FLWOR
+ * Expected Result : Success
+ * Date            : 24th July 2012
+ */
+
+for $a in ["two","four","six","eight","ten","twenty","undo"]
+order by $a asc
+return $a
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-03.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-03.aql
new file mode 100644
index 0000000..3792c74
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-03.aql
@@ -0,0 +1,9 @@
+/*
+ * Description     : Test order by clause of FLWOR
+ * Expected Result : Success
+ * Date            : 24th July 2012
+ */
+
+for $b in ["ten","twenty","thirty","forty","fifty","sixty","seventy","ninety"]
+order by string-concat([$b,"test"]) asc
+return string-concat([$b,"test"])
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-04.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-04.aql
new file mode 100644
index 0000000..e7a209b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-04.aql
@@ -0,0 +1,9 @@
+/*
+ * Description     : Test order by clause of FLWOR
+ * Expected Result : Success
+ * Date            : 24th July 2012
+ */
+
+for $b in ["ten","twenty","thirty","forty","fifty","sixty","seventy","ninety"]
+order by string-concat([$b,"test"]) desc
+return string-concat([$b,"test"])
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-05.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-05.aql
new file mode 100644
index 0000000..c3139f5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-05.aql
@@ -0,0 +1,9 @@
+/*
+ * Description     : Test order by clause of FLWOR
+ * Expected Result : Success
+ * Date            : 24th July 2012
+ */
+
+for $b in ["ten","twenty","thirty","forty","fifty","sixty","seventy","ninety"]
+order by string-concat([$b,""]) desc
+return string-concat([$b,""])
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-06.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-06.aql
new file mode 100644
index 0000000..791af3a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-06.aql
@@ -0,0 +1,9 @@
+/*
+ * Description     : Test order by clause of FLWOR
+ * Expected Result : Success
+ * Date            : 24th July 2012
+ */
+
+for $b in ["ten","twenty","thirty","forty","fifty","sixty","seventy","ninety"]
+order by string-concat([$b,""]) asc
+return string-concat([$b,""])
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-07.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-07.aql
new file mode 100644
index 0000000..9c85780
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-07.aql
@@ -0,0 +1,9 @@
+/*
+ * Description     : Test order by clause of FLWOR
+ * Expected Result : Success
+ * Date            : 24th July 2012
+ */
+
+for $b in ["ten","twenty","thirty","forty","fifty","sixty","seventy","ninety"]
+order by string-concat(["",$b]) desc
+return string-concat(["",$b])
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-08.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-08.aql
new file mode 100644
index 0000000..6a823c8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-08.aql
@@ -0,0 +1,9 @@
+/*
+ * Description     : Test order by clause of FLWOR
+ * Expected Result : Success
+ * Date            : 24th July 2012
+ */
+
+for $b in ["ten","twenty","thirty","forty","fifty","sixty","seventy","ninety"]
+order by string-concat(["",$b]) asc
+return string-concat(["",$b])
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-09.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-09.aql
new file mode 100644
index 0000000..0df3a9e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-09.aql
@@ -0,0 +1,9 @@
+/*
+ * Description     : Test order by clause of FLWOR
+ * Expected Result : Success
+ * Date            : 24th July 2012
+ */
+
+for $x in ["ten","twenty","thirty","forty","fifty","sixty","seventy","ninety"]
+order by string-concat([$x,$x]) asc 
+return string-concat([$x,$x])
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-10.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-10.aql
new file mode 100644
index 0000000..09a9026
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-10.aql
@@ -0,0 +1,9 @@
+/*
+ * Description     : Test order by clause of FLWOR
+ * Expected Result : Success
+ * Date            : 24th July 2012
+ */
+
+for $x in ["ten","twenty","thirty","forty","fifty","sixty","seventy","ninety"]
+order by string-concat([$x,$x]) desc 
+return string-concat([$x,$x])
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-11.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-11.aql
new file mode 100644
index 0000000..5b79987
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-11.aql
@@ -0,0 +1,9 @@
+/*
+ * Description     : Test order by clause of FLWOR
+ * Expected Result : Success
+ * Date            : 24th July 2012
+ */
+
+for $x in [1,3,4,5,2,3,33,55,43,12,34,45,67,66,89,0,-1,999]
+order by ($x+$x) asc
+return ($x+$x)
diff --git a/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-12.aql b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-12.aql
new file mode 100644
index 0000000..b620a05
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/order-by-12.aql
@@ -0,0 +1,9 @@
+/*
+ * Description     : Test order by clause of FLWOR
+ * Expected Result : Success
+ * Date            : 24th July 2012
+ */
+
+for $x in [[1,3,4],[5,2],[3,33,55],[43,12,34],[45,67],[66,89,0],[-1,999]]
+order by len($x)
+return { "x":$x,"len($x)":len($x) }
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
new file mode 100644
index 0000000..0c7e73e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/flwor/ret-01.aql
@@ -0,0 +1,8 @@
+/*
+ * Description      :  Test return clause of the FLWOR expression
+ * Expected Result  :  Success
+ * Date             :  7th July 2012
+ */
+
+for $x in ["ten","twenty","thirty","forty","fifty","sixty","seventy","ninety"]
+return string-length($x)