Fixed a unit testing bug

This commit is contained in:
george 2008-06-27 22:29:18 +00:00
parent 8ed7272548
commit fbb4ba6446
1 changed files with 12 additions and 12 deletions

View File

@ -21,9 +21,9 @@ ZT(ZARY,BAT,TST) ; private routine to add a test case to the ZARY array
. S $P(ZARY(BAT),"^",2)=II+1 . S $P(ZARY(BAT),"^",2)=II+1
I '$D(ZARY(BAT)) D ; FIRST TEST IN THIS BATTERY I '$D(ZARY(BAT)) D ; FIRST TEST IN THIS BATTERY
. S ZARY(BAT)=CNT_"^"_CNT ; FIRST AND LAST TESTS IN BATTERY . S ZARY(BAT)=CNT_"^"_CNT ; FIRST AND LAST TESTS IN BATTERY
. ; S ZARY("TESTS",BAT)="" ; PUT THE BATTERY IN THE TESTS INDEX . S ZARY("TESTS",BAT)="" ; PUT THE BATTERY IN THE TESTS INDEX
. S TN=$NA(ZARY("TESTS")) . ; S TN=$NA(ZARY("TESTS"))
. D PUSH^GPLXPATH(TN,BAT) . ; D PUSH^GPLXPATH(TN,BAT)
S ZARY(0)=CNT ; update the array counter S ZARY(0)=CNT ; update the array counter
Q Q
; ;
@ -47,20 +47,20 @@ ZLOAD(ZARY,ROUTINE) ; load tests into ZARY which is passed by reference
. . . S SECTION=$P($P(LINE,";;><",2),">",1) ; pull out name . . . S SECTION=$P($P(LINE,";;><",2),">",1) ; pull out name
. . I LINE?." "1";;>>".E D ; test case found . . I LINE?." "1";;>>".E D ; test case found
. . . D ZT(.@ZARY,SECTION,$P(LINE,";;>>",2)) ; put the test in the array . . . D ZT(.@ZARY,SECTION,$P(LINE,";;>>",2)) ; put the test in the array
; S @ZARY@("ALL")="1"_"^"_@ZARY@(0) ; MAKE A BATTERY FOR ALL S @ZARY@("ALL")="1"_"^"_@ZARY@(0) ; MAKE A BATTERY FOR ALL
Q Q
; ;
ZTEST(ZARY,WHICH) ; try out the tests using a passed array ZTEST ZTEST(ZARY,WHICH) ; try out the tests using a passed array ZTEST
N I,ZX,ZR,ZP N I,ZX,ZR,ZP
S DEBUG=0 S DEBUG=0
I WHICH="ALL" D Q ; RUN ALL THE TESTS ; I WHICH="ALL" D Q ; RUN ALL THE TESTS
. W "DOING ALL",! ; . W "DOING ALL",!
. N J,NT ; . N J,NT
. S NT=$NA(ZARY("TESTS")) ; . S NT=$NA(ZARY("TESTS"))
. W NT,@NT@(0),! ; . W NT,@NT@(0),!
. F J=1:1:@NT@(0) D ; ; . F J=1:1:@NT@(0) D ;
. . W @NT@(J),! ; . . W @NT@(J),!
. . D ZTEST^GPLUNIT(@ZARY,@NT@(J)) ; . . D ZTEST^GPLUNIT(@ZARY,@NT@(J))
I '$D(ZARY(WHICH)) D ; TEST SECTION DOESN'T EXIST I '$D(ZARY(WHICH)) D ; TEST SECTION DOESN'T EXIST
. W "ERROR -- TEST SECTION DOESN'T EXIST -> ",WHICH,! . W "ERROR -- TEST SECTION DOESN'T EXIST -> ",WHICH,!
. Q ; EXIT . Q ; EXIT