Updated MASH*1.5*0 for M-Unit

Updated version of the M-Unit functionality for MUMPS for submission to the Open Source Electronic Health Record Alliance for certification.
This commit is contained in:
JOEL IVEY 2017-07-10 10:17:43 -07:00
parent 7235e4cda8
commit 3508be4cca
27 changed files with 10188 additions and 9168 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

8
NOTICE
View File

@ -1,8 +1,9 @@
Submitted by: Joel Ivey <jivey@jiveysoft.com> Submitted by: Joel Ivey <jivey@jiveysoft.com>
Copyright 2015 The Open Source Electronic Health Record Alliance Copyright 2017 Joel Ivey
This product includes software developed for the Open Source This product includes software originally developed for the Open Source
Electronic Health Record Alliance (http://www.osehra.org/). Electronic Health Record Alliance (http://www.osehra.org/). Subsequently,
it has been maintained for the open source VistA community in general.
The Apache 2 license covers the following source and test files The Apache 2 license covers the following source and test files
@ -20,4 +21,5 @@ Test:
%utt4 %utt4
%utt5 %utt5
%utt6 %utt6
%utt7
%uttcovr %uttcovr

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
%ut ;VEN-SMH/JLI - PRIMARY PROGRAM FOR M-UNIT TESTING ;02/11/17 11:07 %ut ;VEN-SMH/JLI - PRIMARY PROGRAM FOR M-UNIT TESTING ;07/05/17 11:47
;;1.5;MASH UTILITIES;;Feb 8, 2017; ;;1.5;MASH UTILITIES;;Jul 8, 2017;Build 6
; Submitted to OSEHRA Feb 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html) ; Submitted to OSEHRA Jul 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html)
; Original routine authored by Joel L. Ivey as XTMUNIT while working for U.S. Department of Veterans Affairs 2003-2012 ; Original routine authored by Joel L. Ivey as XTMUNIT while working for U.S. Department of Veterans Affairs 2003-2012
; Includes addition of %utVERB and %utBREAK arguments and code related to them as well as other substantial additions authored by Sam Habiel 07/2013-04/2014 ; Includes addition of %utVERB and %utBREAK arguments and code related to them as well as other substantial additions authored by Sam Habiel 07/2013-04/2014
; Additions and modifications made by Sam H. Habiel and Joel L. Ivey 2013-02/2017 ; ; Additions and modifications made by Sam H. Habiel and Joel L. Ivey 2013-02/2017 ;
@ -22,8 +22,9 @@ EN(%utRNAM,%utVERB,%utBREAK) ; .SR Entry point with primary test routine name
; %utRNAM: (Required) Routine name that contians the tags with @TEST in them or the tag XTROU ; %utRNAM: (Required) Routine name that contians the tags with @TEST in them or the tag XTROU
; %utVERB: (optional) 1 for verbose output or for verbose and timing info 2 (milliseconds) or 3 (microseconds). ; %utVERB: (optional) 1 for verbose output or for verbose and timing info 2 (milliseconds) or 3 (microseconds).
; %utBREAK:(optional) bool - Break upon error or upon failure ; %utBREAK:(optional) bool - Break upon error or upon failure
N %utLIST,%utROU,%ut N %utLIST,%utROU,%ut,%utIO
S %utLIST=1,%utROU(%utLIST)=%utRNAM S %utLIST=1,%utROU(%utLIST)=%utRNAM,%utIO=$S($D(IO)#2:IO,1:$PRINCIPAL)
N IO S IO=%utIO
K ^TMP("%ut",$J,"UTVALS") K ^TMP("%ut",$J,"UTVALS")
D SETUT D SETUT
D EN1(.%utROU,%utLIST) D EN1(.%utROU,%utLIST)
@ -37,7 +38,7 @@ GETSYS() ;.EF - returns numeric indicator of system value
; ;
SETUT ; SETUT ;
; VEN/SMH 26JUL2013 ; VEN/SMH 26JUL2013
I '($D(IO)#2) S IO=$P I '($D(IO)#2) S IO=$PRINCIPLE
S U="^" S U="^"
; VEN/SMH 26JUL2013 END ; VEN/SMH 26JUL2013 END
; ;
@ -53,7 +54,8 @@ EN1(%utROU,%utLIST) ;
; ZEXCEPT: %utGUI -- CONDITIONALLY DEFINED BY GUINEXT ; ZEXCEPT: %utGUI -- CONDITIONALLY DEFINED BY GUINEXT
; ZEXCEPT: %ut -- NEWED IN EN ; ZEXCEPT: %ut -- NEWED IN EN
; ZEXCEPT: GetCPUTime,Process -- parts of Cache method names ; ZEXCEPT: GetCPUTime,Process -- parts of Cache method names
N %utERRL,%utK,%utI,%utJ,%utSTRT ; ZEXCEPT: IOM - if present margin width defined by Kernel
N %utERRL,%utK,%utI,%utJ,%utSTRT,%utONLY,%utROU1
; ZEXCEPT: %utVERB -- ARGUMENT TO EN ; ZEXCEPT: %utVERB -- ARGUMENT TO EN
I '+$G(%utVERB) S %utVERB=0 I '+$G(%utVERB) S %utVERB=0
; ;
@ -69,7 +71,9 @@ EN1(%utROU,%utLIST) ;
; -- GET LIST OF ROUTINES -- ; -- GET LIST OF ROUTINES --
; first get any tree of routines from this one ; first get any tree of routines from this one
D GETTREE^%ut1(.%utROU,.%utLIST) D GETTREE^%ut1(.%utROU,.%utLIST)
; ; identify whether any tests are marked with !test - as run only these tests
S %utONLY=0
F I=1:1 S %utROU1=$G(%utROU(I)) Q:%utROU1="" D CHEKTEST^%ut1(%utROU1,.%ut,.%utETRY,1) I %ut("ENTN")>0 S %utONLY=1 Q
; Now process each routine that has been referenced ; Now process each routine that has been referenced
N CURRROU N CURRROU
S %ut("CURR")=0 S %ut("CURR")=0
@ -80,12 +84,13 @@ EN1(%utROU,%utLIST) ;
. I %utVERB D ; JLI 161113 - if verbose, list routine name as header for following tags . I %utVERB D ; JLI 161113 - if verbose, list routine name as header for following tags
. . N LINEMARK,LENGTH . . N LINEMARK,LENGTH
. . S LENGTH=$S(($L(CURRROU)#2):($L(CURRROU)+3),1:($L(CURRROU)+2)) . . S LENGTH=$S(($L(CURRROU)#2):($L(CURRROU)+3),1:($L(CURRROU)+2))
. . S $P(LINEMARK,"-",(78-LENGTH)/2)="-" . . N RM S RM=$G(IOM,80)-2 ; SMH
. . W !!,LINEMARK," ",CURRROU," ",LINEMARK . . S $P(LINEMARK,"-",(RM-LENGTH)/2)="-"
. . W !!," ",LINEMARK," ",CURRROU," ",LINEMARK
. . Q . . Q
. ; . ;
. ; Collect Test list. . ; Collect Test list.
. D CHEKTEST^%ut1(%utROU(%ut("CURR")),.%ut,.%utETRY) . D CHEKTEST^%ut1(%utROU(%ut("CURR")),.%ut,.%utETRY,%utONLY)
. ; . ;
. ; if a SETUP entry point exists, save it off in %ut . ; if a SETUP entry point exists, save it off in %ut
. S %ut("SETUP")="" . S %ut("SETUP")=""
@ -163,14 +168,17 @@ EN1(%utROU,%utLIST) ;
; -- end EN1 ; -- end EN1
VERBOSE(%utETRY,SUCCESS,%utVERB,%utElapsed) ; Say whether we succeeded or failed. VERBOSE(%utETRY,SUCCESS,%utVERB,%utElapsed) ; Say whether we succeeded or failed.
; ZEXCEPT: %ut - NEWED IN EN ; ZEXCEPT: %ut - NEWED IN EN
; ZEXCEPT: IOM - if present - margin width defined by Kernel
D SETIO^%ut1 D SETIO^%ut1
N RM S RM=73 ; Right Margin N RM S RM=$G(IOM,80)-7 ; Right Margin
I 23[%utVERB,$G(%utElapsed)]"" S RM=RM-$L(%utElapsed)-1 I 23[%utVERB,$G(%utElapsed)]"" S RM=RM-9
I $X>RM W !," "
N I F I=$X+3:1:RM W "-" N I F I=$X+3:1:RM W "-"
W ?RM W ?RM
I $G(SUCCESS) W "[OK]" I $G(SUCCESS) W "[OK]"
E W "[FAIL]" E W "[FAIL]"
I 23[%utVERB,$G(%utElapsed)]"" W " ",%utElapsed ;I 23[%utVERB,$G(%utElapsed)]"" W " ",%utElapsed
I 23[%utVERB,$G(%utElapsed)]"" W " ",$J(%utElapsed,8,3),"ms"
D RESETIO^%ut1 D RESETIO^%ut1
Q Q
; ;
@ -354,7 +362,7 @@ LSTUTVAL(UTDATA) ; .SR - lists cumulative totals in UTDATA array
Q Q
; ;
; ;
GUISET(%utRSLT,XTSET) ; Entry point for GUI start with selected Test Set IEN - called by %ut-TEST GROUP LOAD rpc GUISET(%utRSLT,XTSET) ; Entry point for GUI start with selected Test Set IEN - called by utMUNIT-TEST GROUP LOAD rpc
N %utROU,%utLIST,%ut N %utROU,%utLIST,%ut
D SETUT D SETUT
S %ut("RSLT")=$NA(^TMP("MUNIT-%utRSLT",$J)) K @%ut("RSLT") S %ut("RSLT")=$NA(^TMP("MUNIT-%utRSLT",$J)) K @%ut("RSLT")
@ -364,7 +372,7 @@ GUISET(%utRSLT,XTSET) ; Entry point for GUI start with selected Test Set IEN - c
S %utRSLT=%ut("RSLT") S %utRSLT=%ut("RSLT")
Q Q
; ;
GUILOAD(%utRSLT,%utROUN) ; Entry point for GUI start with %utROUN containing primary routine name - called by %ut-TEST LOAD rpc GUILOAD(%utRSLT,%utROUN) ; Entry point for GUI start with %utROUN containing primary routine name - called by utMUNIT-TEST LOAD rpc
N %utROU,%ut N %utROU,%ut
D SETUT D SETUT
S %ut("RSLT")=$NA(^TMP("MUNIT-%utRSLT",$J)) K @%ut("RSLT") S %ut("RSLT")=$NA(^TMP("MUNIT-%utRSLT",$J)) K @%ut("RSLT")
@ -381,6 +389,8 @@ GETLIST(%utROU,%utLIST,%utRSLT) ; called from GUISET, GUILOAD
D GETTREE^%ut1(.%utROU,%utLIST) D GETTREE^%ut1(.%utROU,%utLIST)
F I=1:1 Q:'$D(%utROU(I)) S %utROUL(%utROU(I))="" F I=1:1 Q:'$D(%utROU(I)) S %utROUL(%utROU(I))=""
S %utROUN="" F S %utROUN=$O(%utROUL(%utROUN)) Q:%utROUN="" D LOAD(%utROUN,.%utCNT,XTVALUE,XTCOMNT,.%utROUL) S %utROUN="" F S %utROUN=$O(%utROUL(%utROUN)) Q:%utROUN="" D LOAD(%utROUN,.%utCNT,XTVALUE,XTCOMNT,.%utROUL)
; 170705 JLI next line added to remove @ and ! indicators from tags for GUI run
S I="" F S I=$O(@XTVALUE@(I)) Q:I="" S %utLINE=^(I) I $P(%utLINE,U,2)="@" S @XTVALUE@(I)=$P(%utLINE,U)_U_$P(%utLINE,U,3,99)
M @%utRSLT=@XTVALUE M @%utRSLT=@XTVALUE
K @%utRSLT@("SHUTDOWN") K @%utRSLT@("SHUTDOWN")
K @%utRSLT@("STARTUP") K @%utRSLT@("STARTUP")
@ -400,7 +410,7 @@ LOAD(%utROUN,%utNCNT,XTVALUE,XTCOMNT,%utROUL) ; called from GETLIST, and recursi
F %utI=1:1 S LINE=$T(@("XTROU+"_%utI_"^"_%utROUN)) S XTX1=$P(LINE,";",3) Q:XTX1="" S XTCOMNT=$P(LINE,";",4) I '$D(%utROUL(XTX1)) S %utROUL(XTX1)="" D LOAD(XTX1,.%utNCNT,XTVALUE,XTCOMNT,.%utROUL) F %utI=1:1 S LINE=$T(@("XTROU+"_%utI_"^"_%utROUN)) S XTX1=$P(LINE,";",3) Q:XTX1="" S XTCOMNT=$P(LINE,";",4) I '$D(%utROUL(XTX1)) S %utROUL(XTX1)="" D LOAD(XTX1,.%utNCNT,XTVALUE,XTCOMNT,.%utROUL)
Q Q
; ;
GUINEXT(%utRSLT,%utLOC,XTGUISEP) ; Entry point for GUI execute next test - called by %ut-TEST NEXT rpc GUINEXT(%utRSLT,%utLOC,XTGUISEP) ; Entry point for GUI execute next test - called by utMUNIT-TEST NEXT rpc
; XTGUISEP - added 110719 to provide for changing separator for GUI ; XTGUISEP - added 110719 to provide for changing separator for GUI
; return from ^ to another value ~~^~~ so that data returned ; return from ^ to another value ~~^~~ so that data returned
; is not affected by ^ values in the data - if not present ; is not affected by ^ values in the data - if not present
@ -464,4 +474,4 @@ ZHDIF(%ZH0,%ZH1) ;Display dif of two $ZH's
N T1 S T1=SC1+DC1+MCS1 N T1 S T1=SC1+DC1+MCS1
; ;
N %ZH2 S %ZH2=T1-T0*1000 N %ZH2 S %ZH2=T1-T0*1000
QUIT %ZH2_"ms" QUIT %ZH2

View File

@ -1,6 +1,6 @@
%ut1 ;VEN/SMH/JLI - CONTINUATION OF M-UNIT PROCESSING ;02/11/17 09:37 %ut1 ;VEN/SMH/JLI - CONTINUATION OF M-UNIT PROCESSING ;04/26/17 21:10
;;1.5;MASH UTILITIES;;Feb 8, 2017; ;;1.5;MASH UTILITIES;;Jul 8, 2017;Build 6
; Submitted to OSEHRA Feb 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html) ; Submitted to OSEHRA Jul 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html)
; Original routine authored by Joel L. Ivey as XTMUNIT1 while working for U.S. Department of Veterans Affairs 2003-2012 ; Original routine authored by Joel L. Ivey as XTMUNIT1 while working for U.S. Department of Veterans Affairs 2003-2012
; Includes addition of original COV entry and code related coverage analysis as well as other substantial additions authored by Sam Habiel 07/2013?04/2014 ; Includes addition of original COV entry and code related coverage analysis as well as other substantial additions authored by Sam Habiel 07/2013?04/2014
; Original by Dr. Joel Ivey ; Original by Dr. Joel Ivey
@ -19,10 +19,11 @@
;XTMUNIT1 ;JLI/FO-OAK-CONTINUATION OF UNIT TEST ROUTINE ;2014-04-17 5:26 PM ;XTMUNIT1 ;JLI/FO-OAK-CONTINUATION OF UNIT TEST ROUTINE ;2014-04-17 5:26 PM
;;7.3;TOOLKIT;**81**;APR 25 1995;Build 24 ;;7.3;TOOLKIT;**81**;APR 25 1995;Build 24
; ;
CHEKTEST(%utROU,%ut,%utUETRY) ; Collect Test list. CHEKTEST(%utROU,%ut,%utUETRY,FLAG) ; Collect Test list.
; %utROU - input - Name of routine to check for tags with @TEST attribute ; %utROU - input - Name of routine to check for tags with @TEST attribute
; %ut - input/output - passed by reference ; %ut - input/output - passed by reference
; %utUETRY - input/output - passed by reference ; %utUETRY - input/output - passed by reference
; FLAG - optional - if present and true, select only !TEST entries to run
; ;
; Test list collected in two ways: ; Test list collected in two ways:
; - @TEST on labellines ; - @TEST on labellines
@ -32,13 +33,21 @@ CHEKTEST(%utROU,%ut,%utUETRY) ; Collect Test list.
; ;
; This stanza and everything below is for collecting @TEST. ; This stanza and everything below is for collecting @TEST.
N I,LIST N I,LIST
S FLAG=$G(FLAG,0)
S I=$L($T(@(U_%utROU))) I I<0 Q "-1^Invalid Routine Name" S I=$L($T(@(U_%utROU))) I I<0 Q "-1^Invalid Routine Name"
D NEWSTYLE(.LIST,%utROU) D NEWSTYLE(.LIST,%utROU)
F I=1:1:LIST S %ut("ENTN")=%ut("ENTN")+1,%utUETRY(%ut("ENTN"))=$P(LIST(I),U),%utUETRY(%ut("ENTN"),"NAME")=$P(LIST(I),U,2,99) I FLAG D
. F I=1:1:LIST Q:'$D(LIST(I)) Q:LIST'>0 I $P(LIST(I),U)'="!" S LIST=LIST-1,I=I-1 F J=I+1:1:LIST S LIST(J)=LIST(J+1) I J=LIST K LIST(J+1)
. F I=LIST+1:1 Q:'$D(LIST(I)) K LIST(I)
. Q
F I=1:1:LIST S %ut("ENTN")=%ut("ENTN")+1,%utUETRY(%ut("ENTN"))=$P(LIST(I),U,2),%utUETRY(%ut("ENTN"),"NAME")=$P(LIST(I),U,3,99)
; ;
I FLAG Q ; don't check if only !TEST entries are selected
; This Stanza is to collect XTENT offsets ; This Stanza is to collect XTENT offsets
N %utUI F %utUI=1:1 S %ut("ELIN")=$T(@("XTENT+"_%utUI_"^"_%utROU)) Q:$P(%ut("ELIN"),";",3)="" D N %utUI F %utUI=1:1 S %ut("ELIN")=$T(@("XTENT+"_%utUI_"^"_%utROU)) Q:$P(%ut("ELIN"),";",3)="" D
. S %ut("ENTN")=%ut("ENTN")+1,%utUETRY(%ut("ENTN"))=$P(%ut("ELIN"),";",3),%utUETRY(%ut("ENTN"),"NAME")=$P(%ut("ELIN"),";",4) . N TAGNAME,FOUND S FOUND=0,TAGNAME=$P(%ut("ELIN"),";",3)
. F I=1:1:%ut("ENTN") I %utUETRY(I)=TAGNAME S FOUND=1 Q ; skip if already under NEW STYLE as well
. I 'FOUND S %ut("ENTN")=%ut("ENTN")+1,%utUETRY(%ut("ENTN"))=$P(%ut("ELIN"),";",3),%utUETRY(%ut("ENTN"),"NAME")=$P(%ut("ELIN"),";",4)
. Q . Q
; ;
QUIT QUIT
@ -66,14 +75,21 @@ NEWSTYLE(LIST,ROUNAME) ; JLI 140726 identify and return list of newstyle tags or
F I=1:1 S LINE=$T(@("+"_I_"^"_ROUNAME)) Q:LINE="" S VALUE=$$CHECKTAG(LINE) I VALUE'="" S LIST=LIST+1,LIST(LIST)=VALUE F I=1:1 S LINE=$T(@("+"_I_"^"_ROUNAME)) Q:LINE="" S VALUE=$$CHECKTAG(LINE) I VALUE'="" S LIST=LIST+1,LIST(LIST)=VALUE
Q Q
; ;
CHECKTAG(LINE) ; JLI 140726 check line to determine @test TAG CHECKTAG(LINE) ; JLI 170426 modified to add !TEST to checks check line to determine @test TAG
; LINE - input - Line of code to be checked ; LINE - input - Line of code to be checked
; returns null line if not @TEST line, otherwise TAG^NOTE ; returns null line if not @TEST line or !TEST line, otherwise TAG^NOTE
N TAG
S TAG=$$CHKTAGS(LINE,"@TEST") I TAG'="" Q "@"_U_TAG
S TAG=$$CHKTAGS(LINE,"!TEST")
I TAG'="" S TAG="!"_U_TAG
Q TAG
;
CHKTAGS(LINE,TEST) ; check input LINE for TAG line, containing TEST as first test after comment
N TAG,NOTE,CHAR N TAG,NOTE,CHAR
I $E(LINE)=" " Q "" ; test entry must have a tag I $E(LINE)=" " Q "" ; test entry must have a tag
I $$UP(LINE)'["@TEST" Q "" ; must have @TEST declaration I $$UP(LINE)'[TEST Q "" ; must have TEST declaration
I $P($$UP(LINE),"@TEST")["(" Q "" ; can't have an argument I $P($$UP(LINE),"TEST")["(" Q "" ; can't have an argument
S TAG=$P(LINE," "),LINE=$P(LINE," ",2,400),NOTE=$P($$UP(LINE),"@TEST"),LINE=$E(LINE,$L(NOTE)+5+1,$L(LINE)) S TAG=$P(LINE," "),LINE=$P(LINE," ",2,400),NOTE=$P($$UP(LINE),TEST),LINE=$E(LINE,$L(NOTE)+5+1,$L(LINE))
F Q:NOTE="" S CHAR=$E(NOTE),NOTE=$E(NOTE,2,$L(NOTE)) I " ;"'[CHAR Q ; F Q:NOTE="" S CHAR=$E(NOTE),NOTE=$E(NOTE,2,$L(NOTE)) I " ;"'[CHAR Q ;
I $L(NOTE)'=0 Q "" ; @TEST must be first text on line I $L(NOTE)'=0 Q "" ; @TEST must be first text on line
F Q:$E(LINE)'=" " S LINE=$E(LINE,2,$L(LINE)) ; remove leading spaces from test info F Q:$E(LINE)'=" " S LINE=$E(LINE,2,$L(LINE)) ; remove leading spaces from test info
@ -90,7 +106,6 @@ FAIL(XTERMSG) ; Entry point for generating a failure message
. D SETIO . D SETIO
. W !,%ut("ENT")," - " W:%ut("NAME")'="" %ut("NAME")," - " W XTERMSG,! D . W !,%ut("ENT")," - " W:%ut("NAME")'="" %ut("NAME")," - " W XTERMSG,! D
. . S %ut("FAIL")=%ut("FAIL")+1,%utERRL(%ut("FAIL"))=%ut("NAME"),%utERRL(%ut("FAIL"),"MSG")=XTERMSG,%utERRL(%ut("FAIL"),"ENTRY")=%ut("ENT") . . S %ut("FAIL")=%ut("FAIL")+1,%utERRL(%ut("FAIL"))=%ut("NAME"),%utERRL(%ut("FAIL"),"MSG")=XTERMSG,%utERRL(%ut("FAIL"),"ENTRY")=%ut("ENT")
. . ; I $D(%ut("BREAK")) BREAK ; Break upon failure ; output comment added JLI 161020
. . I $D(%ut("BREAK")) W !,"Breaking on Failure" BREAK ; . . I $D(%ut("BREAK")) W !,"Breaking on Failure" BREAK ;
. . Q . . Q
. D RESETIO . D RESETIO
@ -144,6 +159,7 @@ COV(NMSPS,COVCODE,VERBOSITY) ; VEN/SMH - PUBLIC ENTRY POINT; Coverage calculatio
; ;
; ZEXCEPT: %utcovxx - SET and KILLED in this code at top level ; ZEXCEPT: %utcovxx - SET and KILLED in this code at top level
; ZEXCEPT: %Monitor,%apiOBJ,DecomposeStatus,LineByLine,Start,Stop,System,class - not variables parts of classes ; ZEXCEPT: %Monitor,%apiOBJ,DecomposeStatus,LineByLine,Start,Stop,System,class - not variables parts of classes
; ZEXCEPT: %utIO - NEWed and set in EN^%ut
N COVER,COVERSAV,I,NMSP1,RTN,RTNS,ERR,STATUS N COVER,COVERSAV,I,NMSP1,RTN,RTNS,ERR,STATUS
W !,"Loading routines to test coverage...",! W !,"Loading routines to test coverage...",!
I ($$GETSYS^%ut()=47) D ; GT.M only! I ($$GETSYS^%ut()=47) D ; GT.M only!
@ -154,11 +170,8 @@ COV(NMSPS,COVCODE,VERBOSITY) ; VEN/SMH - PUBLIC ENTRY POINT; Coverage calculatio
.. N RN S RN="" .. N RN S RN=""
.. F S RN=$O(%ZR(RN)) Q:RN="" W RN," " D .. F S RN=$O(%ZR(RN)) Q:RN="" W RN," " D
... N L2 S L2=$T(+2^@RN) ... N L2 S L2=$T(+2^@RN)
. . . ;S L2=$TR(L2,$C(9,32)) ; Translate spaces and tabs out ; JLI 160316 commented out
. . . S L2=$TR(L2,$C(9)," ") ; change tabs to spaces ; JLI 160316 inserted to replace above . . . S L2=$TR(L2,$C(9)," ") ; change tabs to spaces ; JLI 160316 inserted to replace above
. . . ;I $E(L2,1,2)'=";;" K %ZR(RN) ; Not a human produced routine JLI 160316 commented out . . . I $E($P(L2," ",2),1,2)'=";;" K %ZR(RN) W !,"Routine "_RN_" removed from analysis, since it doesn't have the standard second line format",!
. . . ; routine doesn't follow the standards and second line start with ;; ; JLI 160316
. . . I $E($P(L2," ",2),1,2)'=";;" K %ZR(RN) W !,"Routine "_RN_" removed from analysis, since it doesn't have the standard second line",! ; JLI 160316 inserted to replace above
.. M RTNS=%ZR .. M RTNS=%ZR
.. K %ZR .. K %ZR
. Q . Q
@ -200,9 +213,10 @@ COV(NMSPS,COVCODE,VERBOSITY) ; VEN/SMH - PUBLIC ENTRY POINT; Coverage calculatio
. NEW $ETRAP,$ESTACK . NEW $ETRAP,$ESTACK
. I ($$GETSYS^%ut()=47) D ; GT.M SPECIFIC . I ($$GETSYS^%ut()=47) D ; GT.M SPECIFIC
. . SET $ETRAP="Q:($ES&$Q) -9 Q:$ES W ""CTRL-C ENTERED""" . . SET $ETRAP="Q:($ES&$Q) -9 Q:$ES W ""CTRL-C ENTERED"""
. . USE $PRINCIPAL:(CTRAP=$C(3)) . . ;USE $PRINCIPAL:(CTRAP=$C(3)) ; JLI 170403
. . USE %utIO:(CTRAP=$C(3)) ; JLI 170403
. . Q . . Q
. NEW (DUZ,IO,COVCODE,U,DILOCKTM,DISYS,DT,DTIME,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY) . NEW (DUZ,IO,COVCODE,U,DILOCKTM,DISYS,DT,DTIME,IOBS,IOF,IOM,ION,IOS,IOSL,IOST,IOT,IOXY,%utIO)
. XECUTE COVCODE . XECUTE COVCODE
. Q . Q
; GT.M STOP PROFILING if this is the original level that started it ; GT.M STOP PROFILING if this is the original level that started it
@ -225,14 +239,18 @@ COV(NMSPS,COVCODE,VERBOSITY) ; VEN/SMH - PUBLIC ENTRY POINT; Coverage calculatio
. I VERBOSITY=-1 D . I VERBOSITY=-1 D
. . K ^TMP("%utCOVREPORT",$J) . . K ^TMP("%utCOVREPORT",$J)
. . D COVRPTGL^%utcover($NA(^TMP("%utCOVCOHORTSAV",$J)),$NA(^TMP("%utCOVCOHORT",$J)),$NA(^TMP("%utCOVRESULT",$J)),$NA(^TMP("%utCOVREPORT",$J))) . . D COVRPTGL^%utcover($NA(^TMP("%utCOVCOHORTSAV",$J)),$NA(^TMP("%utCOVCOHORT",$J)),$NA(^TMP("%utCOVRESULT",$J)),$NA(^TMP("%utCOVREPORT",$J)))
. . K ^TMP("%utCOVCOHORTSAV",$J),^TMP("%utCOVCOHORT",$J),^TMP("%utCOVRESULT",$J) ; %utCOVREPORT contains the data for the user
. . Q
. E D
. . D COVRPT($NA(^TMP("%utCOVCOHORTSAV",$J)),$NA(^TMP("%utCOVCOHORT",$J)),$NA(^TMP("%utCOVRESULT",$J)),VERBOSITY)
. . K ^TMP("%utCOVCOHORTSAV",$J),^TMP("%utCOVCOHORT",$J),^TMP("%utCOVRESULT",$J),^TMP("%utCOVREPORT",$J)
. . Q . . Q
. E D COVRPT($NA(^TMP("%utCOVCOHORTSAV",$J)),$NA(^TMP("%utCOVCOHORT",$J)),$NA(^TMP("%utCOVRESULT",$J)),VERBOSITY)
. Q . Q
QUIT QUIT
; ;
CACHECOV(GLOBSAV,GLOB) ; CACHECOV(GLOBSAV,GLOB) ;
; ZEXCEPT: %Monitor,GetMetrics,GetRoutineCount,GetRoutineName,LineByLine,System,class - not variable names, part of classes ; ZEXCEPT: %Monitor,GetMetrics,GetRoutineCount,GetRoutineName,LineByLine,System,class - not variable names, part of classes
N DIF,I,METRIC,METRICNT,METRICS,MTRICNUM,ROUNAME,ROUNUM,X,XCNP,XXX N %N,DIF,I,METRIC,METRICNT,METRICS,MTRICNUM,ROUNAME,ROUNUM,X,XCNP,XXX
I $$ISUTEST(),'$D(^TMP("%utt4val",$J)) S ROUNUM=1,METRICS="RtnLine",METRICNT=1,ROUNAME="%ut" I $$ISUTEST(),'$D(^TMP("%utt4val",$J)) S ROUNUM=1,METRICS="RtnLine",METRICNT=1,ROUNAME="%ut"
I $D(^TMP("%utt4val",$J))!'$$ISUTEST() S ROUNUM=##class(%Monitor.System.LineByLine).GetRoutineCount(),METRICS=##class(%Monitor.System.LineByLine).GetMetrics(),METRICNT=$l(METRICS,",") I $D(^TMP("%utt4val",$J))!'$$ISUTEST() S ROUNUM=##class(%Monitor.System.LineByLine).GetRoutineCount(),METRICS=##class(%Monitor.System.LineByLine).GetMetrics(),METRICNT=$l(METRICS,",")
; if only running to do coverage, should be 1 ; if only running to do coverage, should be 1

2336
Routines/%ut_MASH_1.5_0.ro Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
%utcover ;JLI - generic coverage and unit test runner ;02/06/17 13:51 %utcover ;JLI - generic coverage and unit test runner ;04/29/17 15:29
;;1.5;MASH UTILITIES;;Feb 8, 2017; ;;1.5;MASH UTILITIES;;Jul 8, 2017;Build 6
; Submitted to OSEHRA Feb 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html) ; Submitted to OSEHRA Jul 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html)
; Original routine authored by Joel L. Ivey 08/15. Additional work 08/15-02/17. ; Original routine authored by Joel L. Ivey 08/15. Additional work 08/15-02/17.
; ;
; Changes: (Moved from %ut and %ut1) ; Changes: (Moved from %ut and %ut1)
@ -99,7 +99,8 @@ COVENTRY ; setup of COVERAGE NEWs most variables, so TESTROUS passed by global
. I ROU'=+ROU S TESTS(ROU)="" . I ROU'=+ROU S TESTS(ROU)=""
. F I=1:1 S VAL=$P(TESTROUS(ROU),",",I) Q:VAL="" S TESTS(VAL)="" . F I=1:1 S VAL=$P(TESTROUS(ROU),",",I) Q:VAL="" S TESTS(VAL)=""
. Q . Q
S ROU="" F S ROU=$O(TESTS(ROU)) Q:ROU="" D ;W !,"COVENTRY^%utcover TESTS:",! ZW TESTS
S ROU="" F S ROU=$O(TESTS(ROU)) Q:ROU="" D W !,"Coventry ROU=",ROU
. W !!,"------------------- RUNNING ",ROU," -------------------",! ; JLI 160319 put CR after line so periods start on new line . W !!,"------------------- RUNNING ",ROU," -------------------",! ; JLI 160319 put CR after line so periods start on new line
. I ROU[U D @ROU . I ROU[U D @ROU
. I ROU'[U D @("EN^%ut("""_ROU_""")") . I ROU'[U D @("EN^%ut("""_ROU_""")")
@ -131,7 +132,9 @@ COVERAGE(ROUNMSP,TESTROUS,XCLDROUS,RESLTLVL) ; run coverage analysis for multipl
; 3 - Full analysis for each tag, and lists out those lines which were ; 3 - Full analysis for each tag, and lists out those lines which were
; not executed during the analysis ; not executed during the analysis
; ;
N I,ROU,TYPE,XCLUDE ;W !,"ENTERING COVERAGE^%utcover" H 1 ; DEBUG
N I,ROU,TYPE,XCLUDE,%utIO
S %utIO=$I
S RESLTLVL=$G(RESLTLVL,1) S RESLTLVL=$G(RESLTLVL,1)
I (RESLTLVL<1) S RESLTLVL=1 I (RESLTLVL<1) S RESLTLVL=1
I (RESLTLVL>3) S RESLTLVL=3 I (RESLTLVL>3) S RESLTLVL=3

View File

@ -1,6 +1,6 @@
%utt1 ; VEN/SMH-JLI - Testing routines for M-Unit;02/06/17 13:47 %utt1 ; VEN/SMH-JLI - Testing routines for M-Unit;07/10/17 09:30
;;1.5;MASH UTILITIES;;Feb 8, 2017; ;;1.5;MASH UTILITIES;;Jul 8, 2017;Build 6
; Submitted to OSEHRA Feb 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html) ; Submitted to OSEHRA Jul 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html)
; Original routine authored by Sam H. Habiel 07/2013-04/2014 ; Original routine authored by Sam H. Habiel 07/2013-04/2014
; Additions and modifications made by Joel L. Ivey 05/2014-12/2015 ; Additions and modifications made by Joel L. Ivey 05/2014-12/2015
; Modifications made by Sam H. Habiel 02/2016 ; Modifications made by Sam H. Habiel 02/2016
@ -22,7 +22,7 @@
Q Q
; ;
VERBOSE(VERBSITY) ; VERBOSE(VERBSITY) ;
I ($G(VERBSITY)<0)!($G(VERBSITY)>3) N VERBSITY S VERBSITY=3 I (+$G(VERBSITY)<1)!($G(VERBSITY)>3) N VERBSITY S VERBSITY=3
W !!,"Running tests in VERBOSE mode with "_$S(VERBSITY=1:"no timing",VERBSITY=2:"whole millisecond timing",3:"fractional millisecond timing"),! W !!,"Running tests in VERBOSE mode with "_$S(VERBSITY=1:"no timing",VERBSITY=2:"whole millisecond timing",3:"fractional millisecond timing"),!
D EN^%ut($T(+0),VERBSITY) ; Run tests here, be verbose. D EN^%ut($T(+0),VERBSITY) ; Run tests here, be verbose.
QUIT QUIT
@ -77,7 +77,7 @@ T4 ; Specified in XTMTAG
; ;
T5 ; ditto T5 ; ditto
; ZEXCEPT: %ut - NEWed and created in EN1^%ut ; ZEXCEPT: %ut - NEWed and created in EN1^%ut
D CHKTF(0,"This is an intentional failure.") D CHKTF(0,"This is an intentional failure")
D CHKEQ(%ut("FAIL"),1,"By this point, we should have failed one test") D CHKEQ(%ut("FAIL"),1,"By this point, we should have failed one test")
D FAIL^%ut("Intentionally throwing a failure") D FAIL^%ut("Intentionally throwing a failure")
D CHKEQ(%ut("FAIL"),2,"By this point, we should have failed two tests") D CHKEQ(%ut("FAIL"),2,"By this point, we should have failed two tests")

View File

@ -1,6 +1,6 @@
%utt2 ; VEN/SMH - Bad Ass Continuation of Unit Tests;02/06/17 13:48 %utt2 ; VEN/SMH - Bad Ass Continuation of Unit Tests;02/06/17 13:48
;;1.5;MASH UTILITIES;;Feb 8, 2017; ;;1.5;MASH UTILITIES;;Jul 8, 2017;Build 6
; Submitted to OSEHRA Feb 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html) ; Submitted to OSEHRA Jul 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html)
; Original routine authored by Sam H. Habiel ; Original routine authored by Sam H. Habiel
; Modifications made by Joel L. Ivey 05/2014-09/2015 ; Modifications made by Joel L. Ivey 05/2014-09/2015
; ;

View File

@ -1,6 +1,6 @@
%utt3 ; VEN/SMH-JLI - Unit Tests Coverage Tests;04/08/16 20:38 %utt3 ; VEN/SMH-JLI - Unit Tests Coverage Tests;04/08/16 20:38
;;1.5;MASH UTILITIES;;Feb 8, 2017; ;;1.5;MASH UTILITIES;;Jul 8, 2017;Build 6
; Submitted to OSEHRA Feb 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html) ; Submitted to OSEHRA Jul 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html)
; Original routine authored by Sam H. Habiel 07/2013-04/2014 ; Original routine authored by Sam H. Habiel 07/2013-04/2014
; Additions and modifications made by Joel L. Ivey 05/2014-08/2015 ; Additions and modifications made by Joel L. Ivey 05/2014-08/2015
; ;

View File

@ -1,6 +1,6 @@
%utt4 ; VEN/SMH/JLI - Coverage Test Runner;01/30/17 11:46 %utt4 ; VEN/SMH/JLI - Coverage Test Runner;01/30/17 11:46
;;1.5;MASH UTILITIES;;Feb 8, 2017; ;;1.5;MASH UTILITIES;;Jul 8, 2017;Build 6
; Submitted to OSEHRA Feb 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html) ; Submitted to OSEHRA Jul 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html)
; Original routine authored by Sam H. Habiel 07/2013-04/2014 ; Original routine authored by Sam H. Habiel 07/2013-04/2014
; Additions and modifications made by Joel L. Ivey 05/2014-08/2015 ; Additions and modifications made by Joel L. Ivey 05/2014-08/2015
; ;

View File

@ -1,8 +1,9 @@
%utt5 ;JLI - test for aspects of MUnit functionality ;01/30/17 11:46 %utt5 ;JLI - test for aspects of MUnit functionality ;04/05/17 15:36
;;1.5;MASH UTILITIES;;Feb 8, 2017; ;;1.5;MASH UTILITIES;;Jul 8, 2017;Build 6
; Submitted to OSEHRA Feb 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html) ; Submitted to OSEHRA Jul 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html)
; Original routine authored by Joel L. Ivey 05/2014-12/2015. ; Original routine authored by Joel L. Ivey 05/2014-12/2015.
; ;
D ^%utt1
Q Q
; ;
OLDSTYLE ; OLDSTYLE ;

View File

@ -1,6 +1,6 @@
%utt6 ;JLI - Unit tests for MUnit functionality ;02/01/17 09:44 %utt6 ;JLI - Unit tests for MUnit functionality ;04/26/17 16:26
;;1.5;MASH UTILITIES;;Feb 8, 2017; ;;1.5;MASH UTILITIES;;Jul 8, 2017;Build 6
; Submitted to OSEHRA Feb 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html) ; Submitted to OSEHRA Jul 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html)
; Original routine authored by Joel L. Ivey 05/2014-12/2015 ; Original routine authored by Joel L. Ivey 05/2014-12/2015
; ;
; ;
@ -42,6 +42,8 @@ VERBOSE ;
Q Q
; ;
CMNDLINE ; CMNDLINE ;
N %utt6
I '$D(VERBOSE) N VERBOSE S VERBOSE=1
W !!,"RUNNING COMMAND LINE TESTS VIA DOSET^%ut",! W !!,"RUNNING COMMAND LINE TESTS VIA DOSET^%ut",!
D DOSET^%ut(1,VERBOSE) ; run `1 in M-UNIT TEST GROUP file D DOSET^%ut(1,VERBOSE) ; run `1 in M-UNIT TEST GROUP file
; ;
@ -99,7 +101,7 @@ NEWSTYLE ; tests return of valid new style or @TEST indicators
N LIST N LIST
D NEWSTYLE^%ut1(.LIST,"%utt5") D NEWSTYLE^%ut1(.LIST,"%utt5")
D CHKEQ^%ut(LIST,1,"Returned an incorrect number ("_LIST_") of New Style indicators - should be one") D CHKEQ^%ut(LIST,1,"Returned an incorrect number ("_LIST_") of New Style indicators - should be one")
I LIST>0 D CHKEQ^%ut(LIST(1),"NEWSTYLE^identify new style test indicator functionality","Returned incorrect TAG^reason "_LIST(1)) I LIST>0 D CHKEQ^%ut(LIST(1),"@^NEWSTYLE^identify new style test indicator functionality","Returned incorrect TAG^reason "_LIST(1))
I LIST>0 D CHKEQ^%ut($G(LIST(2)),"","Returned a value for LIST(2) - should not have any value (i.e., null)") I LIST>0 D CHKEQ^%ut($G(LIST(2)),"","Returned a value for LIST(2) - should not have any value (i.e., null)")
; the following is basically just for coverage ; the following is basically just for coverage
D PICKSET^%ut D PICKSET^%ut

186
Routines/%utt7.m Normal file
View File

@ -0,0 +1,186 @@
%utt7 ;JLI/JIVEY@JIVEYSOFT.COM - Unit tests for MUnit !TEST functionality ;04/26/17 21:41
;;1.5;MASH UTILITIES;;Jul 8, 2017;Build 6
; Submitted to OSEHRA Jul 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html)
; Original routine authored by Joel L. Ivey 04/2017
;
; This routine is a copy of %utt1 modified by changing tag T1 to !TEST instead of @Test and adding !TEST to tag T5 to test
; the handling of !TEST functionality, so that only only those tags are run while tags marked @TEST or under XTENT are ignored
;
W !,"Running tests in VERBOSE mode"
N X R !,"ENTER RETURN TO CONTINUE: ",X:3
D EN^%ut($T(+0),3) ; Run tests here.
I $G(^TMP("%ut",$J,"UTVALS"))'="7^2^5^2^0" W !!,"The test of !TEST failed, since expected results were:",!,"Ran 7 Routines, 2 Entry Tags",!,"Checked 5 tests, with 2 failures and encountered 0 errors."
Q
;
VERBOSE(VERBSITY) ;
I (+$G(VERBSITY)<1)!($G(VERBSITY)>3) N VERBSITY S VERBSITY=3
W !!,"Running tests in VERBOSE mode with "_$S(VERBSITY=1:"no timing",VERBSITY=2:"whole millisecond timing",3:"fractional millisecond timing"),!
D EN^%ut($T(+0),VERBSITY) ; Run tests here, be verbose.
QUIT
;
STARTUP ; M-Unit Start-Up - This runs before anything else.
; ZEXCEPT: KBANCOUNT - created here, removed in SHUTDOWN
S ^TMP($J,"%ut","STARTUP")=""
S KBANCOUNT=1
QUIT
;
SHUTDOWN ; M-Unit Shutdown - This runs after everything else is done.
; ZEXCEPT: KBANCOUNT - created in STARTUP, removed here
K ^TMP($J,"%ut","STARTUP")
K KBANCOUNT
QUIT
;
;
;
SETUP ; This runs before every test.
; ZEXCEPT: KBANCOUNT - created in STARTUP, removed in SHUTDOWN
S KBANCOUNT=KBANCOUNT+1
QUIT
;
TEARDOWN ; This runs after every test
; ZEXCEPT: KBANCOUNT - created in STARTUP, removed in SHUTDOWN
S KBANCOUNT=KBANCOUNT-1
QUIT
;
;
;
T1 ; !TEST - Make sure Start-up Ran
D CHKTF($D(^TMP($J,"%ut","STARTUP")),"Start-up node on ^TMP must exist")
QUIT
;
T2 ; @TEST - Make sure Set-up runs
; ZEXCEPT: KBANCOUNT - created in STARTUP, removed in SHUTDOWN
D CHKEQ(KBANCOUNT,2,"KBANCount not incremented properly at SETUP")
QUIT
;
T3 ; @TEST - Make sure Teardown runs
; ZEXCEPT: KBANCOUNT - created in STARTUP, removed in SHUTDOWN
D CHKEQ(KBANCOUNT,2,"KBANCount not decremented properly at TEARDOWN")
QUIT
;
T4 ; Specified in XTMTAG
; 140731 JLI - note that this will fail when run from the GUI runner, since it calls each tag separately
; ZEXCEPT: %utETRY - newed and created in EN1^%ut
; ZEXCEPT: %utGUI -- CONDITIONALLY DEFINED BY GUINEXT^%ut
I $G(%utGUI) D CHKEQ(%utETRY,"T4","T4 should be the value for %utETRY in the GUI Runner")
I '$G(%utGUI) D CHKEQ(%utETRY(4),"T4","T4 should be the collected as the fourth entry in %utETRY")
QUIT
;
T5 ; !test - ditto
; ZEXCEPT: %ut - NEWed and created in EN1^%ut
D CHKTF(0,"This is an intentional failure")
D CHKEQ(%ut("FAIL"),1,"By this point, we should have failed one test")
D FAIL^%ut("Intentionally throwing a failure")
D CHKEQ(%ut("FAIL"),2,"By this point, we should have failed two tests")
; S %ut("FAIL")=0 ; Okay... Boy's and Girls... as the developer I can do that.
QUIT
;
T6 ; ditto
; ZEXCEPT: %ut - NEWed and created in EN1^%ut
N TESTCOUNT S TESTCOUNT=%ut("CHK")
D SUCCEED^%ut
D SUCCEED^%ut
D CHKEQ(%ut("CHK"),TESTCOUNT+2,"Succeed should increment the number of tests")
QUIT
;
T7 ; Make sure we write to principal even though we are on another device
; This is a rather difficult test to carry out for GT.M and Cache...
; ZEXCEPT: GetEnviron,Util,delete,newversion,readonly - not really variables
N D
I $$GETSYS^%ut()=47 S D="/tmp/test.txt" ; All GT.M ; VMS not supported.
I $$GETSYS^%ut()=0 D ; All Cache
. I $ZVERSION(1)=2 S D=$SYSTEM.Util.GetEnviron("temp")_"\test.txt" I 1 ; Windows
. E S D="/tmp/test.txt" ; not windows; VMS not supported.
I $$GETSYS^%ut()=0 O D:"NWS" ; Cache new file
I $$GETSYS^%ut()=47 O D:(newversion) ; GT.M new file
U D
WRITE "HELLO",!
WRITE "HELLO",!
C D
;
; Now open back the file, and read the hello, but open in read only so
; M-Unit will error out if it will write something out there.
;
I $$GETSYS^%ut()=0 O D:"R"
I $$GETSYS^%ut()=47 O D:(readonly)
U D
N X READ X:1
D CHKTF(X="HELLO") ; This should write to the screen the dot not to the file.
D CHKTF(($$LO($IO)=$$LO(D)),"IO device didn't get reset back") ; $$LO is b/c of a bug in Cache/Windows. $IO is not the same cas D.
I $$GETSYS^%ut()=0 C D:"D"
I $$GETSYS^%ut()=47 C D:(delete)
U $P
S IO=$IO
QUIT
;
; At the moment T8^%utt1 throws a fail, with no message
; in the GUI runner. For some reason, both X and Y
; variables are returned as null strings, while in the
; command line runner, Y has a value containing the
; word being sought
;
T8 ; If IO starts with another device, write to that device as if it's the pricipal device
; ZEXCEPT: GetEnviron,Util,delete,newversion,readonly - not really variables
; ZEXCEPT: %utGUI - if present, defined and killed elsewhere
I $D(%utGUI) Q ; GUI doesn't run verbose
N D
I $$GETSYS^%ut()=47 S D="/tmp/test.txt" ; All GT.M ; VMS not supported.
I $$GETSYS^%ut()=0 D ; All Cache
. I $ZVERSION(1)=2 S D=$SYSTEM.Util.GetEnviron("temp")_"\test.txt" I 1 ; Windows
. E S D="/tmp/test.txt" ; not windows; VMS not supported.
I $$GETSYS^%ut()=0 O D:"NWS" ; Cache new file
I $$GETSYS^%ut()=47 O D:(newversion) ; GT.M new file
S IO=D
U D
D ^%utt4 ; Run some Unit Tests
C D
I $$GETSYS^%ut()=0 O D:"R" ; Cache read only
I $$GETSYS^%ut()=47 O D:(readonly) ; GT.M read only
U D
N X,Y,Z,Z1,Z2,Z3,Z4 R X:1,Y:1,Z:1,Z1:1,Z2:1,Z3:1,Z4:1
I $$GETSYS^%ut()=0 C D:"D"
I $$GETSYS^%ut()=47 C D:(delete)
D CHKTF(Z1["MAIN","Write to system during test didn't work")
S IO=$P,IO(0)=IO
QUIT
;
COVRPTGL ;
N GL1,GL2,GL3,GL4
S GL1=$NA(^TMP("%utCOVCOHORTSAVx",$J)) K @GL1
S GL2=$NA(^TMP("%utCOVCOHORTx",$J)) K @GL2
S GL3=$NA(^TMP("%utCOVRESULTx",$J)) K @GL3
S GL4=$NA(^TMP("%utCOVREPORTx",$J)) K @GL4
D SETGLOBS^%uttcovr(GL1,GL2)
D COVRPTGL^%utcover(GL1,GL2,GL3,GL4)
D CHKEQ($G(@GL4@("%ut1","ACTLINES")),"0/9","Wrong number of lines covered f>>or ACTLINES")
D CHKEQ($G(@GL4@("%ut1","ACTLINES",9))," QUIT CNT","Wrong result for last l>>ine not covered for ACTLINES")
D CHKEQ($G(@GL4@("%ut1","CHEKTEST")),"8/10","Wrong number of lines covered >>for CHEKTEST")
D CHKEQ($G(@GL4@("%ut1","CHEKTEST",39))," . Q","Wrong result for last line >>not covered for CHEKTEST")
K @GL1,@GL2,@GL3,@GL4
Q
;
LO(X) Q $TR(X,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
; Shortcut methods for M-Unit
CHKTF(X,Y) ;
D CHKTF^%ut(X,$G(Y))
QUIT
;
CHKEQ(A,B,M) ;
D CHKEQ^%ut(A,B,$G(M))
QUIT
;
XTENT ; Entry points
;;T4;Entry point using XTMENT
;;T5;Error count check
;;T6;Succeed Entry Point
;;T7;Make sure we write to principal even though we are on another device
;;T8;If IO starts with another device, write to that device as if it's the pricipal device
;;COVRPTGL;coverage report returning global
;
XTROU ; Routines containing additional tests
;;%utt1;
;;%utt2; old %utNITU
;;%utt4; old %utNITW
;;%utt5;
;;%utt6;
;;%uttcovr;coverage related tests

View File

@ -1,6 +1,6 @@
%uttcovr ;JIVEYSOFT/JLI - runs coverage tests on %ut and %ut1 routines via unit tests ;02/01/17 11:03 %uttcovr ;JIVEYSOFT/JLI - runs coverage tests on %ut and %ut1 routines via unit tests ;06/16/17 15:37
;;1.5;MASH UTILITIES;;Feb 8, 2017; ;;1.5;MASH UTILITIES;;Jul 8, 2017;Build 6
; Submitted to OSEHRA Feb 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html) ; Submitted to OSEHRA Jul 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html)
; Original routine authored by Joel L. Ivey 05/2014-12/2015 ; Original routine authored by Joel L. Ivey 05/2014-12/2015
; Modified by Joel L. Ivey 02/2016-03/2016 ; Modified by Joel L. Ivey 02/2016-03/2016
; ;
@ -9,10 +9,10 @@
N RUNCODE,XCLUDE N RUNCODE,XCLUDE
; ;
; Have it run the following entry points or, if no ^, call EN^%ut with routine name ; Have it run the following entry points or, if no ^, call EN^%ut with routine name
S RUNCODE(1)="^%utt1,^%utt1,VERBOSE^%utt1(3),^%utt6,VERBOSE^%utt6,VERBOSE3^%utt6,VERBOSE2^%utt6,%uttcovr,^%ut,^%ut1,^%utcover" S RUNCODE(1)="^%utt1,%utt1,VERBOSE^%utt1(3),^%utt6,VERBOSE^%utt6,VERBOSE3^%utt6,VERBOSE2^%utt6,%uttcovr,^%ut,^%ut1,^%utcover,^%utt7,VERBOSE^%utt7"
S RUNCODE("ENTRY^%uttcovr")="" S RUNCODE("ENTRY^%uttcovr")=""
; Have the analysis EXCLUDE the following routines from coverage - unit test routines ; Have the analysis EXCLUDE the following routines from coverage - unit test routines
S XCLUDE(1)="%utt1,%utt2,%utt3,%utt4,%utt5,%utt6,%uttcovr" S XCLUDE(1)="%utt1,%utt2,%utt3,%utt4,%utt5,%utt6,%uttcovr,%utt7"
S XCLUDE(2)="%utf2hex" ; a GT.M system file, although it wasn't showing up anyway S XCLUDE(2)="%utf2hex" ; a GT.M system file, although it wasn't showing up anyway
M ^TMP("%uttcovr",$J,"XCLUDE")=XCLUDE M ^TMP("%uttcovr",$J,"XCLUDE")=XCLUDE
D COVERAGE^%ut("%ut*",.RUNCODE,.XCLUDE,3) D COVERAGE^%ut("%ut*",.RUNCODE,.XCLUDE,3)

View File

@ -1,9 +1,9 @@
%utPOST ;VEN-SMH/JLI - post install for M-Unit Test software ;04/08/16 20:51 %utPOST ;VEN-SMH/JLI - post install for M-Unit Test software ;07/04/17 12:50
;;1.5;MASH UTILITIES;;Feb 8, 2017; ;;1.5;MASH UTILITIES;;Jul 8, 2017;Build 6
; Submitted to OSEHRA Feb 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html) ; Submitted to OSEHRA Jul 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html)
; Original routine authored by Sam H. Habiel 07/2013-04/2014 ; Original routine authored by Sam H. Habiel 07/2013-04/2014
; Additions and modifications made by Joel L. Ivey 05/2014-08/2015 ; Additions and modifications made by Joel L. Ivey 05/2014-08/2015
; Additions and Modifications made by Sam H. Habiel and Joel L. Ivey 02/2016-04/2016 ; Additions and Modifications made by Sam H. Habiel and Joel L. Ivey 02/2016-05/2017
; ;
N X,I N X,I
D RENAME D RENAME
@ -12,8 +12,8 @@
RENAME ; RENAME ;
N %S,%D ; Source, destination N %S,%D ; Source, destination
S U="^" S U="^"
S %S="ut^ut1^utcover^utt1^utt2^utt3^utt4^utt5^utt6^uttcovr" S %S="ut^ut1^utcover^utt1^utt2^utt3^utt4^utt5^utt6^utt7^uttcovr"
S %D="%ut^%ut1^%utcover^%utt1^%utt2^%utt3^%utt4^%utt5^%utt6^%uttcovr" S %D="%ut^%ut1^%utcover^%utt1^%utt2^%utt3^%utt4^%utt5^%utt6^%utt7^%uttcovr"
; ;
MOVE ; rename % routines MOVE ; rename % routines
N %,X,Y,M N %,X,Y,M
@ -30,9 +30,10 @@ MOVE ; rename % routines
QUIT ; END QUIT ; END
; ;
COPY(FROM,TO) ; COPY(FROM,TO) ;
N XVAL N XVAL,SYSTEM
I +$SYSTEM=0 S XVAL="ZL @FROM ZS @TO" X XVAL QUIT S SYSTEM=$S($P($SY,",",2)'="":+$SY,1:0) ; protect against Windows with system names beginning with digits in Cache
I +$SYSTEM=47 DO QUIT I SYSTEM=0 S XVAL="ZL @FROM ZS @TO" X XVAL QUIT
I SYSTEM=47 DO QUIT
. S FROM=$$PATH(FROM) . S FROM=$$PATH(FROM)
. S TO=$$PATH(TO,"WRITE") . S TO=$$PATH(TO,"WRITE")
. N CMD S CMD="cp "_FROM_" "_TO . N CMD S CMD="cp "_FROM_" "_TO
@ -119,8 +120,8 @@ TEST ; @TEST - TESTING TESTING
PREKIDS ; Ready for KIDS - Move % routines to non-percent version PREKIDS ; Ready for KIDS - Move % routines to non-percent version
N %S,%D ; Source, destination N %S,%D ; Source, destination
S U="^" S U="^"
S %D="ut^ut1^utcover^utt1^utt2^utt3^utt4^utt5^utt6^uttcovr" S %D="ut^ut1^utcover^utt1^utt2^utt3^utt4^utt5^utt6^utt7^uttcovr"
S %S="%ut^%ut1^%utcover^%utt1^%utt2^%utt3^%utt4^%utt5^%utt6^%uttcovr" S %S="%ut^%ut1^%utcover^%utt1^%utt2^%utt3^%utt4^%utt5^%utt6^%utt7^%uttcovr"
D MOVE D MOVE
QUIT QUIT
; ;

View File

@ -1,5 +1,5 @@
%utPRE ;VEN/SMH/JLI - pre installation routine to set up MASH UTILITIES package and assign %ut routines and globals ;04/08/16 20:51 %utPRE ;VEN/SMH/JLI - pre installation routine to set up MASH UTILITIES package and assign %ut routines and globals ;04/08/16 20:51
;;1.5;MASH UTILITIES;;Feb 8, 2017; ;;1.5;MASH UTILITIES;;Feb 8, 2017;Build 6
; Submitted to OSEHRA Feb 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html) ; Submitted to OSEHRA Feb 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html)
; Original routine authored by Sam H. Habiel 07/2013-04/2014 ; Original routine authored by Sam H. Habiel 07/2013-04/2014
; Modified by Sam H. Habiel and Joel L. Ivey 02/2016-04/2016 ; Modified by Sam H. Habiel and Joel L. Ivey 02/2016-04/2016