SASUnit Examples  Version 1.5.0
_reporttreehtml.sas
Go to the documentation of this file.
1 
33 %MACRO _reportTreeHTML (i_repdata =
34  ,o_html = 0
35  );
36 
37 %LOCAL l_title;
38 %LOCAL d_tree d_tree1 d_tree2 d_la i;
39 
40 %LET l_title = &g_project | SASUnit;
41 
42 %_tempFilename(d_tree)
43 %_tempFilename(d_tree1)
44 %_tempFilename(d_tree2)
45 %_tempFilename(d_la)
46 
47 /*-- generate tree structure 1 for test scenarios ----------------------------*/
48 DATA &d_tree1 (KEEP=label popup target lvl term lst1-lst5 rc);
49  LENGTH label popup target $255 lvl term lst1-lst5 8;
50  RETAIN lst1-lst5 0;
51  SET &i_repdata;
52  BY scn_id cas_id tst_id;
53 
54  tst_type=tranwrd(tst_type,"^_","");
55  tst_desc=tranwrd(tst_desc,"^_","");
56 
57  IF _n_=1 THEN DO;
58  label = "&g_nls_reportTree_001";
59  popup = "&g_nls_reportTree_002";
60  target = "scn_overview.html";
61  lvl = 1;
62  term = 0;
63  lst1 = 0;
64  lst2 = 0;
65  lst3 = 0;
66  lst4 = 0;
67  OUTPUT;
68  END;
69 
70  IF first.scn_id THEN DO;
71  label = scn_path;
72  popup = "&g_nls_reportTree_003 " !! put(scn_id,z3.) !! ': 
' !! scn_desc;
73  target = "cas_overview.html#SCN" !! put(scn_id,z3.) !! "_";
74  lvl = 2;
75  term = 0;
76  lst2 = scn_last;
77  lst3 = 0;
78  lst4 = 0;
79  rc = scn_res;
80  OUTPUT;
81  END;
82 
83  IF first.cas_id THEN DO;
84  label = put(cas_id,z3.);
85  popup = "&g_nls_reportTree_004 " !! put (cas_id,z3.) !! ': 
' !! cas_desc;
86  target = 'cas_' !! put(scn_id,z3.) !! "_" !! put (cas_id,z3.) !! ".html";
87  lvl = 3;
88  term = 0;
89  lst3 = cas_last;
90  lst4 = 0;
91  rc = cas_res;
92  OUTPUT;
93  END;
94 
95  label = put (tst_id, z3.) !! ' (' !! trim(tst_type) !! ')';
96  popup = "&g_nls_reportTree_005 " !! put (tst_id,z3.) !! ': 
' !! tst_desc;
97  target = 'cas_' !! put(scn_id,z3.) !! "_" !! put (cas_id,z3.) !! ".html#TST" !! put (tst_id,z3.);
98  lvl = 4;
99  term = 1;
100  lst4 = last.cas_id;
101  rc = tst_res;
102  OUTPUT;
103 
104 RUN;
105 
106 /*-- generate tree structure 2 for units under test --------------------------*/
107 DATA &d_tree2 (KEEP=label popup target lvl term lst1-lst5 rc);
108  LENGTH label popup target $255 lvl term lst1-lst5 8;
109  RETAIN lst1-lst5 0;
110  SET &i_repdata;
111  BY cas_auton pgm_id scn_id cas_id tst_id;
112 
113  tst_type=tranwrd(tst_type,"^_","");
114  tst_desc=tranwrd(tst_desc,"^_","");
115  cas_pgm =tranwrd(cas_pgm,"^_","");
116 
117  IF _n_=1 THEN DO;
118  label = "&g_nls_reportTree_006";
119  popup = "&g_nls_reportTree_007";
120  target = "auton_overview.html";
121  lvl = 1;
122  term = 0;
123  lst1 = 1;
124  lst2 = 0;
125  lst3 = 0;
126  lst4 = 0;
127  lst5 = 0;
128  OUTPUT;
129  END;
130 
131  IF first.cas_auton THEN DO;
132  SELECT (cas_auton);
133  WHEN (0) label = tsu_sasunit;
134  WHEN (1) label = tsu_sasunit_os;
135  WHEN (2) label = tsu_sasautos;
136 %DO i=1 %TO 9;
137  WHEN (&i+2) label = tsu_sasautos&i;
138 %END;
139  OTHERWISE label="&g_nls_reportAuton_015";
140  END;
141  IF cas_auton=0 THEN
142  popup = "&g_nls_reportTree_009 sasunit:" !! '
' !! label;
143  ELSE IF cas_auton=1 THEN
144  popup = "&g_nls_reportTree_009 os_specific sasunit:" !! '
' !! label;
145  ELSE IF cas_auton=2 THEN
146  popup = "&g_nls_reportTree_009 sasautos:" !! '
' !! label;
147  ELSE IF cas_auton>2 THEN
148  popup = "&g_nls_reportTree_009 sasautos" !! left(put(cas_auton-2,1.)) !! ':
' !! label;
149  ELSE
150  popup = "&g_nls_reportTree_010";
151  target = "auton_overview.html#AUTON";
152  IF cas_auton NE . THEN target = trim(target) !! put(cas_auton,z3.);
153  target = trim(target) !! '_';
154  lvl = 2;
155  term = 0;
156  lst2 = auton_last;
157  lst3 = 0;
158  lst4 = 0;
159  lst5 = 0;
160  OUTPUT;
161  END;
162 
163  IF first.pgm_id THEN DO;
164  label = cas_pgm;
165  SELECT (cas_auton);
166  WHEN (0) popup = trim(tsu_sasunit) !! '/' !! cas_pgm;
167  WHEN (1) popup = trim(tsu_sasunit_os) !! '/' !! cas_pgm;
168  WHEN (2) popup = trim(tsu_sasautos) !! '/' !! cas_pgm;
169 %DO i=1 %TO 9;
170  WHEN (&i+2) popup = trim(tsu_sasautos&i) !! '/' !! cas_pgm;
171 %END;
172  OTHERWISE popup=cas_pgm;
173  END;
174  popup = "&g_nls_reportTree_011: " !! '
' !! popup;
175  target = "auton_overview.html#AUTON";
176  IF cas_auton NE . THEN target = trim(target) !! put(cas_auton,z3.);
177  target = trim(target) !! '_' !! put(pgm_id,z3.) !! "_";
178  lvl = 3;
179  term = 0;
180  lst3 = pgm_last;
181  lst4 = 0;
182  lst5 = 0;
183  rc = pgm_res;
184  OUTPUT;
185  END;
186 
187  IF first.cas_id THEN DO;
188  label = put(scn_id,z3.) !! "_" !! put(cas_id,z3.);
189  popup = "&g_nls_reportTree_012 " !! put(scn_id,z3.) !! ", &g_nls_reportTree_013 " !! put (cas_id,z3.) !! ': 
' !! cas_desc;
190  target = 'cas_' !! put(scn_id,z3.) !! "_" !! put (cas_id,z3.) !! ".html";
191  lvl = 4;
192  term = 0;
193  lst4 = pcs_last;
194  lst5 = 0;
195  rc = cas_res;
196  OUTPUT;
197  END;
198 
199  label = put (tst_id, z3.) !! ' (' !! trim(tst_type) !! ')';
200  popup = "&g_nls_reportTree_014 " !! put (tst_id,z3.) !! '
' !! tst_desc;
201  target = 'cas_' !! put(scn_id,z3.) !! "_" !! put (cas_id,z3.) !! ".html#TST" !! put (tst_id,z3.);
202  lvl = 5;
203  term = 1;
204  lst5 = last.cas_id;
205  rc = tst_res;
206  OUTPUT;
207 
208 RUN;
209 
210 /*-- Lookahead für Level -----------------------------------------------------*/
211 DATA &d_tree &d_la(KEEP=lvl RENAME=(lvl=nextlvl));
212  SET &d_tree1 &d_tree2 END=eof;
213  OUTPUT &d_tree;
214  IF _n_>1 THEN OUTPUT &d_la;
215  IF eof THEN DO;
216  lvl=1;
217  OUTPUT &d_la;
218  END;
219 RUN;
220 
221 DATA &d_tree;
222  MERGE &d_tree &d_la;
223 RUN;
224 
225 /*-- generate HTML and javascript code ---------------------------------------*/
226 DATA _null_;
227  SET &d_tree END=eof;
228  FILE "&o_html" LRECL=1024 encoding="&g_rep_encoding.";
229  length class_suffix $20;
230 
231  IF _n_=1 THEN DO;
232  %_reportHeaderHTML(&l_title)
233  PUT "<a href=""overview.html"" title=""&g_nls_reportTree_015 &g_project"" target=""basefrm"" class=""hms-treeview"">&g_project.</a>";
234  PUT "<ol class=""hms-treeview"">";
235  END;
236 
237  if (not missing (rc)) then do;
238  class_suffix = scan (put (rc, PictNameHTML.), 1, '.');
239  end;
240  if (term) then do;
241  PUT "<li>" @;
242  PUT "<label class=""file" class_suffix +(-1) """><a href=""" target +(-1) """ title=""" popup +(-1) """ target=""basefrm"">" label +(-1) "</a></label>" @;
243  PUT "</li>";
244  end;
245  else do;
246  PUT "<li>";
247  PUT "<input type=""checkbox"" id=""folder" _N_ z8. """/><label class=""node" class_suffix +(-1) """ for=""folder" _N_ z8. """><a href=""" target +(-1) """ title=""" popup +(-1) """ target=""basefrm"">" label +(-1) "</a></label>";
248  end;
249  if (lvl < nextlvl) then do;
250  PUT "<ol>";
251  end;
252  DO i=nextlvl+1 TO lvl;
253  PUT "</ol>";
254  PUT "</li>";
255  END;
256 
257  IF eof THEN DO;
258  PUT '</ol></body></html>';
259  END;
260 RUN;
261 
262 PROC DATASETS NOLIST NOWARN LIB=work;
263  DELETE %scan(&d_tree,1,.) %scan(&d_tree1,1,.) %scan(&d_tree2,1,.) %scan(&d_la,1,.);
264 QUIT;
265 
266 %MEND _reportTreeHTML;