Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
4fa0d6cf
Commit
4fa0d6cf
authored
Mar 05, 2014
by
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
Changes
13
Hide whitespace changes
Inline
Side-by-side
tests/cql/TREE/q2.cd
View file @
4fa0d6cf
(*
include "
tests/cql/TREE/
type-TREE.cd";;
*)
include "type-TREE.cd";;
(* include "tests/cql/TREE/q2.cd";; *)
(*
...
...
tests/cql/TREE/q3.cd
View file @
4fa0d6cf
(*
include "
tests/cql/TREE/
type-TREE.cd";;
*)
include "type-TREE.cd";;
(* include "tests/cql/TREE/q3.cd";; *)
(*How many sections are in Book1, and how many figures? *)
...
...
tests/cql/TREE/q4.cd
View file @
4fa0d6cf
(*
include "tests/cql/TREE/type-TREE.cd";;
*)
include "tests/cql/TREE/type-TREE.cd";;
(* include "tests/cql/TREE/q4.cd";; *)
(* How many top-level sections are in Book1? *)
...
...
tests/cql/XMP/doc-q5.cd
View file @
4fa0d6cf
type Reviews =<reviews>[Entry*];;
type Entry = <entry> [ Title Price Review];;
(*
type Title = <title>[PCDATA];;
*)
(*
type Price= <price>[PCDATA];;
*)
type Title = <title>[PCDATA];;
type Price= <price>[PCDATA];;
type Review =<review>[PCDATA];;
let amazon=
...
...
tests/cql/XMP/q1.cd
View file @
4fa0d6cf
(*
include "
tests/cql/
doc.cd";;
*)
include "doc.cd";;
let q1x =
<bib>
...
...
tests/cql/XMP/q11.cd
View file @
4fa0d6cf
...
...
@@ -24,10 +24,8 @@ Solution in XQuery:
</bib>
include "tests/cql/doc.cd" ;;
include "tests/cql/q11.cd";;
*)
include "doc.cd" ;;
(* in CQLx *)
...
...
tests/cql/XMP/q2.cd
View file @
4fa0d6cf
...
...
@@ -3,6 +3,7 @@ Create a flat list of all the title-author pairs,
with each pair enclosed in a "result" element.
*)
include "doc.cd";;
let q2x =
<results>
...
...
tests/cql/XMP/q3.cd
View file @
4fa0d6cf
include "doc.cd";;
let q3x=
<results>
select <result> ([b]/<title>_ @ [b]/<author>_ )
...
...
tests/cql/XMP/q4.cd
View file @
4fa0d6cf
include "doc.cd";;
(* functions *)
let fun member ((Any,Any) -> Bool)
|(s,[h;t]) -> if (s=h) then `true else member (s,t)
|(
s
,_) -> `false;;
|(
_
,_) -> `false;;
let fun distinct_values ([Any*] -> [Any*])
| l -> let fun aux (([Any*],[Any*])->[Any*])
...
...
tests/cql/XMP/q6.cd
View file @
4fa0d6cf
include "doc.cd";;
(*********function *********)
let fun count_bad([Any*]->Int)
[] -> 0
...
...
tests/cql/XMP/q7.cd
View file @
4fa0d6cf
include "
tests/cql/
doc.cd";;
include "doc.cd";;
(* tri a bulle *)
...
...
@@ -14,8 +14,6 @@ let fun order ([Any*] -> [Any*])
if l = l2 then l
else order(l2);;
mmh not recursive terminal?
(**********************
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]
from <bib>[b::Book*] in [doc],
<book year=year>[t&Title _* <publisher>['Addison-Wesley'] ;_ ] in b
where int_of(year) >> 1991
) in <bib>q
;;
) in <bib>q;;
(* here year attribute is set as String (see include "tests/cql/doc.cd")
so we needs use Where clause
...
...
@@ -56,7 +54,7 @@ otherwise we can use <book year=1991--*>[...]
idem, in q7x, if atribute year is declared as int
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 =
...
...
tests/cql/XMP/q9.cd
View file @
4fa0d6cf
...
...
@@ -3,9 +3,8 @@ In the document books.xml,
find all section or chapter titles that contain the word XML,
regardless of the level of nesting.
include "tests/cql/books.cd" ;;
include "tests/cql/q9.cd";;
*)
include "books.cd" ;;
(* This query needs the Xpath // *)
(* first version of // *)
...
...
tests/test.sh
View file @
4fa0d6cf
...
...
@@ -84,6 +84,30 @@ done
echo
"
$SUCCESS
/
$TOTAL
passed."
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
echo
-n
"Tests on misc: "
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment