2 # Copyright 2002 Patrik Stridvall
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
28 @EXPORT_OK = qw($tests);
32 use config qw($current_dir $wine_dir $winapi_dir);
33 use options qw($options);
34 use output qw($output);
37 $Exporter::ExportLevel++;
38 &Exporter::import(@_);
39 $Exporter::ExportLevel--;
41 $tests = 'tests'->new;
46 my $class = ref($proto) || $proto;
48 bless ($self, $class);
50 $self->parse_tests_file();
55 sub parse_tests_file {
58 my $file = "tests.dat";
60 my $tests = \%{$self->{TESTS}};
62 $output->lazy_progress($file);
68 open(IN, "< $winapi_dir/$file") || die "$winapi_dir/$file: $!\n";
70 s/^\s*?(.*?)\s*$/$1/; # remove whitespace at beginning and end of line
71 s/^(.*?)\s*#.*$/$1/; # remove comments
72 /^$/ && next; # skip empty lines
74 if (/^%%%\s*(\S+)$/) {
76 } elsif (/^%%\s*(\w+)$/) {
78 } elsif (/^%\s*(\w+)$/) {
81 if (!exists($$tests{$test_dir}{$test}{$section})) {
82 $$tests{$test_dir}{$test}{$section} = [];
84 push @{$$tests{$test_dir}{$test}{$section}}, $_;
86 $output->write("$file:$.: parse error: '$_'\n");
96 my $tests = \%{$self->{TESTS}};
101 if (defined($test_dir)) {
102 foreach my $test (sort(keys(%{$$tests{$test_dir}}))) {
106 foreach my $test_dir (sort(keys(%$tests))) {
107 foreach my $test (sort(keys(%{$$tests{$test_dir}}))) {
112 return sort(keys(%tests));
118 my $tests = \%{$self->{TESTS}};
123 if (defined($test)) {
124 foreach my $test_dir (sort(keys(%$tests))) {
125 if (exists($$tests{$test_dir}{$test})) {
126 $test_dirs{$test_dir}++;
130 foreach my $test_dir (sort(keys(%$tests))) {
131 $test_dirs{$test_dir}++;
135 return sort(keys(%test_dirs));
141 my $tests = \%{$self->{TESTS}};
143 my $test_dir = shift;
147 if (defined($test_dir)) {
148 if (defined($test)) {
149 foreach my $section (sort(keys(%{$$tests{$test_dir}{$test}}))) {
150 $sections{$section}++;
153 foreach my $test (sort(keys(%{$$tests{$test_dir}}))) {
154 foreach my $section (sort(keys(%{$$tests{$test_dir}{$test}}))) {
155 $sections{$section}++;
159 } elsif (defined($test)) {
160 foreach my $test_dir (sort(keys(%$tests))) {
161 foreach my $section (sort(keys(%{$$tests{$test_dir}{$test}}))) {
162 $sections{$section}++;
166 foreach my $test_dir (sort(keys(%$tests))) {
167 foreach my $test (sort(keys(%{$$tests{$test_dir}}))) {
168 foreach my $section (sort(keys(%{$$tests{$test_dir}{$test}}))) {
169 $sections{$section}++;
175 return sort(keys(%sections));
181 my $tests = \%{$self->{TESTS}};
183 my $test_dir = shift;
187 my $array = $$tests{$test_dir}{$test}{$section};
188 if (defined($array)) {