Imported Robodoc.
[robodoc.git] / Source / Test / header_test.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4 use ROBOTest;
5
6 #****x* SystemTest/header_test_pl
7 # FUNCTION
8 #   Test if robodoc recognizes all the different headers in the
9 #   various languages that robodoc supports.  The input file for this
10 #   test is generated with the makefile entry header_test
11 # SOURCE
12 #
13
14 ROBOTest::start("Header Test");
15
16 # We scan the output file for the headers.
17 # Each header has a name item with the text
18 #    testmark <number> testmark
19 # the name of each header has the form
20 #   Header_<number>
21 # We compute the sum of all the numbers.
22
23 # There are 15 headers numbered 1 .. 15
24 my $checksum = 0;
25 foreach my $n (1 .. 15) {
26     $checksum += $n;
27 }
28
29 my $sum = 0;
30 while (my $line = <>) {
31     # The numbers between the marks.
32     if ($line =~ m/<PRE\S+\s+testmark\s+(\d+)\s/i) {
33         $sum += $1;
34     }
35     # These numbers in the names, listed in the table
36     # of content.
37     if ($line =~ m/<A HREF[^\/]+\/Header_(\d+)<\/A>/i) {
38         $sum += $1;
39     }
40 }
41
42 # Does each header number occur twice?
43 ROBOTest::assert( $sum == (2 * $checksum) );
44 ROBOTest::finish;
45
46 0;
47
48 #******