forked from joelivey/M-Unit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MASH_1.5_0.KID
5614 lines (5565 loc) · 171 KB
/
MASH_1.5_0.KID
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
KIDS Distribution saved on Jul 10, 2017@09:40:43
Updated M-Unit functionality
**KIDS**:MASH*1.5*0^
**INSTALL NAME**
MASH*1.5*0
"BLD",9540,0)
MASH*1.5*0^MASH UTILITIES^0^3170710^n
"BLD",9540,1,0)
^^6^6^3170206^
"BLD",9540,1,1,0)
Updated release of MASH UTILITIES package for running unit tests on MUMPS
"BLD",9540,1,2,0)
code fixing a few issues. Unit tests and coverage analysis may now be
"BLD",9540,1,3,0)
run in accounts without VistA packages installed. Cache systems with
"BLD",9540,1,4,0)
computer names beginning with a digit will now be recognized as Cache
"BLD",9540,1,5,0)
systems. If the Break option is used, it now identifies the error or
"BLD",9540,1,6,0)
type of failure that caused the break to happen.
"BLD",9540,4,0)
^9.64PA^17.9001^1
"BLD",9540,4,17.9001,0)
17.9001
"BLD",9540,4,17.9001,222)
y^y^f^^n^^y^m^n
"BLD",9540,4,"B",17.9001,17.9001)
"BLD",9540,6.3)
13
"BLD",9540,"INI")
ZZUTPRE
"BLD",9540,"INIT")
ZZUTPOST
"BLD",9540,"KRN",0)
^9.67PA^779.2^20
"BLD",9540,"KRN",.4,0)
.4
"BLD",9540,"KRN",.401,0)
.401
"BLD",9540,"KRN",.402,0)
.402
"BLD",9540,"KRN",.403,0)
.403
"BLD",9540,"KRN",.5,0)
.5
"BLD",9540,"KRN",.84,0)
.84
"BLD",9540,"KRN",3.6,0)
3.6
"BLD",9540,"KRN",3.8,0)
3.8
"BLD",9540,"KRN",9.2,0)
9.2
"BLD",9540,"KRN",9.8,0)
9.8
"BLD",9540,"KRN",9.8,"NM",0)
^9.68A^11^11
"BLD",9540,"KRN",9.8,"NM",1,0)
ut1^^0^B259333727
"BLD",9540,"KRN",9.8,"NM",2,0)
ut^^0^B259782146
"BLD",9540,"KRN",9.8,"NM",3,0)
utcover^^0^B86708312
"BLD",9540,"KRN",9.8,"NM",4,0)
utt1^^0^B47228039
"BLD",9540,"KRN",9.8,"NM",5,0)
utt2^^0^B685355
"BLD",9540,"KRN",9.8,"NM",6,0)
utt3^^0^B1628564
"BLD",9540,"KRN",9.8,"NM",7,0)
utt4^^0^B3071162
"BLD",9540,"KRN",9.8,"NM",8,0)
utt5^^0^B26349822
"BLD",9540,"KRN",9.8,"NM",9,0)
utt6^^0^B41667626
"BLD",9540,"KRN",9.8,"NM",10,0)
uttcovr^^0^B188096777
"BLD",9540,"KRN",9.8,"NM",11,0)
utt7^^0^B45754056
"BLD",9540,"KRN",9.8,"NM","B","ut",2)
"BLD",9540,"KRN",9.8,"NM","B","ut1",1)
"BLD",9540,"KRN",9.8,"NM","B","utcover",3)
"BLD",9540,"KRN",9.8,"NM","B","utt1",4)
"BLD",9540,"KRN",9.8,"NM","B","utt2",5)
"BLD",9540,"KRN",9.8,"NM","B","utt3",6)
"BLD",9540,"KRN",9.8,"NM","B","utt4",7)
"BLD",9540,"KRN",9.8,"NM","B","utt5",8)
"BLD",9540,"KRN",9.8,"NM","B","utt6",9)
"BLD",9540,"KRN",9.8,"NM","B","utt7",11)
"BLD",9540,"KRN",9.8,"NM","B","uttcovr",10)
"BLD",9540,"KRN",19,0)
19
"BLD",9540,"KRN",19,"NM",0)
^9.68A^3^3
"BLD",9540,"KRN",19,"NM",1,0)
utMUNIT^^0
"BLD",9540,"KRN",19,"NM",2,0)
utMUNIT GROUP EDIT^^0
"BLD",9540,"KRN",19,"NM",3,0)
utMUNIT GROUP RUN^^0
"BLD",9540,"KRN",19,"NM","B","utMUNIT",1)
"BLD",9540,"KRN",19,"NM","B","utMUNIT GROUP EDIT",2)
"BLD",9540,"KRN",19,"NM","B","utMUNIT GROUP RUN",3)
"BLD",9540,"KRN",19.1,0)
19.1
"BLD",9540,"KRN",101,0)
101
"BLD",9540,"KRN",409.61,0)
409.61
"BLD",9540,"KRN",771,0)
771
"BLD",9540,"KRN",779.2,0)
779.2
"BLD",9540,"KRN",870,0)
870
"BLD",9540,"KRN",8989.51,0)
8989.51
"BLD",9540,"KRN",8989.52,0)
8989.52
"BLD",9540,"KRN",8994,0)
8994
"BLD",9540,"KRN",8994,"NM",0)
^9.68A^3^3
"BLD",9540,"KRN",8994,"NM",1,0)
utMUNIT-TEST GROUP LOAD^^0
"BLD",9540,"KRN",8994,"NM",2,0)
utMUNIT-TEST LOAD^^0
"BLD",9540,"KRN",8994,"NM",3,0)
utMUNIT-TEST NEXT^^0
"BLD",9540,"KRN",8994,"NM","B","utMUNIT-TEST GROUP LOAD",1)
"BLD",9540,"KRN",8994,"NM","B","utMUNIT-TEST LOAD",2)
"BLD",9540,"KRN",8994,"NM","B","utMUNIT-TEST NEXT",3)
"BLD",9540,"KRN","B",.4,.4)
"BLD",9540,"KRN","B",.401,.401)
"BLD",9540,"KRN","B",.402,.402)
"BLD",9540,"KRN","B",.403,.403)
"BLD",9540,"KRN","B",.5,.5)
"BLD",9540,"KRN","B",.84,.84)
"BLD",9540,"KRN","B",3.6,3.6)
"BLD",9540,"KRN","B",3.8,3.8)
"BLD",9540,"KRN","B",9.2,9.2)
"BLD",9540,"KRN","B",9.8,9.8)
"BLD",9540,"KRN","B",19,19)
"BLD",9540,"KRN","B",19.1,19.1)
"BLD",9540,"KRN","B",101,101)
"BLD",9540,"KRN","B",409.61,409.61)
"BLD",9540,"KRN","B",771,771)
"BLD",9540,"KRN","B",779.2,779.2)
"BLD",9540,"KRN","B",870,870)
"BLD",9540,"KRN","B",8989.51,8989.51)
"BLD",9540,"KRN","B",8989.52,8989.52)
"BLD",9540,"KRN","B",8994,8994)
"BLD",9540,"QDEF")
^^^^NO^^^^NO^^NO
"BLD",9540,"QUES",0)
^9.62^^
"BLD",9540,"REQB",0)
^9.611^^
"DATA",17.9001,1,0)
TESTS FOR UNIT TEST ROUTINES
"DATA",17.9001,1,1,0)
^17.90011^7^7
"DATA",17.9001,1,1,1,0)
%utt1
"DATA",17.9001,1,1,2,0)
%utt2
"DATA",17.9001,1,1,3,0)
%utt3
"DATA",17.9001,1,1,4,0)
%utt4
"DATA",17.9001,1,1,5,0)
%utt5
"DATA",17.9001,1,1,6,0)
%utt6
"DATA",17.9001,1,1,7,0)
%uttcovr
"DATA",17.9001,1,2,0)
^17.90012^4^4^3170129^^
"DATA",17.9001,1,2,1,0)
This group will run all of the unit tests associated with the M-Unit
"DATA",17.9001,1,2,2,0)
code. In addition, the routine %utt6 should be run as a regular routine
"DATA",17.9001,1,2,3,0)
from the top, and it will run all of the unit tests and,if on a G.TM
"DATA",17.9001,1,2,4,0)
system will run coverage analysis as well.
"FIA",17.9001)
M-UNIT TEST GROUP
"FIA",17.9001,0)
^%ut(17.9001,
"FIA",17.9001,0,0)
17.9001
"FIA",17.9001,0,1)
y^y^f^^n^^y^m^n
"FIA",17.9001,0,10)
"FIA",17.9001,0,11)
"FIA",17.9001,0,"RLRO")
"FIA",17.9001,0,"VR")
1.5^MASH
"FIA",17.9001,17.9001)
0
"FIA",17.9001,17.90011)
0
"FIA",17.9001,17.90012)
0
"INI")
ZZUTPRE
"INIT")
ZZUTPOST
"KRN",19,11538,-1)
0^1
"KRN",19,11538,0)
utMUNIT^M-Unit Tester^^B^^^^^^^^
"KRN",19,11538,1,0)
^^1^1^3140805^
"KRN",19,11538,1,1,0)
This is the context option for M-Unit Test functionality.
"KRN",19,11538,"RPC",0)
^19.05P^3^3
"KRN",19,11538,"RPC",1,0)
utMUNIT-TEST GROUP LOAD
"KRN",19,11538,"RPC",2,0)
utMUNIT-TEST LOAD
"KRN",19,11538,"RPC",3,0)
utMUNIT-TEST NEXT
"KRN",19,11538,"U")
M-UNIT TESTER
"KRN",19,11539,-1)
0^2
"KRN",19,11539,0)
utMUNIT GROUP EDIT^M-Unit Test Group Edit^^E^^^^^^^^TOOLKIT
"KRN",19,11539,1,0)
^19.06^6^6^3031030^^^
"KRN",19,11539,1,1,0)
This option can be used to maintain a listing of unit tests related to a
"KRN",19,11539,1,2,0)
specific topic. The Group identifies the topic, and the unit tests
"KRN",19,11539,1,3,0)
related to that topic are added in the multiple. Unit Tests can be run
"KRN",19,11539,1,4,0)
by selecting a group, and all unit tests included in the multiple will be
"KRN",19,11539,1,5,0)
used for the test. In addition, any other references under the XTROU tag
"KRN",19,11539,1,6,0)
in any of the included test routines will be included in the run.
"KRN",19,11539,30)
%ut(17.9001,
"KRN",19,11539,31)
AEMQL
"KRN",19,11539,50)
17.9001
"KRN",19,11539,51)
.01;1
"KRN",19,11539,"U")
M-UNIT TEST GROUP EDIT
"KRN",19,11540,-1)
0^3
"KRN",19,11540,0)
utMUNIT GROUP RUN^Run M-Unit Tests From Test Groups^^R^^^^^^^^TOOLKIT
"KRN",19,11540,1,0)
^^2^2^3031030^
"KRN",19,11540,1,1,0)
Provides a means of initiating a unit test run from the menu system based
"KRN",19,11540,1,2,0)
on entries in the M-UNIT TEST GROUP file (#17.9001).
"KRN",19,11540,25)
PICKSET^%ut
"KRN",19,11540,"U")
RUN M-UNIT TESTS FROM TEST GRO
"KRN",8994,3261,-1)
0^1
"KRN",8994,3261,0)
utMUNIT-TEST GROUP LOAD^GUISET^%ut^4^^^^1
"KRN",8994,3262,-1)
0^2
"KRN",8994,3262,0)
utMUNIT-TEST LOAD^GUILOAD^%ut^4^^^^1
"KRN",8994,3263,-1)
0^3
"KRN",8994,3263,0)
utMUNIT-TEST NEXT^GUINEXT^%ut^4^^^^1
"MBREQ")
0
"ORD",16,8994)
8994;16;1;;;;;;;RPCDEL^XPDIA1
"ORD",16,8994,0)
REMOTE PROCEDURE
"ORD",18,19)
19;18;;;OPT^XPDTA;OPTF1^XPDIA;OPTE1^XPDIA;OPTF2^XPDIA;;OPTDEL^XPDIA
"ORD",18,19,0)
OPTION
"PKG",222,-1)
1^1
"PKG",222,0)
MASH UTILITIES^%u^Utilities associated with the M Advanced Shell
"PKG",222,20,0)
^9.402P^^
"PKG",222,22,0)
^9.49I^1^1
"PKG",222,22,1,0)
1.5
"PKG",222,22,1,"PAH",1,0)
0^3170710^2802
"PKG",222,22,1,"PAH",1,1,0)
^^6^6^3170710
"PKG",222,22,1,"PAH",1,1,1,0)
Updated release of MASH UTILITIES package for running unit tests on MUMPS
"PKG",222,22,1,"PAH",1,1,2,0)
code fixing a few issues. Unit tests and coverage analysis may now be
"PKG",222,22,1,"PAH",1,1,3,0)
run in accounts without VistA packages installed. Cache systems with
"PKG",222,22,1,"PAH",1,1,4,0)
computer names beginning with a digit will now be recognized as Cache
"PKG",222,22,1,"PAH",1,1,5,0)
systems. If the Break option is used, it now identifies the error or
"PKG",222,22,1,"PAH",1,1,6,0)
type of failure that caused the break to happen.
"QUES","XPF1",0)
Y
"QUES","XPF1","??")
^D REP^XPDH
"QUES","XPF1","A")
Shall I write over your |FLAG| File
"QUES","XPF1","B")
YES
"QUES","XPF1","M")
D XPF1^XPDIQ
"QUES","XPF2",0)
Y
"QUES","XPF2","??")
^D DTA^XPDH
"QUES","XPF2","A")
Want my data |FLAG| yours
"QUES","XPF2","B")
YES
"QUES","XPF2","M")
D XPF2^XPDIQ
"QUES","XPI1",0)
YO
"QUES","XPI1","??")
^D INHIBIT^XPDH
"QUES","XPI1","A")
Want KIDS to INHIBIT LOGONs during the install
"QUES","XPI1","B")
NO
"QUES","XPI1","M")
D XPI1^XPDIQ
"QUES","XPM1",0)
PO^VA(200,:EM
"QUES","XPM1","??")
^D MG^XPDH
"QUES","XPM1","A")
Enter the Coordinator for Mail Group '|FLAG|'
"QUES","XPM1","B")
"QUES","XPM1","M")
D XPM1^XPDIQ
"QUES","XPO1",0)
Y
"QUES","XPO1","??")
^D MENU^XPDH
"QUES","XPO1","A")
Want KIDS to Rebuild Menu Trees Upon Completion of Install
"QUES","XPO1","B")
NO
"QUES","XPO1","M")
D XPO1^XPDIQ
"QUES","XPZ1",0)
Y
"QUES","XPZ1","??")
^D OPT^XPDH
"QUES","XPZ1","A")
Want to DISABLE Scheduled Options, Menu Options, and Protocols
"QUES","XPZ1","B")
NO
"QUES","XPZ1","M")
D XPZ1^XPDIQ
"QUES","XPZ2",0)
Y
"QUES","XPZ2","??")
^D RTN^XPDH
"QUES","XPZ2","A")
Want to MOVE routines to other CPUs
"QUES","XPZ2","B")
NO
"QUES","XPZ2","M")
D XPZ2^XPDIQ
"RTN")
13
"RTN","ZZUTPOST")
0^^B21060915
"RTN","ZZUTPOST",1,0)
%utPOST ;VEN-SMH/JLI - post install for M-Unit Test software ;07/04/17 12:50
"RTN","ZZUTPOST",2,0)
;;1.5;MASH UTILITIES;;Jul 8, 2017;Build 13
"RTN","ZZUTPOST",3,0)
; Submitted to OSEHRA Jul 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html)
"RTN","ZZUTPOST",4,0)
; Original routine authored by Sam H. Habiel 07/2013-04/2014
"RTN","ZZUTPOST",5,0)
; Additions and modifications made by Joel L. Ivey 05/2014-08/2015
"RTN","ZZUTPOST",6,0)
; Additions and Modifications made by Sam H. Habiel and Joel L. Ivey 02/2016-05/2017
"RTN","ZZUTPOST",7,0)
;
"RTN","ZZUTPOST",8,0)
N X,I
"RTN","ZZUTPOST",9,0)
D RENAME
"RTN","ZZUTPOST",10,0)
QUIT
"RTN","ZZUTPOST",11,0)
;
"RTN","ZZUTPOST",12,0)
RENAME ;
"RTN","ZZUTPOST",13,0)
N %S,%D ; Source, destination
"RTN","ZZUTPOST",14,0)
S U="^"
"RTN","ZZUTPOST",15,0)
S %S="ut^ut1^utcover^utt1^utt2^utt3^utt4^utt5^utt6^utt7^uttcovr"
"RTN","ZZUTPOST",16,0)
S %D="%ut^%ut1^%utcover^%utt1^%utt2^%utt3^%utt4^%utt5^%utt6^%utt7^%uttcovr"
"RTN","ZZUTPOST",17,0)
;
"RTN","ZZUTPOST",18,0)
MOVE ; rename % routines
"RTN","ZZUTPOST",19,0)
N %,X,Y,M
"RTN","ZZUTPOST",20,0)
F %=1:1:$L(%D,"^") D D MES(M) I +$SY=47 D MES(" ")
"RTN","ZZUTPOST",21,0)
. S M="",X=$P(%S,U,%) ; from
"RTN","ZZUTPOST",22,0)
. S Y=$P(%D,U,%) ; to
"RTN","ZZUTPOST",23,0)
. Q:X=""
"RTN","ZZUTPOST",24,0)
. S M="Routine: "_$J(X,8)
"RTN","ZZUTPOST",25,0)
. Q:Y="" I $T(^@X)="" S M=M_" Missing" Q
"RTN","ZZUTPOST",26,0)
. S M=M_" Loaded, "
"RTN","ZZUTPOST",27,0)
. D COPY(X,Y)
"RTN","ZZUTPOST",28,0)
. S M=M_"Saved as "_$J(Y,8)
"RTN","ZZUTPOST",29,0)
;
"RTN","ZZUTPOST",30,0)
QUIT ; END
"RTN","ZZUTPOST",31,0)
;
"RTN","ZZUTPOST",32,0)
COPY(FROM,TO) ;
"RTN","ZZUTPOST",33,0)
N XVAL,SYSTEM
"RTN","ZZUTPOST",34,0)
S SYSTEM=$S($P($SY,",",2)'="":+$SY,1:0) ; protect against Windows with system names beginning with digits in Cache
"RTN","ZZUTPOST",35,0)
I SYSTEM=0 S XVAL="ZL @FROM ZS @TO" X XVAL QUIT
"RTN","ZZUTPOST",36,0)
I SYSTEM=47 DO QUIT
"RTN","ZZUTPOST",37,0)
. S FROM=$$PATH(FROM)
"RTN","ZZUTPOST",38,0)
. S TO=$$PATH(TO,"WRITE")
"RTN","ZZUTPOST",39,0)
. N CMD S CMD="cp "_FROM_" "_TO
"RTN","ZZUTPOST",40,0)
. O "cp":(shell="/bin/sh":command=CMD:WRITEONLY)::"PIPE"
"RTN","ZZUTPOST",41,0)
. U "cp" C "cp"
"RTN","ZZUTPOST",42,0)
QUIT
"RTN","ZZUTPOST",43,0)
;
"RTN","ZZUTPOST",44,0)
PATH(ROUTINE,MODE) ; for GT.M return source file with path for a routine
"RTN","ZZUTPOST",45,0)
;input: ROUTINE=Name of routine
"RTN","ZZUTPOST",46,0)
; MODE="READ" or "WRITE" defaults to READ
"RTN","ZZUTPOST",47,0)
;output: Full filename
"RTN","ZZUTPOST",48,0)
;
"RTN","ZZUTPOST",49,0)
S MODE=$G(MODE,"READ") ;set MODE to default value
"RTN","ZZUTPOST",50,0)
N FILE S FILE=$TR(ROUTINE,"%","_")_".m" ;convert rtn name to filename
"RTN","ZZUTPOST",51,0)
N ZRO S ZRO=$ZRO
"RTN","ZZUTPOST",52,0)
;
"RTN","ZZUTPOST",53,0)
; Get source routine
"RTN","ZZUTPOST",54,0)
N %ZR
"RTN","ZZUTPOST",55,0)
I MODE="READ" D SILENT^%RSEL(ROUTINE,"SRC") Q %ZR(ROUTINE)_FILE
"RTN","ZZUTPOST",56,0)
;
"RTN","ZZUTPOST",57,0)
; We are writing. Parse directories and get 1st routine directory
"RTN","ZZUTPOST",58,0)
N DIRS
"RTN","ZZUTPOST",59,0)
D PARSEZRO(.DIRS,ZRO)
"RTN","ZZUTPOST",60,0)
N PATH S PATH=$$ZRO1ST(.DIRS)
"RTN","ZZUTPOST",61,0)
;
"RTN","ZZUTPOST",62,0)
QUIT PATH_FILE ;end of PATH return directory and filename
"RTN","ZZUTPOST",63,0)
;
"RTN","ZZUTPOST",64,0)
;
"RTN","ZZUTPOST",65,0)
PARSEZRO(DIRS,ZRO) ; Parse $zroutines properly into an array
"RTN","ZZUTPOST",66,0)
N PIECE
"RTN","ZZUTPOST",67,0)
N I
"RTN","ZZUTPOST",68,0)
F I=1:1:$L(ZRO," ") S PIECE(I)=$P(ZRO," ",I)
"RTN","ZZUTPOST",69,0)
N CNT S CNT=1
"RTN","ZZUTPOST",70,0)
F I=0:0 S I=$O(PIECE(I)) Q:'I D
"RTN","ZZUTPOST",71,0)
. S DIRS(CNT)=$G(DIRS(CNT))_PIECE(I)
"RTN","ZZUTPOST",72,0)
. I DIRS(CNT)["("&(DIRS(CNT)[")") S CNT=CNT+1 QUIT
"RTN","ZZUTPOST",73,0)
. I DIRS(CNT)'["("&(DIRS(CNT)'[")") S CNT=CNT+1 QUIT
"RTN","ZZUTPOST",74,0)
. S DIRS(CNT)=DIRS(CNT)_" " ; prep for next piece
"RTN","ZZUTPOST",75,0)
QUIT
"RTN","ZZUTPOST",76,0)
;
"RTN","ZZUTPOST",77,0)
ZRO1ST(DIRS) ; $$ Get first routine directory
"RTN","ZZUTPOST",78,0)
N OUT ; $$ return
"RTN","ZZUTPOST",79,0)
N %1 S %1=DIRS(1) ; 1st directory
"RTN","ZZUTPOST",80,0)
; Parse with (...)
"RTN","ZZUTPOST",81,0)
I %1["(" DO
"RTN","ZZUTPOST",82,0)
. S OUT=$P(%1,"(",2)
"RTN","ZZUTPOST",83,0)
. I OUT[" " S OUT=$P(OUT," ")
"RTN","ZZUTPOST",84,0)
. E S OUT=$P(OUT,")")
"RTN","ZZUTPOST",85,0)
; no parens
"RTN","ZZUTPOST",86,0)
E S OUT=%1
"RTN","ZZUTPOST",87,0)
;
"RTN","ZZUTPOST",88,0)
; Add trailing slash
"RTN","ZZUTPOST",89,0)
I $E(OUT,$L(OUT))'="/" S OUT=OUT_"/"
"RTN","ZZUTPOST",90,0)
QUIT OUT
"RTN","ZZUTPOST",91,0)
;
"RTN","ZZUTPOST",92,0)
MES(T,B) ;Write message.
"RTN","ZZUTPOST",93,0)
S B=$G(B)
"RTN","ZZUTPOST",94,0)
I $L($T(BMES^XPDUTL)) D BMES^XPDUTL(T):B,MES^XPDUTL(T):'B Q
"RTN","ZZUTPOST",95,0)
W:B ! W !,T
"RTN","ZZUTPOST",96,0)
Q
"RTN","ZZUTPOST",97,0)
;
"RTN","ZZUTPOST",98,0)
TEST ; @TEST - TESTING TESTING
"RTN","ZZUTPOST",99,0)
;
"RTN","ZZUTPOST",100,0)
N FAIL S FAIL=0
"RTN","ZZUTPOST",101,0)
N ZR S ZR="o(p r) /var/abc(/var/abc/r/) /abc/def $gtm_dist/libgtmutl.so vista.so"
"RTN","ZZUTPOST",102,0)
N DIRS D PARSEZRO(.DIRS,ZR)
"RTN","ZZUTPOST",103,0)
N FIRSTDIR S FIRSTDIR=$$ZRO1ST(.DIRS)
"RTN","ZZUTPOST",104,0)
I FIRSTDIR'="p/" W !,"TEST 1 Expected 'p/', got '"_FIRSTDIR_"'" S FAIL=FAIL+1 ;S $EC=",U1,"
"RTN","ZZUTPOST",105,0)
;
"RTN","ZZUTPOST",106,0)
N ZR S ZR="/var/abc(/var/abc/r/) o(p r) /abc/def $gtm_dist/libgtmutl.so vista.so"
"RTN","ZZUTPOST",107,0)
N DIRS D PARSEZRO(.DIRS,ZR)
"RTN","ZZUTPOST",108,0)
N FIRSTDIR S FIRSTDIR=$$ZRO1ST(.DIRS)
"RTN","ZZUTPOST",109,0)
I FIRSTDIR'="/var/abc/r/" W !,"TEST 2 Expected '/var/abc/r/', got '"_FIRSTDIR_"'" S FAIL=FAIL+1 ;S $EC=",U1,"
"RTN","ZZUTPOST",110,0)
;
"RTN","ZZUTPOST",111,0)
N ZR S ZR="/abc/def /var/abc(/var/abc/r/) o(p r) $gtm_dist/libgtmutl.so vista.so"
"RTN","ZZUTPOST",112,0)
N DIRS D PARSEZRO(.DIRS,ZR)
"RTN","ZZUTPOST",113,0)
N FIRSTDIR S FIRSTDIR=$$ZRO1ST(.DIRS)
"RTN","ZZUTPOST",114,0)
I FIRSTDIR'="/abc/def/" W !,"TEST 3 expected '/abc/def/', got '"_FIRSTDIR_"'" S FAIL=FAIL+1 ;S $EC=",U1,"
"RTN","ZZUTPOST",115,0)
;
"RTN","ZZUTPOST",116,0)
I FAIL=0 WRITE "All tests have run successfully!",!
"RTN","ZZUTPOST",117,0)
I FAIL>0 WRITE !,"***** Failed "_FAIL_" tests out of 3 *****",!
"RTN","ZZUTPOST",118,0)
QUIT
"RTN","ZZUTPOST",119,0)
;
"RTN","ZZUTPOST",120,0)
PREKIDS ; Ready for KIDS - Move % routines to non-percent version
"RTN","ZZUTPOST",121,0)
N %S,%D ; Source, destination
"RTN","ZZUTPOST",122,0)
S U="^"
"RTN","ZZUTPOST",123,0)
S %D="ut^ut1^utcover^utt1^utt2^utt3^utt4^utt5^utt6^utt7^uttcovr"
"RTN","ZZUTPOST",124,0)
S %S="%ut^%ut1^%utcover^%utt1^%utt2^%utt3^%utt4^%utt5^%utt6^%utt7^%uttcovr"
"RTN","ZZUTPOST",125,0)
D MOVE
"RTN","ZZUTPOST",126,0)
QUIT
"RTN","ZZUTPOST",127,0)
;
"RTN","ZZUTPRE")
0^^B11731108
"RTN","ZZUTPRE",1,0)
%utPRE ;VEN/SMH/JLI - pre installation routine to set up MASH UTILITIES package and assign %ut routines and globals ;04/08/16 20:51
"RTN","ZZUTPRE",2,0)
;;1.5;MASH UTILITIES;;Jul 8, 2017;Build 13
"RTN","ZZUTPRE",3,0)
; Submitted to OSEHRA Jul 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html)
"RTN","ZZUTPRE",4,0)
; Original routine authored by Sam H. Habiel 07/2013-04/2014
"RTN","ZZUTPRE",5,0)
; Modified by Sam H. Habiel and Joel L. Ivey 02/2016-04/2016
"RTN","ZZUTPRE",6,0)
;
"RTN","ZZUTPRE",7,0)
; The following is used to create, if it does not exist, the MASH UTILITIES
"RTN","ZZUTPRE",8,0)
; package, and to assign the %u namespace to this package. This special
"RTN","ZZUTPRE",9,0)
; processing is necessary, since the input transform currently will not accept a
"RTN","ZZUTPRE",10,0)
; % or lower case character in the namespace.
"RTN","ZZUTPRE",11,0)
; JLI 160406 - following modified to update PACKAGE entry including current version and version subfile
"RTN","ZZUTPRE",12,0)
N Y
"RTN","ZZUTPRE",13,0)
S Y=+$O(^DIC(9.4,"B","MASH UTILITIES",""))
"RTN","ZZUTPRE",14,0)
I 'Y N DIC,X S DIC="^DIC(9.4,",DIC(0)="",X="MASH UTILITIES",DIC("DR")="1////%u;2///Utilities associated with the M Advanced Shell" D FILE^DICN
"RTN","ZZUTPRE",15,0)
I Y>0 D
"RTN","ZZUTPRE",16,0)
. N YVAL S YVAL=+Y
"RTN","ZZUTPRE",17,0)
. N VERSION S VERSION=$P($T(+2),";",3)
"RTN","ZZUTPRE",18,0)
. N DIE,DA,DR S DIE="^DIC(9.4,",DA=+Y,DR="13///"_VERSION D ^DIE
"RTN","ZZUTPRE",19,0)
. N DIC,X,DA S DA(1)=YVAL,DIC="^DIC(9.4,"_DA(1)_",22,",DIC(0)="",X=1.4,DIC("DR")="2///"_DT D FILE^DICN
"RTN","ZZUTPRE",20,0)
. Q
"RTN","ZZUTPRE",21,0)
; end of modification
"RTN","ZZUTPRE",22,0)
; and if necessary, as in CACHE, map %ut routine and namespace in the current account.
"RTN","ZZUTPRE",23,0)
I +$SY=0 D CACHEMAP ; This routine is CACHE specific
"RTN","ZZUTPRE",24,0)
Q
"RTN","ZZUTPRE",25,0)
; The following code was provided by Sam Habiel to map %
"RTN","ZZUTPRE",26,0)
CACHEMAP ; Map %ut* Globals and Routines away from %SYS in Cache
"RTN","ZZUTPRE",27,0)
; ZEXCEPT: AddGlobalMapping,Class,Config,Configuration,Create,Get,GetErrorText,GetGlobalMapping,MapRoutines,MapGlobals,Namespaces,Status,class - these are all part of Cache class names
"RTN","ZZUTPRE",28,0)
; Get current namespace
"RTN","ZZUTPRE",29,0)
N NMSP
"RTN","ZZUTPRE",30,0)
I $P($P($ZV,") ",2),"(")<2012 S NMSP=$ZU(5)
"RTN","ZZUTPRE",31,0)
I $P($P($ZV,") ",2),"(")>2011 S NMSP=$NAMESPACE
"RTN","ZZUTPRE",32,0)
;
"RTN","ZZUTPRE",33,0)
N $ET S $ET="ZN NMSP D ^%ZTER S $EC="""""
"RTN","ZZUTPRE",34,0)
;
"RTN","ZZUTPRE",35,0)
ZN "%SYS" ; Go to SYS
"RTN","ZZUTPRE",36,0)
;
"RTN","ZZUTPRE",37,0)
; Props
"RTN","ZZUTPRE",38,0)
N PROP
"RTN","ZZUTPRE",39,0)
N % S %=##Class(Config.Namespaces).Get(NMSP,.PROP) ; Get all namespace properties
"RTN","ZZUTPRE",40,0)
I '% W !,"Error="_$SYSTEM.Status.GetErrorText(%) S $EC=",U-CONFIG-FAIL," QUIT
"RTN","ZZUTPRE",41,0)
;
"RTN","ZZUTPRE",42,0)
N DBG S DBG=PROP("Globals") ; get the database globals location
"RTN","ZZUTPRE",43,0)
N DBR S DBR=PROP("Routines") ; get the database routines location
"RTN","ZZUTPRE",44,0)
; the following is needed for the call to MapGlobals.Create below, is not set in above call
"RTN","ZZUTPRE",45,0)
S PROP("Database")=NMSP
"RTN","ZZUTPRE",46,0)
;
"RTN","ZZUTPRE",47,0)
; Map %ut globals away from %SYS
"RTN","ZZUTPRE",48,0)
N %
"RTN","ZZUTPRE",49,0)
; JLI 160406 - the following was modified to try the new method, and if it is not there
"RTN","ZZUTPRE",50,0)
; (or another error), it then tries the method replacing the original one
"RTN","ZZUTPRE",51,0)
; try recommended replacement for deprecated method
"RTN","ZZUTPRE",52,0)
TRY { ; try new style
"RTN","ZZUTPRE",53,0)
S %=##class(Config.Configuration).GetGlobalMapping(NMSP,"%ut*","",DBG,DBG)
"RTN","ZZUTPRE",54,0)
}
"RTN","ZZUTPRE",55,0)
CATCH {
"RTN","ZZUTPRE",56,0)
S %=0
"RTN","ZZUTPRE",57,0)
}
"RTN","ZZUTPRE",58,0)
; if it didn't work, use the deprecated method
"RTN","ZZUTPRE",59,0)
I '% S %=##Class(Config.MapGlobals).Get(NMSP,"%ut*",.PROP) ; go back to original
"RTN","ZZUTPRE",60,0)
;
"RTN","ZZUTPRE",61,0)
; if not previously set, set new global mapping entry - try recommended replacement
"RTN","ZZUTPRE",62,0)
; for deprecated method for adding a global mapping
"RTN","ZZUTPRE",63,0)
TRY { ; try new style to add global mapping
"RTN","ZZUTPRE",64,0)
I '% S %=##class(Config.Configuration).AddGlobalMapping(NMSP,"%ut*","",DBG,DBG)
"RTN","ZZUTPRE",65,0)
}
"RTN","ZZUTPRE",66,0)
CATCH {
"RTN","ZZUTPRE",67,0)
S %=0
"RTN","ZZUTPRE",68,0)
}
"RTN","ZZUTPRE",69,0)
; again, if it didn't work use the original (now deprecated) method
"RTN","ZZUTPRE",70,0)
S PROP("Database")=NMSP ; needed for call to MapGlobals.Create below
"RTN","ZZUTPRE",71,0)
I '% S %=##Class(Config.MapGlobals).Create(NMSP,"%ut",.PROP) ; doesn't work with "%ut*"
"RTN","ZZUTPRE",72,0)
;
"RTN","ZZUTPRE",73,0)
I '% W !,"Error="_$SYSTEM.Status.GetErrorText(%) S $EC=",U-CONFIG-FAIL," QUIT
"RTN","ZZUTPRE",74,0)
; end of modification
"RTN","ZZUTPRE",75,0)
; Map %ut routines away from %SYS
"RTN","ZZUTPRE",76,0)
N PROPRTN S PROPRTN("Database")=DBR
"RTN","ZZUTPRE",77,0)
N %
"RTN","ZZUTPRE",78,0)
S %=##Class(Config.MapRoutines).Get(NMSP,"%ut*",.PROPRTN)
"RTN","ZZUTPRE",79,0)
S PROPRTN("Database")=DBR ; Cache seems to like deleting this
"RTN","ZZUTPRE",80,0)
I '% S %=##Class(Config.MapRoutines).Create(NMSP,"%ut*",.PROPRTN)
"RTN","ZZUTPRE",81,0)
I '% W !,"Error="_$SYSTEM.Status.GetErrorText(%) S $EC=",U-CONFIG-FAIL," QUIT
"RTN","ZZUTPRE",82,0)
ZN NMSP ; Go back
"RTN","ZZUTPRE",83,0)
QUIT
"RTN","ut")
0^2^B259782146
"RTN","ut",1,0)
%ut ;VEN-SMH/JLI - PRIMARY PROGRAM FOR M-UNIT TESTING ;04/26/17 21:08
"RTN","ut",2,0)
;;1.5;MASH UTILITIES;;Jul 8, 2017;Build 13
"RTN","ut",3,0)
; Submitted to OSEHRA Jul 8, 2017 by Joel L. Ivey under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html)
"RTN","ut",4,0)
; Original routine authored by Joel L. Ivey as XTMUNIT while working for U.S. Department of Veterans Affairs 2003-2012
"RTN","ut",5,0)
; 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
"RTN","ut",6,0)
; Additions and modifications made by Sam H. Habiel and Joel L. Ivey 2013-02/2017 ;
"RTN","ut",7,0)
;
"RTN","ut",8,0)
; This routine and its companion, %ut1, provide the basic functionality for
"RTN","ut",9,0)
; running unit tests on parts of M programs either at the command line level
"RTN","ut",10,0)
; or via the M-Unit GUI application for windows operating systems.
"RTN","ut",11,0)
;
"RTN","ut",12,0)
; Original by Dr. Joel Ivey (JLI)
"RTN","ut",13,0)
; Contributions by Dr. Sam Habiel (SMH)
"RTN","ut",14,0)
; older comments moved to %utcover due to space requirements
"RTN","ut",15,0)
;
"RTN","ut",16,0)
; For a list of changes in this version in this routine see tag %ut in routine %utt2
"RTN","ut",17,0)
;
"RTN","ut",18,0)
D ^%utt6 ; runs unit tests on all of it
"RTN","ut",19,0)
Q
"RTN","ut",20,0)
;
"RTN","ut",21,0)
EN(%utRNAM,%utVERB,%utBREAK) ; .SR Entry point with primary test routine name
"RTN","ut",22,0)
; %utRNAM: (Required) Routine name that contians the tags with @TEST in them or the tag XTROU
"RTN","ut",23,0)
; %utVERB: (optional) 1 for verbose output or for verbose and timing info 2 (milliseconds) or 3 (microseconds).
"RTN","ut",24,0)
; %utBREAK:(optional) bool - Break upon error or upon failure
"RTN","ut",25,0)
N %utLIST,%utROU,%ut,%utIO
"RTN","ut",26,0)
S %utLIST=1,%utROU(%utLIST)=%utRNAM,%utIO=$S($D(IO)#2:IO,1:$PRINCIPAL)
"RTN","ut",27,0)
N IO S IO=%utIO
"RTN","ut",28,0)
K ^TMP("%ut",$J,"UTVALS")
"RTN","ut",29,0)
D SETUT
"RTN","ut",30,0)
D EN1(.%utROU,%utLIST)
"RTN","ut",31,0)
Q
"RTN","ut",32,0)
;
"RTN","ut",33,0)
GETSYS() ;.EF - returns numeric indicator of system value
"RTN","ut",34,0)
N VALUE
"RTN","ut",35,0)
; Cache uses name of system, and has no second comma piece (unless it is part of system name), so set value to zero if no second comma piece is present in case system name begins with a number
"RTN","ut",36,0)
S VALUE=$S($P($SY,",",2)'="":+$SY,1:0)
"RTN","ut",37,0)
Q VALUE
"RTN","ut",38,0)
;
"RTN","ut",39,0)
SETUT ;
"RTN","ut",40,0)
; VEN/SMH 26JUL2013
"RTN","ut",41,0)
I '($D(IO)#2) S IO=$PRINCIPLE
"RTN","ut",42,0)
S U="^"
"RTN","ut",43,0)
; VEN/SMH 26JUL2013 END
"RTN","ut",44,0)
;
"RTN","ut",45,0)
; ZEXCEPT: %ut -- NEWED ON ENTRY
"RTN","ut",46,0)
S %ut("IO")=IO
"RTN","ut",47,0)
S %ut=1 ; set to identify unit test being run check with $$ISUTEST^%ut()
"RTN","ut",48,0)
;
"RTN","ut",49,0)
; ZEXCEPT: %utBREAK
"RTN","ut",50,0)
I $G(%utBREAK) S %ut("BREAK")=1
"RTN","ut",51,0)
Q
"RTN","ut",52,0)
;
"RTN","ut",53,0)
EN1(%utROU,%utLIST) ;
"RTN","ut",54,0)
; ZEXCEPT: %utGUI -- CONDITIONALLY DEFINED BY GUINEXT
"RTN","ut",55,0)
; ZEXCEPT: %ut -- NEWED IN EN
"RTN","ut",56,0)
; ZEXCEPT: GetCPUTime,Process -- parts of Cache method names
"RTN","ut",57,0)
; ZEXCEPT: IOM - if present margin width defined by Kernel
"RTN","ut",58,0)
N %utERRL,%utK,%utI,%utJ,%utSTRT,%utONLY,%utROU1
"RTN","ut",59,0)
; ZEXCEPT: %utVERB -- ARGUMENT TO EN
"RTN","ut",60,0)
I '+$G(%utVERB) S %utVERB=0
"RTN","ut",61,0)
;
"RTN","ut",62,0)
; Structure map for %ut
"RTN","ut",63,0)
; -- CURR = Counter for routine number. Used as sub in %utROU
"RTN","ut",64,0)
; -- ECNT = Entry point count in loop (cf. NERT); VEN/SMH - Needed?
"RTN","ut",65,0)
; -- FAIL = Number of failures
"RTN","ut",66,0)
; -- CHK = Number of checks ran (TF/EQ/FAIL)
"RTN","ut",67,0)
; -- NENT = Number of entry points ran
"RTN","ut",68,0)
; -- ERRN = Number of errors
"RTN","ut",69,0)
S %ut("CURR")=0,%ut("ECNT")=0,%ut("FAIL")=0,%ut("CHK")=0,%ut("NENT")=0,%ut("ERRN")=0
"RTN","ut",70,0)
;
"RTN","ut",71,0)
; -- GET LIST OF ROUTINES --