7 $ENV{CLASSPATH} .= ":../../src/main/java";
8 $ENV{CLASSPATH} .= ":../../lib/cql-java.jar";
11 print STDERR "Usage: $0 <CQL-compiler> <XML-normaliser>\n";
14 my $compiler = $ARGV[0];
15 my $norman = $ARGV[1]; # name of XML normaliser program
16 my($ntests, $ncorrect) = (0, 0);
18 while (<sections/*>) {
22 print "testing section $_ - ", read_file("$sdir/name"), "\n";
24 while (<$sdir/*.cql>) {
26 s@sections/([0-9]+/.*)\.cql@$1@;
27 my $query = read_file($qfile);
29 $afile =~ s/\.cql$/.xcql/;
30 print " query $_ - $query ";
32 my $correct = read_file("$norman < $afile |");
33 my $tested = read_file("$compiler < $qfile | $norman |");
35 print "\n *** test compiler exited non-zero\n";
36 } elsif ($tested eq $correct) {
40 print "\n *** XCQL output differs from $afile\n";
41 print "=== tested ===\n$tested";
42 print "=== end ===\n";
47 print sprintf("%d of %d passed: %d%%\n",
48 $ncorrect, $ntests, (100 * $ncorrect) / $ntests);
53 $name = "<$name" if $name !~ /\|$/;
54 my $fh = new IO::File("$name")
55 or die "can't read '$name': $!";
56 my $contents = join('', <$fh>);