From fbb4ba644674639eb7930c3889276f68d80fe9ad Mon Sep 17 00:00:00 2001 From: george Date: Fri, 27 Jun 2008 22:29:18 +0000 Subject: [PATCH] Fixed a unit testing bug --- p/GPLUNIT.m | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/p/GPLUNIT.m b/p/GPLUNIT.m index ef97872..b9638c2 100644 --- a/p/GPLUNIT.m +++ b/p/GPLUNIT.m @@ -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 I '$D(ZARY(BAT)) D ; FIRST TEST IN THIS BATTERY . S ZARY(BAT)=CNT_"^"_CNT ; FIRST AND LAST TESTS IN BATTERY - . ; S ZARY("TESTS",BAT)="" ; PUT THE BATTERY IN THE TESTS INDEX - . S TN=$NA(ZARY("TESTS")) - . D PUSH^GPLXPATH(TN,BAT) + . S ZARY("TESTS",BAT)="" ; PUT THE BATTERY IN THE TESTS INDEX + . ; S TN=$NA(ZARY("TESTS")) + . ; D PUSH^GPLXPATH(TN,BAT) S ZARY(0)=CNT ; update the array counter 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 . . I LINE?." "1";;>>".E D ; test case found . . . 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 ; ZTEST(ZARY,WHICH) ; try out the tests using a passed array ZTEST N I,ZX,ZR,ZP S DEBUG=0 - I WHICH="ALL" D Q ; RUN ALL THE TESTS - . W "DOING ALL",! - . N J,NT - . S NT=$NA(ZARY("TESTS")) - . W NT,@NT@(0),! - . F J=1:1:@NT@(0) D ; - . . W @NT@(J),! - . . D ZTEST^GPLUNIT(@ZARY,@NT@(J)) + ; I WHICH="ALL" D Q ; RUN ALL THE TESTS + ; . W "DOING ALL",! + ; . N J,NT + ; . S NT=$NA(ZARY("TESTS")) + ; . W NT,@NT@(0),! + ; . F J=1:1:@NT@(0) D ; + ; . . W @NT@(J),! + ; . . D ZTEST^GPLUNIT(@ZARY,@NT@(J)) I '$D(ZARY(WHICH)) D ; TEST SECTION DOESN'T EXIST . W "ERROR -- TEST SECTION DOESN'T EXIST -> ",WHICH,! . Q ; EXIT