Commit 4fa0d6cf authored by Julien Lopez's avatar Julien Lopez
Browse files

Add cql to the test suites. Subdirectories TREE and XMP integrated

to the main suite, R and SEQ to the extended suite.
parent 7c78868c
(* include "tests/cql/TREE/type-TREE.cd";; *) include "type-TREE.cd";;
(* include "tests/cql/TREE/q2.cd";; *) (* include "tests/cql/TREE/q2.cd";; *)
(* (*
......
(* include "tests/cql/TREE/type-TREE.cd";; *) include "type-TREE.cd";;
(* include "tests/cql/TREE/q3.cd";; *) (* include "tests/cql/TREE/q3.cd";; *)
(*How many sections are in Book1, and how many figures? *) (*How many sections are in Book1, and how many figures? *)
......
(* include "tests/cql/TREE/type-TREE.cd";; *) include "tests/cql/TREE/type-TREE.cd";;
(* include "tests/cql/TREE/q4.cd";; *) (* include "tests/cql/TREE/q4.cd";; *)
(* How many top-level sections are in Book1? *) (* How many top-level sections are in Book1? *)
......
type Reviews =<reviews>[Entry*];; type Reviews =<reviews>[Entry*];;
type Entry = <entry> [ Title Price Review];; type Entry = <entry> [ Title Price Review];;
(*type Title = <title>[PCDATA];;*) type Title = <title>[PCDATA];;
(*type Price= <price>[PCDATA];;*) type Price= <price>[PCDATA];;
type Review =<review>[PCDATA];; type Review =<review>[PCDATA];;
let amazon= let amazon=
......
(* include "tests/cql/doc.cd";; *) include "doc.cd";;
let q1x = let q1x =
<bib> <bib>
......
...@@ -24,10 +24,8 @@ Solution in XQuery: ...@@ -24,10 +24,8 @@ Solution in XQuery:
</bib> </bib>
include "tests/cql/doc.cd" ;;
include "tests/cql/q11.cd";;
*) *)
include "doc.cd" ;;
(* in CQLx *) (* in CQLx *)
......
...@@ -3,6 +3,7 @@ Create a flat list of all the title-author pairs, ...@@ -3,6 +3,7 @@ Create a flat list of all the title-author pairs,
with each pair enclosed in a "result" element. with each pair enclosed in a "result" element.
*) *)
include "doc.cd";;
let q2x = let q2x =
<results> <results>
......
include "doc.cd";;
let q3x= let q3x=
<results> <results>
select <result> ([b]/<title>_ @ [b]/<author>_ ) select <result> ([b]/<title>_ @ [b]/<author>_ )
......
include "doc.cd";;
(* functions *) (* functions *)
let fun member ((Any,Any) -> Bool) let fun member ((Any,Any) -> Bool)
|(s,[h;t]) -> if (s=h) then `true else member (s,t) |(s,[h;t]) -> if (s=h) then `true else member (s,t)
|(s,_) -> `false;; |(_,_) -> `false;;
let fun distinct_values ([Any*] -> [Any*]) let fun distinct_values ([Any*] -> [Any*])
| l -> let fun aux (([Any*],[Any*])->[Any*]) | l -> let fun aux (([Any*],[Any*])->[Any*])
......
include "doc.cd";;
(*********function *********) (*********function *********)
let fun count_bad([Any*]->Int) let fun count_bad([Any*]->Int)
[] -> 0 [] -> 0
......
include "tests/cql/doc.cd";; include "doc.cd";;
(* tri a bulle *) (* tri a bulle *)
...@@ -14,8 +14,6 @@ let fun order ([Any*] -> [Any*]) ...@@ -14,8 +14,6 @@ let fun order ([Any*] -> [Any*])
if l = l2 then l if l = l2 then l
else order(l2);; else order(l2);;
mmh not recursive terminal?
(********************** (**********************
List the titles and years of all books published by Addison-Wesley after 1991, in alphabetic order. List the titles and years of all books published by Addison-Wesley after 1991, in alphabetic order.
...@@ -48,7 +46,7 @@ select <book year=year>[t] ...@@ -48,7 +46,7 @@ select <book year=year>[t]
from <bib>[b::Book*] in [doc], from <bib>[b::Book*] in [doc],
<book year=year>[t&Title _* <publisher>['Addison-Wesley'] ;_ ] in b <book year=year>[t&Title _* <publisher>['Addison-Wesley'] ;_ ] in b
where int_of(year) >> 1991 where int_of(year) >> 1991
) in <bib>q ;; ) in <bib>q;;
(* here year attribute is set as String (see include "tests/cql/doc.cd") (* here year attribute is set as String (see include "tests/cql/doc.cd")
so we needs use Where clause so we needs use Where clause
...@@ -56,7 +54,7 @@ otherwise we can use <book year=1991--*>[...] ...@@ -56,7 +54,7 @@ otherwise we can use <book year=1991--*>[...]
idem, in q7x, if atribute year is declared as int idem, in q7x, if atribute year is declared as int
instead of y in [b]/@year where int_of(y) >> 1991 instead of y in [b]/@year where int_of(y) >> 1991
we could use [b]/<book year=1991--*>[_* <publisher>"Ad... we could use [b]/<book year=1991--*>[_* <publisher>"Ad..."
*) *)
let q7x = let q7x =
......
...@@ -3,9 +3,8 @@ In the document books.xml, ...@@ -3,9 +3,8 @@ In the document books.xml,
find all section or chapter titles that contain the word XML, find all section or chapter titles that contain the word XML,
regardless of the level of nesting. regardless of the level of nesting.
include "tests/cql/books.cd" ;;
include "tests/cql/q9.cd";;
*) *)
include "books.cd" ;;
(* This query needs the Xpath // *) (* This query needs the Xpath // *)
(* first version of // *) (* first version of // *)
......
...@@ -84,6 +84,30 @@ done ...@@ -84,6 +84,30 @@ done
echo "$SUCCESS / $TOTAL passed." echo "$SUCCESS / $TOTAL passed."
test $SUCCESS -ne $TOTAL && RET=1 test $SUCCESS -ne $TOTAL && RET=1
# Test cql
SUCCESS=0
TOTAL=0
CQLLOG=$ROOT/cql/log
GOODTESTS="$ROOT/cql/TREE/* $ROOT/cql/XMP/*"
EXTENDEDTESTS="$ROOT/cql/R/* $ROOT/cql/SEQ/*"
echo -n "Tests on cql: "
echo > $CQLLOG
if test $EXTENDED = "true"; then GOODTESTS="$GOODTESTS $EXTENDEDTESTS"; fi
for i in $GOODTESTS; do
TOTAL=$(($TOTAL+1))
echo "==============`echo $i | rev | cut -d "/" -f -1 | rev`===============" >> $CQLLOG;
$ROOT/../cduce $i > /dev/null 2>> $CQLLOG;
if test $? -eq 0; then SUCCESS=$(($SUCCESS+1)); fi
done
echo "$SUCCESS / $TOTAL passed."
test $SUCCESS -ne $TOTAL && RET=1
# Test misc # Test misc
echo -n "Tests on misc: " echo -n "Tests on misc: "
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment