5 |
|
|
6 |
my $struct; |
my $struct; |
7 |
|
|
8 |
|
my $name = 'pf'; |
9 |
|
|
10 |
|
sub display { |
11 |
|
local $| = 1; |
12 |
|
$_[0] == -1 ? print " done\n" : print "\r * testing $name " . '.' x $_[0]; |
13 |
|
local $| = 0; |
14 |
|
} |
15 |
|
|
16 |
|
sub test { |
17 |
|
my ($num, $exec) = @_; |
18 |
|
$exec ||= "diff -q ". $name ."_output_".$num." ".$name."_verify_" .$num ." 2>/dev/null 1>/dev/null"; |
19 |
|
if (system($exec) != 0) { |
20 |
|
print "\r * testing $name : TEST N°$num FAILED\n"; |
21 |
|
exit($!); |
22 |
|
} |
23 |
|
} |
24 |
|
|
25 |
# test 1, minimal requirement : regenerate correctly |
# test 1, minimal requirement : regenerate correctly |
26 |
$struct = new Libconf("pf.conf", 'pf', ''); |
display(1); |
27 |
|
$struct = new Libconf("pf.conf", $name, ''); |
28 |
|
$struct->writeConf("pf_output_1"); |
29 |
print Dumper $struct; |
print Dumper $struct; |
30 |
|
test(1); |
31 |
|
|