Imported Robodoc.
[robodoc.git] / Source / Test / header_test5.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4 use ROBOTest;
5
6 #****x* SystemTest/header_test5_pl
7 # FUNCTION
8 #   ROBODoc allows a user to define that some items should
9 #   work similar to the source item. These tests check wether
10 #   this works.
11 # SOURCE
12 #
13
14 ROBOTest::start("Source Item Test");
15
16 # We scan the output file for the headers.
17 # In each header there are items that contains
18 #    testmark 1 testmark
19 #    testmark 2 testmark
20 #    testmark 3 testmark
21 #    testmark 4 testmark
22 #    testmark 5 testmark
23 # in such locations that they end-up in the final
24 # documentation.  We scan the final documentation
25 # and collect and the numbers between the test
26 # marks.
27
28 my $checksum = 1 + 2 + 3 + 4 + 5;
29
30 my $sum = 0;
31 my $sum_empty_remark = 0;
32
33 while (my $line = <>) {
34     # The numbers between the marks.
35     if ( $line =~ m/testmark\s(\d+)/ ) {
36         $sum += $1;
37     }
38     # There should be no empty '/*' or '*/' in the documentation
39     # robodoc is supposed to remove these from the begin and
40     # end of a 'source' item.
41
42     # No  /*
43     if ( $line =~ m/^\s*\/\*\s*$/ ) {
44         $sum_empty_remark++;
45     }
46     # No  */
47     if ( $line =~ m/^\s\*\/\s*$/ ) {
48         $sum_empty_remark++;
49     }
50 }
51
52 # There are 4 headers so:
53 ROBOTest::assert( $sum == (4 * $checksum), "All source is included" );
54 ROBOTest::assert( $sum_empty_remark == 0, "No empty remark begin or ends" );
55 ROBOTest::finish;
56 #
57
58 0;
59
60 #******