ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/Utilities/TestClass.pm
(Generate patch)

Comparing COMP/SCRAM/src/Utilities/TestClass.pm (file contents):
Revision 1.10 by williamc, Mon Aug 28 08:35:16 2000 UTC vs.
Revision 1.13 by williamc, Fri Sep 29 06:42:03 2000 UTC

# Line 12 | Line 12
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.
# Line 105 | Line 106 | sub cmpstring {
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");
# Line 186 | Line 192 | sub verifyexists {
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;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines