Change project-name capitalisation from "cql-java" to "CQL-Java".
[cql-java-moved-to-github.git] / test / regression / README
1 $Id: README,v 1.6 2002-12-09 16:29:44 mike Exp $
2
3 CQL-Java's regression-testing framework
4 ---------------------------------------
5
6 "queries.raw" is the file of test queries as provided by Rob.
7 "mktests" parses the raw file into sections and individual queries
8 "sections" is the top-level directory created by that program.
9   "01", "02" etc. represent the sections within the raw file
10     "01/name", "02/name", etc. contain the names of the sections.
11     "01/01.cql", "01/02.cql" etc. are the CQL queries themselves.
12 "mkanswers" uses a trusted CQL compiler to generate corresponding XCQL.
13     "01/01.xcql", "01/02.xcql" etc. are the compiled XCQL queries.
14
15 Apart from the CQL files, all of the files described to this point are
16 included in the distribution, with the "trusted" XCQL output produced
17 by my own compiler, and used for regression testing of new versions.
18 The CQL files are re-created from "queries.raw" as required.  But
19 you're welcome to "make refclean" and rebuild it with mkanswers, to
20 contain the trusted compiler output of your choice.
21
22 "runtests" compares the output of a nominated CQL compiler with
23 existing XCQL files.  Most often, you'll use this to compare the
24 results of your own build of CQL-Java with those of my build.  I'll
25 use it to test new versions, and people who've written other compilers
26 can use it to test their code.
27
28 "Makefile" controls the building of all this.  You'll need to edit it
29 if you want to use different compilers and suchlike from what's
30 written into it, so it may be easier to run the tests by hand -- but
31 it's a useful reference for the kinds of commands you might need,
32 anyway.  In general, "make" will run the regression tests, creating
33 whatever CQL and/or XCQL files it needs; if you do "make refclean"
34 first, then the next "make" will rebuild the reference results.
35
36 So, for example, if you think Rob Sanderson's parser, CQLParser.py, is
37 reliable, and you want to test my parser, CQL-Java's CQLParser class,
38 against its results, do this:
39
40         make refclean
41         ./mktests queries.raw
42         ./mkanswers CQLParser.py
43         ./runtests ../../bin/CQLParser ./xmlpp.pl
44
45 The second argument to ./runtests is the name of a program to use to
46 normalise XML, so that the trusted output and the output being tested
47 can be compared for equivalence rather than just for being
48 byte-identical.  (If you want to test for byte-identical XCQL, then
49 use "cat" as the second argument.)  xmlpp.pl is a fine XML
50 pretty-printer from DecisionSoft, found at
51         http://software.decisionsoft.com/tools.html
52
53
54 Appendix: queries that should fail
55 ----------------------------------
56
57 The following queries are included in Rob's master list, in a final
58 section called "Invalid searches [should error]".  They are all
59 expected to fail in various ways.  I've taken them out of
60 "queries.raw" because it's uninteresting, not to mention rather
61 disturbing, to watch compilers fail.  More important, I think, to
62 demonstrate correct behaviour for the known-to-work queries.
63
64 >
65 ===
66 cat or
67 index any 
68 index any/wrong term
69 a prox/wrong b
70 ()
71 (a
72 index any fish)
73 (cat any dog or ())
74 title = ("illegal parentheses")
75 "quoted" any "illegal quotes"
76 > illegal="urn:missingQuery"
77 "fish" and > illegal="urn:invalidPrefixLocation" "chips"