diff options
Diffstat (limited to 'test/w3c/check-tests.pl')
-rwxr-xr-x | test/w3c/check-tests.pl | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/test/w3c/check-tests.pl b/test/w3c/check-tests.pl new file mode 100755 index 0000000..7299947 --- /dev/null +++ b/test/w3c/check-tests.pl @@ -0,0 +1,92 @@ +#!/usr/bin/perl + +use strict; +use Data::Dumper; +use XML::Simple; + + +my $manifest = XMLin("./manifest.xml"); +# print Dumper($manifest->{'assert'}); + +my $perSpecId; + +my @allTests; +my @ecmaTests; +my @xpathTests; +my @agnosticTests; +my @nullTests; +my @manualTests; + +for my $testNr (keys $manifest->{'assert'}) { + my @tests; + my $thisTest = $manifest->{'assert'}->{$testNr}; + if (ref($thisTest->{'test'}->{'start'}) eq "ARRAY") { + push (@tests, @{$thisTest->{'test'}->{'start'}}); + } else { + push (@tests, $thisTest->{'test'}->{'start'}); + } + $perSpecId->{$thisTest->{'specnum'}.':'.$thisTest->{'specid'}}->{'total'} += @tests; + if ($thisTest->{'test'}->{'manual'} eq "true") { + $perSpecId->{$thisTest->{'specnum'}.':'.$thisTest->{'specid'}}->{'manual'} += @tests; + push @manualTests, @tests; + + } + + if ($thisTest->{'specid'} eq "#minimal-profile" || $thisTest->{'specid'} !~ /profile$/) { + push @nullTests, @tests; + } + + if ($thisTest->{'specid'} eq "#ecma-profile" || $thisTest->{'specid'} !~ /profile$/) { + push @ecmaTests, @tests; + } + + if ($thisTest->{'specid'} eq "#xpath-profile" || $thisTest->{'specid'} !~ /profile$/) { + push @xpathTests, @tests; + } + + push (@allTests, @tests); + push @agnosticTests, @tests if ($thisTest->{'specid'} !~ /profile$/); +} + +# print Dumper(@ecmaTests); + +my %datamodels = ( + "ecma" => \@ecmaTests, + "xpath" => \@xpathTests, + "promela" => \@agnosticTests, + "prolog" => \@agnosticTests, + "lua" => \@ecmaTests +); + +for my $datamodel (keys %datamodels) { + # every scxml file is a test + for (`ls $datamodel/*.scxml`) { + my $filename = $_; + chomp($filename); + if ($filename =~ /\/test(\d+\w?)\.scxml/) { + print("${filename} is not in mainfest\n") if (! grep $_->{'uri'} == "${1}/test${1}.scxml", @{$datamodels{$datamodel}}); + } + } + # every test is given + for my $testURI (@{$datamodels{$datamodel}}) { + if ($testURI->{'uri'} =~ /^(\d+)\/(test\d+\w?)\.(txt|txml)$/) { + my $name = $2; + my $suffix = ($3 eq "txml" ? "scxml" : $3); + if (! -e "${datamodel}/${name}.${suffix}") { + print("${datamodel}/${name}.${suffix} is missing\n"); + } + } else { + die ($testURI->{'uri'}); + } + } +} + +# print Dumper(@manualTests); + +print "NULL : ".@nullTests."\n"; +print "ECMA : ".@ecmaTests."\n"; +print "XPATH: ".@xpathTests."\n"; +print "\n"; +print "MAN : ".@manualTests."\n"; +print "ANY : ".@agnosticTests."\n"; +print "TOTAL: ".@allTests."\n"; |