4 # $Id: sort_test.pl,v 1.2 2004/06/20 09:24:36 gumpu Exp $
12 #****x* SystemTest/sort_test_pl
14 # ROBODoc sorts the TOC and the headers so that they appear in
15 # a particular order in the documentation.
16 # Here we test if the order is the order we expect.
17 # This is done by generating the documentation and comparing
18 # the order with a table. There are two source files, one
19 # that is already sorted, and one that is unsorted.
20 # The documentation for both should end up sorted.
25 ROBOTest::start("Sort Test");
27 # in the documentation for the sorted file when
28 # it is sorted the TOC should look like this.
29 my @toc_sorted_names = qw(
31 BB_header/aaa_function
32 BB_header/bbb_function
33 BB_header/ccc_function
36 my @toc_unsorted_names = qw(
41 CC_header/aaa_function
42 CC_header/ccc_function
43 CC_header/eee_function
44 CC_header/fff_function
45 DD_header/aaa_function
51 my $filename = shift; # filename of the file with the headers
52 my $order = shift; # order of the headers
53 my $number = shift; # number of headers
54 my $file = IO::File->new("<$filename") or die;
56 while( my $line = <$file> ) {
57 if ( $line =~ m/robo\d">([^<]+)</ ) {
59 if ( $name eq ${$order}[ $index ] ) {
65 last if ( $index == $number );
73 ROBOTest::assertFile("Doc1/sorted_c.html");
75 check_toc_order( "Doc1/sorted_c.html", \@toc_sorted_names, 4 ),
76 "Is the TOC still sorted"
79 ROBOTest::assertFile("Doc1/unsorted_c.html");
81 check_toc_order( "Doc1/unsorted_c.html", \@toc_unsorted_names, 4 ),
82 "Is the TOC now sorted"