12 |
|
# verifydir(dir) : Check existence of the directory |
13 |
|
# verifyexists(file) : Verify the existence of file |
14 |
|
# datadir([dir]) : return the current data directory (set it to dir if supplied) |
15 |
+ |
# testswitch(int,"0 text"," non 0 text") : testpass or fail according to bool |
16 |
|
# testfail(string) : report that current test has failed |
17 |
|
# testpass(string) : report that current test has passed |
18 |
|
# newfilename() : return a new filename that can be opened etc. |
106 |
|
my $s2=shift; |
107 |
|
|
108 |
|
if ( ! defined $s2) { |
109 |
< |
$self->testfail("Return string is undefined expecting $s1"), |
109 |
> |
if ( ( ! defined $s1 ) || ( $s1==undef )) { |
110 |
> |
$self->testpass("Got undefined as expected"); |
111 |
> |
} |
112 |
> |
else { |
113 |
> |
$self->testfail("Return string is undefined expecting $s1"), |
114 |
> |
} |
115 |
|
} |
116 |
|
elsif ( $s1 ne $s2 ) { |
117 |
|
$self->testfail("Expecting $s1 got $s2"); |
192 |
|
} |
193 |
|
} |
194 |
|
|
195 |
+ |
sub testswitch { |
196 |
+ |
my $self=shift; |
197 |
+ |
my $bool=shift; |
198 |
+ |
my $string1=shift; |
199 |
+ |
my $string2=shift; |
200 |
+ |
|
201 |
+ |
if ( ! $bool ) { |
202 |
+ |
$self->testpass($string1); |
203 |
+ |
} |
204 |
+ |
else { |
205 |
+ |
$self->testfail($string2); |
206 |
+ |
} |
207 |
+ |
} |
208 |
+ |
|
209 |
|
sub testfail { |
210 |
|
my $self=shift; |
211 |
|
my $string=shift; |