]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - tests/unit/combine_define.pl
Update WikiAdminSearchReplace plugin
[SourceForge/phpwiki.git] / tests / unit / combine_define.pl
1 #!/usr/bin/perl
2 # combine the ploticus data files for all tested define combinations
3 # // inc mem msg =>
4 # // test          nr   d1_t    d1_f    d2_t    d2_f
5 #"testnowikiwords" 4    13408   13592   14880   15440
6 #"testwikiword"    5    13408   13600   14880   15440 
7
8 $prefix = shift || 'all';
9 # @DEF should match the runme_mem tests:
10 #   WIKIDB_NOCACHE_MARKUP ENABLE_PAGEPERM
11 @DEF = qw/ USECACHE ENABLE_USER_NEW  /;
12 for $def (@DEF) {
13   for $bool (qw/true false/) {
14     $fn = sprintf("%s_%s_%s.data",$prefix,$def,$bool);
15     open F, "< $fn" || break;
16     $key = $def."_".$bool;
17     $i=1;
18     while (<F>) {
19       chomp;
20       if (/^\d+\t(\d+)\t(.+)/) {
21         $t{$i} = "$2" unless $t{$i};
22         $m{$key}{$i++} = $1;
23       }
24       if (m|^// |) {
25         $p .= ($_."\n");
26       }
27     }
28     $params = $p unless $params;
29     close F;
30     $max = $max < $i ? $i : $max;
31   }
32 }
33 $fn = $prefix."_combine_define.data";
34 open F, "> $fn";
35 print F "// test      \tnr";
36 for $def (@DEF) { 
37   print F "\t",$def," (t/f)"; }
38 print F "\n";
39
40 $i=0;
41 while (++$i < $max) {
42   print F substr($t{$i},0,14);
43   print F "\t",$i;
44   for $def (@DEF) { 
45     for $bool (qw/true false/) {
46       $key = $def."_".$bool;
47       $v = $m{$key}{$i} ? $m{$key}{$i} : '-1';
48       print F "\t",$v; }}
49   print F "\n";
50 }
51
52 # add the PARAMS
53 print F "\n";
54 $defs = " (".join('|',("pid",@DEF)).")=";
55 $defrx = qr($defs);
56 for (split(/\n/,$params)) {
57   print F $_,"\n" unless m/$defrx/;
58 }