New TESTALL^GPLUNIT and fixes to GPLXPATH test cases

This commit is contained in:
george 2008-06-30 18:21:04 +00:00
parent 58976179fd
commit 958a1040ec
3 changed files with 90 additions and 60 deletions

View File

@ -11,7 +11,7 @@ EXPORT ; EXPORT ENTRY POINT FOR CCR
D CCRRPC(.CCRGLO,DFN,"CCR") D CCRRPC(.CCRGLO,DFN,"CCR")
S OARY=$NA(^TMP($J,DFN,"CCR",1)) S OARY=$NA(^TMP($J,DFN,"CCR",1))
S ONAM="PAT_"_DFN_"_CCR_V1.xml" S ONAM="PAT_"_DFN_"_CCR_V1.xml"
S ODIR="/home/wvehr1/EHR/CCR" S ODIR="/home/glilly/CCROUT"
D OUTPUT^GPLXPATH(OARY,ONAM,ODIR) D OUTPUT^GPLXPATH(OARY,ONAM,ODIR)
Q Q
; ;

View File

@ -22,8 +22,8 @@ ZT(ZARY,BAT,TST) ; private routine to add a test case to the ZARY array
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
; ;
@ -51,42 +51,42 @@ ZLOAD(ZARY,ROUTINE) ; load tests into ZARY which is passed by reference
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
N FIRST,LAST N FIRST,LAST
S FIRST=$P(ZARY(WHICH),"^",1) S FIRST=$P(ZARY(WHICH),"^",1)
S LAST=$P(ZARY(WHICH),"^",2) S LAST=$P(ZARY(WHICH),"^",2)
F I=FIRST:1:LAST D F I=FIRST:1:LAST D
. I ZARY(I)?1">"1.E D ; NOT A TEST, JUST RUN THE STATEMENT . I ZARY(I)?1">"1.E D ; NOT A TEST, JUST RUN THE STATEMENT
. . S ZP=$E(ZARY(I),2,$L(ZARY(I))) . . S ZP=$E(ZARY(I),2,$L(ZARY(I)))
. . ; W ZP,! . . ; W ZP,!
. . S ZX=ZP . . S ZX=ZP
. . W "RUNNING: "_ZP . . W "RUNNING: "_ZP
. . X ZX . . X ZX
. . W "..SUCCESS: ",WHICH,! . . W "..SUCCESS: ",WHICH,!
. I ZARY(I)?1"?"1.E D ; THIS IS A TEST . I ZARY(I)?1"?"1.E D ; THIS IS A TEST
. . S ZP=$E(ZARY(I),2,$L(ZARY(I))) . . S ZP=$E(ZARY(I),2,$L(ZARY(I)))
. . S ZX="S ZR="_ZP . . S ZX="S ZR="_ZP
. . W "TRYING: "_ZP . . W "TRYING: "_ZP
. . X ZX . . X ZX
. . W $S(ZR=1:"..PASSED ",1:"..FAILED "),! . . W $S(ZR=1:"..PASSED ",1:"..FAILED "),!
. . I '$D(TPASSED) D ; NOT INITIALIZED YET . . I '$D(TPASSED) D ; NOT INITIALIZED YET
. . . S TPASSED=0 S TFAILED=0 . . . S TPASSED=0 S TFAILED=0
. . I ZR S TPASSED=TPASSED+1 . . I ZR S TPASSED=TPASSED+1
. . I 'ZR S TFAILED=TFAILED+1 . . I 'ZR S TFAILED=TFAILED+1
Q Q
; ;
TEST ; RUN ALL THE TEST CASES TEST ; RUN ALL THE TEST CASES
N ZTMP N ZTMP
D ZLOAD(.ZTMP) D ZLOAD(.ZTMP)
@ -98,6 +98,32 @@ TEST ; RUN ALL THE TEST CASES
ZWR ZTMP ZWR ZTMP
Q Q
; ;
GTSTS(ZARY,RTN) ; return an array of test names
N I,J S I="" S I=$O(ZARY("TESTS",I))
F J=0:0 Q:I="" D
. D PUSH^GPLXPATH(RTN,I)
. S I=$O(ZARY("TESTS",I))
Q
;
TESTALL(RNM) ; RUN ALL THE TESTS
N I,J,ZTMP,TSTS,TOTP,TOTF
S TOTP=0 S TOTF=0
D ZLOAD^GPLUNIT("ZTMP",RNM)
D GTSTS(.ZTMP,"TSTS")
F I=1:1:TSTS(0) D ;
. S TPASSED=0 S TFAILED=0
. D ZTEST(.ZTMP,TSTS(I))
. S TOTP=TOTP+TPASSED
. S TOTF=TOTF+TFAILED
. S $P(TSTS(I),"^",2)=TPASSED
. S $P(TSTS(I),"^",3)=TFAILED
F I=1:1:TSTS(0) D ;
. W "TEST=> ",$P(TSTS(I),"^",1)
. W " PASSED=>",$P(TSTS(I),"^",2)
. W " FAILED=>",$P(TSTS(I),"^",3),!
W "TOTAL=> PASSED:",TOTP," FAILED:",TOTF,!
Q
;
TLIST(ZARY) ; LIST ALL THE TESTS TLIST(ZARY) ; LIST ALL THE TESTS
; THEY ARE MARKED AS ;;><TESTNAME> IN THE TEST CASES ; THEY ARE MARKED AS ;;><TESTNAME> IN THE TEST CASES
; ZARY IS PASSED BY REFERENCE ; ZARY IS PASSED BY REFERENCE

