+++ /dev/null
-# $Id: Makefile,v 1.3 2002-11-03 16:49:38 mike Exp $
-
-sections/01/01.xcql: sections
- ./mkanswers CQLParser
-# OR ./mkanswers ../../srw/cql/cqlparse3
-# OR ./mkanswers ../../rob/CQLParser.py
-
-sections: mktests queries.raw
- rm -rf sections
- ./mktests queries.raw
-
-adam-tests: sections/01/01.xcql
- ./runtests ../../srw/cql/cqlparse3
-
-rob-tests: sections/01/01.xcql
- ./runtests ../../rob/CQLParser.py
-
-clean:
- find sections -name '*.xcql' -print | xargs rm -f
-
-distclean:
- rm -rf sections
-
+++ /dev/null
-$Id: README,v 1.3 2002-11-03 16:49:38 mike Exp $
-
-"queries.raw" is the file of test queries as provided by Rob.
-"mktests" parses the raw file into sections and individual queries
-"sections" is the top-level directory created by that program.
- "01", "02" etc. represent the sections within the raw file
- "01/name", "02/name", etc. contain the names of the sections.
- "01/01.cql", "01/02.cql" etc. are the CQL queries themselves.
-"mkanswers" uses a trusted CQL compiler to generate corresponding XCQL.
- "01/01.xcql", "01/02.xcql" etc. are the compiled XCQL queries.
-"runtests" compares the output of a CQL compiler with existing XCQL files.
-
-"Makefile" controls the building of all this. You'll need to edit it
-if you want to use different compilers and suchlike from what's
-written into it, so it may be easier to run the tests by hand -- but
-it's a useful reference for the kinds of commands you might need,
-anyway.
-
-So, for example, if you think Rob Sanderson's parser, CQLParser.py, is
-reliable, and you want to test my parser, cql-java's CQLParser class,
-against its results, do this:
-
- rm -rf sections
- ./mktests queries.raw
- ./mkanswers CQLParser.py
- ./runtests CQLParser sgmlnorm
-
-(Except that sgmlnorm is useless -- gotta find something better.)
-
-Also: there's a nasty hack here called "showtest" which, when run like
-``./showtest 07/03'', will show you the ways in which my output
-differs from Adam's. I'll probably delete it soon.
-
-Also: there's a subdirectory "random" which tests in a completely
-different way. That ought to be a sister directory with this one, and
-will be when I move the rest of this stuff down a level.
+++ /dev/null
-#!/usr/bin/perl -w
-
-use IO::File;
-use strict;
-
-if (@ARGV != 1) {
- print STDERR "Usage: $0 <trusted-CQL-compiler>\n";
- exit(1);
-}
-my $compiler = $ARGV[0];
-
-while (<sections/*>) {
- my $sdir = $_;
- s@sections/@@;
- print "answering section $_ - ", read_file("$sdir/name"), "\n";
-
- while (<$sdir/*.cql>) {
- my $qfile = $_;
- s@sections/([0-9]+/.*)\.cql@$1@;
- my $query = read_file($qfile);
- my $afile = $qfile;
- $afile =~ s/\.cql$/.xcql/;
- print " query $_ - $query\n";
- my $fh = new IO::File("| $compiler > $afile")
- or die "can't run compiler '$compiler': $!";
- print $fh $query;
- $fh->close();
- }
-}
-
-sub read_file {
- my($name) = @_;
-
- my $fh = new IO::File("<$name")
- or die "can't read '$name': $!";
- my $contents = join('', <$fh>);
- $fh->close();
- return $contents;
-}
+++ /dev/null
-#!/usr/bin/perl -w
-
-use IO::File;
-use strict;
-
-mkdir "sections";
-my $section = 0;
-my $dir;
-my $query;
-
-while (<>) {
- chomp();
- s/[ \t]+$//;
- next if /^$/;
-
- if (s/^#[ \t]*//) {
- $section++;
- $query = 0;
- $dir = "sections/" . substr("0$section", -2);
- mkdir $dir;
- write_file("$dir/name", $_);
- print "created section $section ($dir) - $_\n";
- next;
- }
-
- die "query before first section header"
- if !defined $dir;
-
- $query++;
- my $filename = $dir . "/" . substr("0$query", -2) . ".cql";
- write_file($filename, $_);
- print " added query $query ($filename) - $_\n";
-}
-
-sub write_file {
- my($name, $contents) = @_;
-
- my $fh = new IO::File(">$name")
- or die "can't create '$name': $!";
- $fh->print($contents);
- $fh->close();
-}
+++ /dev/null
-# Simple
-
-cat
-"cat"
-comp.os.linux
-xml:element
-"<xml:element>"
-"="
-"prox/word/>=/5"
-("cat")
-((dog))
-
-# index relation term
-
-title = "fish"
-title exact fish
-title any fish
-title all fish
-title > 9
-title >= 23
-dc.title any "fish chips"
-dc.title any/stem fish
-dc.fish all/stem/fuzzy "fish chips"
-(title any frog)
-((dc.title any/stem "frog pond"))
-
-# Simple Boolean
-
-cat or dog
-cat and fish
-cat not frog
-(cat not frog)
-"cat" not "fish food"
-xml and "prox/word/"
-a or b and c not d
-
-# I/R/T plus Boolean
-
-bath.author any fish and dc.title all "cat dog"
-(title any/stem "fish dog" or "and")
-
-# Prox
-
-cat prox hat
-cat prox/word/=/3/ordered hat
-cat prox///3 hat
-"fish food" prox/sentence "and"
-title all "chips frog" prox/word//5 "any"
-(dc.author exact "jones" prox///5 title >= "smith")
-((cat prox hat))
-
-# Special characters
-(cat^)
-"cat"
-"^cat says \"fish\""
-"cat*fish"
-cat?dog
-(("^cat*fishdog\"horse?"))
-
-# Nesting Parens
-
-(((cat or dog) or horse) and frog)
-(cat and dog) or (horse and frog)
-(cat and (horse or frog)) and chips
-
-# Lame searches
-
-"any" or "all:stem" and "all" exact "any" prox/word "prox"="fuzzy"
-((((((((("any")))))))))
-
-
-# Invalid searches [should error]
-
->
-===
-cat or
-index any
-index any/wrong term
-a prox/wrong b
-()
-(a
-index any fish)
-(cat any dog or ())
-fred and any
-((fred or all))
-sorry = (mike)
--- /dev/null
+# $Id: Makefile,v 1.1 2002-11-03 16:53:04 mike Exp $
+
+sections/01/01.xcql: sections
+ ./mkanswers CQLParser
+# OR ./mkanswers ../../srw/cql/cqlparse3
+# OR ./mkanswers ../../rob/CQLParser.py
+
+sections: mktests queries.raw
+ rm -rf sections
+ ./mktests queries.raw
+
+adam-tests: sections/01/01.xcql
+ ./runtests ../../srw/cql/cqlparse3
+
+rob-tests: sections/01/01.xcql
+ ./runtests ../../rob/CQLParser.py
+
+clean:
+ find sections -name '*.xcql' -print | xargs rm -f
+
+distclean:
+ rm -rf sections
+
--- /dev/null
+$Id: README,v 1.1 2002-11-03 16:53:04 mike Exp $
+
+"queries.raw" is the file of test queries as provided by Rob.
+"mktests" parses the raw file into sections and individual queries
+"sections" is the top-level directory created by that program.
+ "01", "02" etc. represent the sections within the raw file
+ "01/name", "02/name", etc. contain the names of the sections.
+ "01/01.cql", "01/02.cql" etc. are the CQL queries themselves.
+"mkanswers" uses a trusted CQL compiler to generate corresponding XCQL.
+ "01/01.xcql", "01/02.xcql" etc. are the compiled XCQL queries.
+"runtests" compares the output of a CQL compiler with existing XCQL files.
+
+"Makefile" controls the building of all this. You'll need to edit it
+if you want to use different compilers and suchlike from what's
+written into it, so it may be easier to run the tests by hand -- but
+it's a useful reference for the kinds of commands you might need,
+anyway.
+
+So, for example, if you think Rob Sanderson's parser, CQLParser.py, is
+reliable, and you want to test my parser, cql-java's CQLParser class,
+against its results, do this:
+
+ rm -rf sections
+ ./mktests queries.raw
+ ./mkanswers CQLParser.py
+ ./runtests CQLParser sgmlnorm
+
+(Except that sgmlnorm is useless -- gotta find something better.)
+
+Also: there's a nasty hack here called "showtest" which, when run like
+``./showtest 07/03'', will show you the ways in which my output
+differs from Adam's. I'll probably delete it soon.
--- /dev/null
+#!/usr/bin/perl -w
+
+use IO::File;
+use strict;
+
+if (@ARGV != 1) {
+ print STDERR "Usage: $0 <trusted-CQL-compiler>\n";
+ exit(1);
+}
+my $compiler = $ARGV[0];
+
+while (<sections/*>) {
+ my $sdir = $_;
+ s@sections/@@;
+ print "answering section $_ - ", read_file("$sdir/name"), "\n";
+
+ while (<$sdir/*.cql>) {
+ my $qfile = $_;
+ s@sections/([0-9]+/.*)\.cql@$1@;
+ my $query = read_file($qfile);
+ my $afile = $qfile;
+ $afile =~ s/\.cql$/.xcql/;
+ print " query $_ - $query\n";
+ my $fh = new IO::File("| $compiler > $afile")
+ or die "can't run compiler '$compiler': $!";
+ print $fh $query;
+ $fh->close();
+ }
+}
+
+sub read_file {
+ my($name) = @_;
+
+ my $fh = new IO::File("<$name")
+ or die "can't read '$name': $!";
+ my $contents = join('', <$fh>);
+ $fh->close();
+ return $contents;
+}
--- /dev/null
+#!/usr/bin/perl -w
+
+use IO::File;
+use strict;
+
+mkdir "sections";
+my $section = 0;
+my $dir;
+my $query;
+
+while (<>) {
+ chomp();
+ s/[ \t]+$//;
+ next if /^$/;
+
+ if (s/^#[ \t]*//) {
+ $section++;
+ $query = 0;
+ $dir = "sections/" . substr("0$section", -2);
+ mkdir $dir;
+ write_file("$dir/name", $_);
+ print "created section $section ($dir) - $_\n";
+ next;
+ }
+
+ die "query before first section header"
+ if !defined $dir;
+
+ $query++;
+ my $filename = $dir . "/" . substr("0$query", -2) . ".cql";
+ write_file($filename, $_);
+ print " added query $query ($filename) - $_\n";
+}
+
+sub write_file {
+ my($name, $contents) = @_;
+
+ my $fh = new IO::File(">$name")
+ or die "can't create '$name': $!";
+ $fh->print($contents);
+ $fh->close();
+}
--- /dev/null
+# Simple
+
+cat
+"cat"
+comp.os.linux
+xml:element
+"<xml:element>"
+"="
+"prox/word/>=/5"
+("cat")
+((dog))
+
+# index relation term
+
+title = "fish"
+title exact fish
+title any fish
+title all fish
+title > 9
+title >= 23
+dc.title any "fish chips"
+dc.title any/stem fish
+dc.fish all/stem/fuzzy "fish chips"
+(title any frog)
+((dc.title any/stem "frog pond"))
+
+# Simple Boolean
+
+cat or dog
+cat and fish
+cat not frog
+(cat not frog)
+"cat" not "fish food"
+xml and "prox/word/"
+a or b and c not d
+
+# I/R/T plus Boolean
+
+bath.author any fish and dc.title all "cat dog"
+(title any/stem "fish dog" or "and")
+
+# Prox
+
+cat prox hat
+cat prox/word/=/3/ordered hat
+cat prox///3 hat
+"fish food" prox/sentence "and"
+title all "chips frog" prox/word//5 "any"
+(dc.author exact "jones" prox///5 title >= "smith")
+((cat prox hat))
+
+# Special characters
+(cat^)
+"cat"
+"^cat says \"fish\""
+"cat*fish"
+cat?dog
+(("^cat*fishdog\"horse?"))
+
+# Nesting Parens
+
+(((cat or dog) or horse) and frog)
+(cat and dog) or (horse and frog)
+(cat and (horse or frog)) and chips
+
+# Lame searches
+
+"any" or "all:stem" and "all" exact "any" prox/word "prox"="fuzzy"
+((((((((("any")))))))))
+
+
+# Invalid searches [should error]
+
+>
+===
+cat or
+index any
+index any/wrong term
+a prox/wrong b
+()
+(a
+index any fish)
+(cat any dog or ())
+fred and any
+((fred or all))
+sorry = (mike)
--- /dev/null
+#!/usr/bin/perl -w
+
+use IO::File;
+use strict;
+
+if (@ARGV != 2) {
+ print STDERR "Usage: $0 <CQL-compiler> <XML-normaliser>\n";
+ exit(1);
+}
+my $compiler = $ARGV[0];
+my $norman = $ARGV[1];
+
+while (<sections/*>) {
+ my $sdir = $_;
+ s@sections/@@;
+ print "testing section $_ - ", read_file("$sdir/name"), "\n";
+
+ while (<$sdir/*.cql>) {
+ my $qfile = $_;
+ s@sections/([0-9]+/.*)\.cql@$1@;
+ my $query = read_file($qfile);
+ my $afile = $qfile;
+ $afile =~ s/\.cql$/.xcql/;
+ print " query $_ - $query\n";
+ my $correct = read_file("$norman < $afile |");
+ my $tested = read_file("$compiler < $qfile | $norman |")
+ or die "can't run test compiler '$compiler | $norman': $!";
+ print " *** different XCQL output\n"
+ if $tested ne $correct;
+ }
+}
+
+sub read_file {
+ my($name) = @_;
+
+ $name = "<$name" if $name !~ /\|$/;
+ my $fh = new IO::File("$name")
+ or die "can't read '$name': $!";
+ my $contents = join('', <$fh>);
+ $fh->close();
+ return $contents;
+}
--- /dev/null
+#!/bin/sh
+
+if [ $# != 1 ]; then
+ echo "Usage: $0 <test-name>" >&2
+ echo " e.g. $0 01/02" >&2
+ exit 1
+fi
+
+### Warning: nasty hard-coded choices
+( echo "=== Adam ==="
+ ../../srw/cql/cqlparse3 < sections/$1.cql ) > /tmp/adam
+( echo "=== Mike ==="
+ ../bin/CQLParser < sections/$1.cql ) > /tmp/mike
+sdiff -w 80 /tmp/adam /tmp/mike
+++ /dev/null
-#!/usr/bin/perl -w
-
-use IO::File;
-use strict;
-
-if (@ARGV != 2) {
- print STDERR "Usage: $0 <CQL-compiler> <XML-normaliser>\n";
- exit(1);
-}
-my $compiler = $ARGV[0];
-my $norman = $ARGV[1];
-
-while (<sections/*>) {
- my $sdir = $_;
- s@sections/@@;
- print "testing section $_ - ", read_file("$sdir/name"), "\n";
-
- while (<$sdir/*.cql>) {
- my $qfile = $_;
- s@sections/([0-9]+/.*)\.cql@$1@;
- my $query = read_file($qfile);
- my $afile = $qfile;
- $afile =~ s/\.cql$/.xcql/;
- print " query $_ - $query\n";
- my $correct = read_file("$norman < $afile |");
- my $tested = read_file("$compiler < $qfile | $norman |")
- or die "can't run test compiler '$compiler | $norman': $!";
- print " *** different XCQL output\n"
- if $tested ne $correct;
- }
-}
-
-sub read_file {
- my($name) = @_;
-
- $name = "<$name" if $name !~ /\|$/;
- my $fh = new IO::File("$name")
- or die "can't read '$name': $!";
- my $contents = join('', <$fh>);
- $fh->close();
- return $contents;
-}
+++ /dev/null
-#!/bin/sh
-
-if [ $# != 1 ]; then
- echo "Usage: $0 <test-name>" >&2
- echo " e.g. $0 01/02" >&2
- exit 1
-fi
-
-### Warning: nasty hard-coded choices
-( echo "=== Adam ==="
- ../../srw/cql/cqlparse3 < sections/$1.cql ) > /tmp/adam
-( echo "=== Mike ==="
- ../bin/CQLParser < sections/$1.cql ) > /tmp/mike
-sdiff -w 80 /tmp/adam /tmp/mike