New TESTALL^GPLUNIT and fixes to GPLXPATH test cases
This commit is contained in:
parent
58976179fd
commit
958a1040ec
|
@ -11,7 +11,7 @@ EXPORT ; EXPORT ENTRY POINT FOR CCR
|
|||
D CCRRPC(.CCRGLO,DFN,"CCR")
|
||||
S OARY=$NA(^TMP($J,DFN,"CCR",1))
|
||||
S ONAM="PAT_"_DFN_"_CCR_V1.xml"
|
||||
S ODIR="/home/wvehr1/EHR/CCR"
|
||||
S ODIR="/home/glilly/CCROUT"
|
||||
D OUTPUT^GPLXPATH(OARY,ONAM,ODIR)
|
||||
Q
|
||||
;
|
||||
|
|
102
p/GPLUNIT.m
102
p/GPLUNIT.m
|
@ -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
|
||||
. 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 TN=$NA(ZARY("TESTS"))
|
||||
. ; D PUSH^GPLXPATH(TN,BAT)
|
||||
S ZARY(0)=CNT ; update the array counter
|
||||
Q
|
||||
;
|
||||
|
@ -51,42 +51,42 @@ ZLOAD(ZARY,ROUTINE) ; load tests into ZARY which is passed by reference
|
|||
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 '$D(ZARY(WHICH)) D ; TEST SECTION DOESN'T EXIST
|
||||
. W "ERROR -- TEST SECTION DOESN'T EXIST -> ",WHICH,!
|
||||
. Q ; EXIT
|
||||
N FIRST,LAST
|
||||
S FIRST=$P(ZARY(WHICH),"^",1)
|
||||
S LAST=$P(ZARY(WHICH),"^",2)
|
||||
F I=FIRST:1:LAST D
|
||||
. I ZARY(I)?1">"1.E D ; NOT A TEST, JUST RUN THE STATEMENT
|
||||
. . S ZP=$E(ZARY(I),2,$L(ZARY(I)))
|
||||
. . ; W ZP,!
|
||||
. . S ZX=ZP
|
||||
. . W "RUNNING: "_ZP
|
||||
. . X ZX
|
||||
. . W "..SUCCESS: ",WHICH,!
|
||||
. I ZARY(I)?1"?"1.E D ; THIS IS A TEST
|
||||
. . S ZP=$E(ZARY(I),2,$L(ZARY(I)))
|
||||
. . S ZX="S ZR="_ZP
|
||||
. . W "TRYING: "_ZP
|
||||
. . X ZX
|
||||
. . W $S(ZR=1:"..PASSED ",1:"..FAILED "),!
|
||||
. . I '$D(TPASSED) D ; NOT INITIALIZED YET
|
||||
. . . S TPASSED=0 S TFAILED=0
|
||||
. . I ZR S TPASSED=TPASSED+1
|
||||
. . I 'ZR S TFAILED=TFAILED+1
|
||||
Q
|
||||
;
|
||||
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 '$D(ZARY(WHICH)) D ; TEST SECTION DOESN'T EXIST
|
||||
. W "ERROR -- TEST SECTION DOESN'T EXIST -> ",WHICH,!
|
||||
. Q ; EXIT
|
||||
N FIRST,LAST
|
||||
S FIRST=$P(ZARY(WHICH),"^",1)
|
||||
S LAST=$P(ZARY(WHICH),"^",2)
|
||||
F I=FIRST:1:LAST D
|
||||
. I ZARY(I)?1">"1.E D ; NOT A TEST, JUST RUN THE STATEMENT
|
||||
. . S ZP=$E(ZARY(I),2,$L(ZARY(I)))
|
||||
. . ; W ZP,!
|
||||
. . S ZX=ZP
|
||||
. . W "RUNNING: "_ZP
|
||||
. . X ZX
|
||||
. . W "..SUCCESS: ",WHICH,!
|
||||
. I ZARY(I)?1"?"1.E D ; THIS IS A TEST
|
||||
. . S ZP=$E(ZARY(I),2,$L(ZARY(I)))
|
||||
. . S ZX="S ZR="_ZP
|
||||
. . W "TRYING: "_ZP
|
||||
. . X ZX
|
||||
. . W $S(ZR=1:"..PASSED ",1:"..FAILED "),!
|
||||
. . I '$D(TPASSED) D ; NOT INITIALIZED YET
|
||||
. . . S TPASSED=0 S TFAILED=0
|
||||
. . I ZR S TPASSED=TPASSED+1
|
||||
. . I 'ZR S TFAILED=TFAILED+1
|
||||
Q
|
||||
;
|
||||
TEST ; RUN ALL THE TEST CASES
|
||||
N ZTMP
|
||||
D ZLOAD(.ZTMP)
|
||||
|
@ -98,6 +98,32 @@ TEST ; RUN ALL THE TEST CASES
|
|||
ZWR ZTMP
|
||||
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
|
||||
; THEY ARE MARKED AS ;;><TESTNAME> IN THE TEST CASES
|
||||
; ZARY IS PASSED BY REFERENCE
|
||||
|
|
46
p/GPLXPATH.m
46
p/GPLXPATH.m
|
@ -332,24 +332,28 @@ PARY(GLO) ;PRINT AN ARRAY
|
|||
F I=1:1:@GLO@(0) W @GLO@(I),!
|
||||
Q
|
||||
;
|
||||
TEST ; RUN ALL THE TEST CASES
|
||||
N ZTMP
|
||||
D ZLOAD^GPLUNIT("ZTMP","GPLXPATH")
|
||||
D ZTEST^GPLUNIT(.ZTMP,"ALL")
|
||||
W "PASSED: ",TPASSED,!
|
||||
W "FAILED: ",TFAILED,!
|
||||
W !
|
||||
; W "THE TESTS!",!
|
||||
; ZWR ZTMP
|
||||
Q
|
||||
;
|
||||
TEST ; Run all the test cases
|
||||
D TESTALL^GPLUNIT("GPLXPATH")
|
||||
Q
|
||||
;
|
||||
OLDTEST ; RUN ALL THE TEST CASES
|
||||
N ZTMP
|
||||
D ZLOAD^GPLUNIT("ZTMP","GPLXPATH")
|
||||
D ZTEST^GPLUNIT(.ZTMP,"ALL")
|
||||
W "PASSED: ",TPASSED,!
|
||||
W "FAILED: ",TFAILED,!
|
||||
W !
|
||||
; W "THE TESTS!",!
|
||||
; ZWR ZTMP
|
||||
Q
|
||||
;
|
||||
ZTEST(WHICH) ; RUN ONE SET OF TESTS
|
||||
N ZTMP
|
||||
S DEBUG=1
|
||||
D ZLOAD^GPLUNIT("ZTMP","GPLXPATH")
|
||||
D ZTEST^GPLUNIT(.ZTMP,WHICH)
|
||||
Q
|
||||
;
|
||||
N ZTMP
|
||||
S DEBUG=1
|
||||
D ZLOAD^GPLUNIT("ZTMP","GPLXPATH")
|
||||
D ZTEST^GPLUNIT(.ZTMP,WHICH)
|
||||
Q
|
||||
;
|
||||
TLIST ; LIST THE TESTS
|
||||
N ZTMP
|
||||
D ZLOAD^GPLUNIT("ZTMP","GPLXPATH")
|
||||
|
@ -464,28 +468,28 @@ TLIST ; LIST THE TESTS
|
|||
;;>>>K G2,GBL
|
||||
;;>>>D ZTEST^GPLXPATH("INITXML")
|
||||
;;>>>D QOPEN^GPLXPATH("GBL","GXML")
|
||||
;;>>?$P(GBL(1),"^",3)=12
|
||||
;;>>?$P(GBL(1),";",3)=12
|
||||
;;>>>D BUILD^GPLXPATH("GBL","G2")
|
||||
;;>>?G2(G2(0))="</SECOND>"
|
||||
;;><QOPEN2>
|
||||
;;>>>K G2,GBL
|
||||
;;>>>D ZTEST^GPLXPATH("INITXML")
|
||||
;;>>>D QOPEN^GPLXPATH("GBL","GXML","//FIRST/SECOND")
|
||||
;;>>?$P(GBL(1),"^",3)=12
|
||||
;;>>?$P(GBL(1),";",3)=11
|
||||
;;>>>D BUILD^GPLXPATH("GBL","G2")
|
||||
;;>>?G2(G2(0))="</SECOND>"
|
||||
;;><QCLOSE>
|
||||
;;>>>K G2,GBL
|
||||
;;>>>D ZTEST^GPLXPATH("INITXML")
|
||||
;;>>>D QCLOSE^GPLXPATH("GBL","GXML")
|
||||
;;>>?$P(GBL(1),"^",3)=13
|
||||
;;>>?$P(GBL(1),";",3)=13
|
||||
;;>>>D BUILD^GPLXPATH("GBL","G2")
|
||||
;;>>?G2(G2(0))="</FIRST>"
|
||||
;;><QCLOSE2>
|
||||
;;>>>K G2,GBL
|
||||
;;>>>D ZTEST^GPLXPATH("INITXML")
|
||||
;;>>>D QCLOSE^GPLXPATH("GBL","GXML","//FIRST/SECOND/THIRD")
|
||||
;;>>?$P(GBL(1),"^",3)=13
|
||||
;;>>?$P(GBL(1),";",3)=13
|
||||
;;>>>D BUILD^GPLXPATH("GBL","G2")
|
||||
;;>>?G2(G2(0))="</FIRST>"
|
||||
;;>>?G2(1)="</THIRD>"
|
||||
|
|
Loading…
Reference in New Issue