3 # $Id: runcanon,v 1.1 2007-06-29 13:05:12 mike Exp $
5 # Tests that all sample queries can be rendered into idempotent
11 $ENV{CLASSPATH} .= ":../../lib/cql-java.jar";
13 my($ntests, $ncorrect) = (0, 0);
15 while (<sections/*>) {
18 next if /^CVS$/ || /^10$/;
19 print "testing section $_ - ", read_file("$sdir/name"), "\n";
21 while (<$sdir/*.cql>) {
23 s@sections/([0-9]+/.*)\.cql@$1@;
24 my $query = read_file($qfile);
25 my $canonical = `CQLParser -c '$query'`;
27 my $maybe = `CQLParser -c '$canonical'`;
29 print "$query // $canonical ";
31 if ($maybe eq $canonical) {
40 print sprintf("%d of %d passed: %d%%\n",
41 $ncorrect, $ntests, (100 * $ncorrect) / $ntests);
46 $name = "<$name" if $name !~ /\|$/;
47 my $fh = new IO::File("$name")
48 or die "can't read '$name': $!";
49 my $contents = join('', <$fh>);