#!/usr/bin/perl -w use strict; my %TESTS; my %TEST_INTENTION; my @MAJOR_TESTS = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14); my %MAJOR_DESCRIPTIONS = ( 1 => "Empty file. Various ways to specify a float (database unit).", 2 => "Cells. Various ways to specify cell names (id, string) and refer to them.", 3 => "Texts. Various ways to specify text strings and to refer to them.", 4 => "Rectangles", 5 => "Polygons", 6 => "Paths", 7 => "Trapezoids", 8 => "Placements", 9 => "Ctrapezoids", 10 => "Modal variables", 11 => "Properties", 12 => "Circles", 13 => "Layer names", 14 => "CBLOCK compression" ); my $file; while ($file = shift @ARGV) { open SRC, "<$file" or die "Unable to open $file\n"; my $major = 0; my $minor = 0; my $content_description = ""; my @test_intention = (); my @content = (); my $in_content = 0; while () { if (/^#\s*(.*)<\/name>/) { $major = $1; $minor = $1; $major =~ s/t(\d+)\.(\d+)\.ot/$1/; $minor =~ s/t(\d+)\.(\d+)\.ot/$2/; } elsif (/^#\s*(.*)<\/content-description>/) { $content_description = $1; } elsif (/^#\s*(.*)<\/test-intention>/) { push @test_intention, $1; } elsif (/^#\s*/) { $in_content = 1; } elsif (/^#\s*<\/content>/) { $in_content = 0; } elsif ($in_content && /^#\s*(.*)$/) { push @content, $1; } } close SRC; if (!defined $TESTS{$major}) { $TESTS{$major} = []; } push @{$TESTS{$major}}, [ $minor, $content_description, [@test_intention], [@content] ]; my $i; foreach $i (@test_intention) { if (!defined $TEST_INTENTION{$i}) { $TEST_INTENTION{$i} = []; } push @{$TEST_INTENTION{$i}}, [$major, $minor]; } } print "\n"; print "\n"; print "

OASIS Tests By Cathegory

\n"; my $m = 0; foreach $m (@MAJOR_TESTS) { print "

Cathegory $m: $MAJOR_DESCRIPTIONS{$m}

\n"; print " \n"; } print "

OASIS Tests By Target

\n"; print "\n"; my $k; foreach $k (sort keys %TEST_INTENTION) { my @T = (); foreach $m (sort {$a->[0]==$b->[0]?$a->[1]<=>$b->[1]:$a->[0]<=>$b->[0]} @{$TEST_INTENTION{$k}}) { push @T, "[0]_$m->[1]\">$m->[0].$m->[1]"; } print " "; } print "
$k" . join ("\n", @T) . "
\n"; print "

OASIS Test Descriptions

\n"; foreach $m (@MAJOR_TESTS) { my $mm; print "

$m $MAJOR_DESCRIPTIONS{$m}

\n"; foreach $mm (@{$TESTS{$m}}) { print "

$m.$mm->[0] $mm->[1]

\n"; print " [0]\"/>\n"; print "

Back to top

\n"; print "

Test targets:

\n"; print "
    \n"; my $t; foreach $t (@{$mm->[2]}) { print "
  • $t
  • \n"; } print "
\n"; if (@{$mm->[3]} > 0) { print "

Normalized content:

\n"; print "
" . join ("\n", @{$mm->[3]}) . "
\n"; } } } print "\n"; print "\n";