View File

@ -332,24 +332,28 @@ PARY(GLO) ;PRINT AN ARRAY
F I=1:1:@GLO@(0) W @GLO@(I),! F I=1:1:@GLO@(0) W @GLO@(I),!
Q Q
; ;
TEST ; RUN ALL THE TEST CASES TEST ; Run all the test cases
N ZTMP D TESTALL^GPLUNIT("GPLXPATH")
D ZLOAD^GPLUNIT("ZTMP","GPLXPATH") Q
D ZTEST^GPLUNIT(.ZTMP,"ALL") ;
W "PASSED: ",TPASSED,! OLDTEST ; RUN ALL THE TEST CASES
W "FAILED: ",TFAILED,! N ZTMP
W ! D ZLOAD^GPLUNIT("ZTMP","GPLXPATH")
; W "THE TESTS!",! D ZTEST^GPLUNIT(.ZTMP,"ALL")
; ZWR ZTMP W "PASSED: ",TPASSED,!
Q W "FAILED: ",TFAILED,!
; W !
; W "THE TESTS!",!
; ZWR ZTMP
Q
;
ZTEST(WHICH) ; RUN ONE SET OF TESTS ZTEST(WHICH) ; RUN ONE SET OF TESTS
N ZTMP N ZTMP
S DEBUG=1 S DEBUG=1
D ZLOAD^GPLUNIT("ZTMP","GPLXPATH") D ZLOAD^GPLUNIT("ZTMP","GPLXPATH")
D ZTEST^GPLUNIT(.ZTMP,WHICH) D ZTEST^GPLUNIT(.ZTMP,WHICH)
Q Q
; ;
TLIST ; LIST THE TESTS TLIST ; LIST THE TESTS
N ZTMP N ZTMP
D ZLOAD^GPLUNIT("ZTMP","GPLXPATH") D ZLOAD^GPLUNIT("ZTMP","GPLXPATH")
@ -464,28 +468,28 @@ TLIST ; LIST THE TESTS
;;>>>K G2,GBL ;;>>>K G2,GBL
;;>>>D ZTEST^GPLXPATH("INITXML") ;;>>>D ZTEST^GPLXPATH("INITXML")
;;>>>D QOPEN^GPLXPATH("GBL","GXML") ;;>>>D QOPEN^GPLXPATH("GBL","GXML")
;;>>?$P(GBL(1),"^",3)=12 ;;>>?$P(GBL(1),";",3)=12
;;>>>D BUILD^GPLXPATH("GBL","G2") ;;>>>D BUILD^GPLXPATH("GBL","G2")
;;>>?G2(G2(0))="</SECOND>" ;;>>?G2(G2(0))="</SECOND>"
;;><QOPEN2> ;;><QOPEN2>
;;>>>K G2,GBL ;;>>>K G2,GBL
;;>>>D ZTEST^GPLXPATH("INITXML") ;;>>>D ZTEST^GPLXPATH("INITXML")
;;>>>D QOPEN^GPLXPATH("GBL","GXML","//FIRST/SECOND") ;;>>>D QOPEN^GPLXPATH("GBL","GXML","//FIRST/SECOND")
;;>>?$P(GBL(1),"^",3)=12 ;;>>?$P(GBL(1),";",3)=11
;;>>>D BUILD^GPLXPATH("GBL","G2") ;;>>>D BUILD^GPLXPATH("GBL","G2")
;;>>?G2(G2(0))="</SECOND>" ;;>>?G2(G2(0))="</SECOND>"
;;><QCLOSE> ;;><QCLOSE>
;;>>>K G2,GBL ;;>>>K G2,GBL
;;>>>D ZTEST^GPLXPATH("INITXML") ;;>>>D ZTEST^GPLXPATH("INITXML")
;;>>>D QCLOSE^GPLXPATH("GBL","GXML") ;;>>>D QCLOSE^GPLXPATH("GBL","GXML")
;;>>?$P(GBL(1),"^",3)=13 ;;>>?$P(GBL(1),";",3)=13
;;>>>D BUILD^GPLXPATH("GBL","G2") ;;>>>D BUILD^GPLXPATH("GBL","G2")
;;>>?G2(G2(0))="</FIRST>" ;;>>?G2(G2(0))="</FIRST>"
;;><QCLOSE2> ;;><QCLOSE2>
;;>>>K G2,GBL ;;>>>K G2,GBL
;;>>>D ZTEST^GPLXPATH("INITXML") ;;>>>D ZTEST^GPLXPATH("INITXML")
;;>>>D QCLOSE^GPLXPATH("GBL","GXML","//FIRST/SECOND/THIRD") ;;>>>D QCLOSE^GPLXPATH("GBL","GXML","//FIRST/SECOND/THIRD")
;;>>?$P(GBL(1),"^",3)=13 ;;>>?$P(GBL(1),";",3)=13
;;>>>D BUILD^GPLXPATH("GBL","G2") ;;>>>D BUILD^GPLXPATH("GBL","G2")
;;>>?G2(G2(0))="</FIRST>" ;;>>?G2(G2(0))="</FIRST>"
;;>>?G2(1)="</THIRD>" ;;>>?G2(1)="</THIRD>"