1 |
williamc |
1.1 |
#
|
2 |
|
|
# BuildClass.pm test suite
|
3 |
|
|
#
|
4 |
|
|
|
5 |
|
|
package BuildSystem::test::test_BuildClass;
|
6 |
|
|
require 5.001;
|
7 |
|
|
use BuildSystem::BuildClass;
|
8 |
|
|
|
9 |
|
|
@ISA = ("Utilities::TestClass"); #methods both from the test class
|
10 |
|
|
|
11 |
|
|
sub init {
|
12 |
|
|
my $self=shift;
|
13 |
|
|
}
|
14 |
|
|
|
15 |
|
|
sub test {
|
16 |
|
|
my $self=shift;
|
17 |
|
|
$self->newtest("Initiation test");
|
18 |
|
|
$self->newobject();
|
19 |
|
|
|
20 |
|
|
my $param1="Param1";
|
21 |
|
|
my $param2="Param2";
|
22 |
|
|
my $param3="Param3";
|
23 |
|
|
my $val1="V1";
|
24 |
|
|
my $val2="V2";
|
25 |
|
|
my $val3="V3";
|
26 |
|
|
$self->newtest("getting empty paramter list");
|
27 |
|
|
$self->expect();
|
28 |
|
|
$self->testinterface("paramlist");
|
29 |
|
|
$self->clearexpect();
|
30 |
|
|
|
31 |
|
|
$self->newtest("Updating parameters from hash");
|
32 |
|
|
my $hash={ "$param1" => "$val1",
|
33 |
|
|
"$param2" => "$val1",
|
34 |
|
|
"$param3" => "$val1" };
|
35 |
|
|
print (keys %$hash);
|
36 |
|
|
$self->testinterface("paramupdate", $hash );
|
37 |
|
|
$self->expect($param1,$param2,$param3);
|
38 |
|
|
$self->testinterface("paramlist");
|
39 |
|
|
$self->clearexpect();
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
$self->newtest("getting parameter test");
|
43 |
|
|
$self->expect($val1);
|
44 |
|
|
$self->testinterface("param",$param1);
|
45 |
|
|
$self->clearexpect();
|
46 |
|
|
$self->expect($val1);
|
47 |
|
|
$self->testinterface("param",$param2);
|
48 |
|
|
$self->clearexpect();
|
49 |
|
|
$self->expect($val1);
|
50 |
|
|
$self->testinterface("param",$param3);
|
51 |
|
|
$self->clearexpect();
|
52 |
|
|
|
53 |
|
|
$self->newtest("Overwrittinag parameters from hash");
|
54 |
|
|
$self->testinterface("paramupdate", {
|
55 |
|
|
$param1=>$val1,
|
56 |
|
|
$param2=>$val2,
|
57 |
|
|
$param3=>$val3 }
|
58 |
|
|
);
|
59 |
|
|
$self->expect($param1,$param2,$param3);
|
60 |
|
|
$self->testinterface("paramlist");
|
61 |
|
|
$self->clearexpect();
|
62 |
|
|
$self->expect($val1);
|
63 |
|
|
$self->testinterface("param",$param1);
|
64 |
|
|
$self->clearexpect();
|
65 |
|
|
$self->expect($val2);
|
66 |
|
|
$self->testinterface("param",$param2);
|
67 |
|
|
$self->clearexpect();
|
68 |
|
|
$self->expect($val3);
|
69 |
|
|
$self->testinterface("param",$param3);
|
70 |
|
|
$self->clearexpect();
|
71 |
|
|
|
72 |
|
|
$self->newtest("child test");
|
73 |
|
|
my $child=$self->testinterface("child");
|
74 |
|
|
if ( ! defined $child || ($child==$self) ) {
|
75 |
|
|
$self->testfail("child badly defined ($child) ");
|
76 |
|
|
}
|
77 |
|
|
else {
|
78 |
|
|
foreach $par ( $self->{object}->paramlist() ) {
|
79 |
|
|
if ( $self->{object}->param($par) ne $child->param($par) ) {
|
80 |
|
|
$self->testfail("Failed to find $par in child");
|
81 |
|
|
}
|
82 |
|
|
else {
|
83 |
|
|
$self->testpass("OK Found $par in child");
|
84 |
|
|
}
|
85 |
|
|
}
|
86 |
|
|
}
|
87 |
|
|
|
88 |
|
|
}
|