SASUnit Examples  Version 1.2
_sasunit_asserts.sas
Go to the documentation of this file.
1 
24 /* change history
25  07.02.2008 AM Quoting für Texte verbessert, die doppelte Hochkommata enthalten
26 */
27 
28 
29 %MACRO _sasunit_asserts (
30  i_type =
31  ,i_expected =
32  ,i_actual =
33  ,i_desc =
34  ,i_result =
35  ,r_casid =
36  ,r_tstid =
37 );
38 
39 %IF &r_casid= %THEN %DO;
40  %LOCAL l_casid;
41  %LET r_casid=l_casid;
42 %END;
43 %IF &r_tstid= %THEN %DO;
44  %LOCAL l_tstid;
45  %LET r_tstid=l_tstid;
46 %END;
47 
48 PROC SQL NOPRINT;
49  /* determine number of test case */
50  SELECT max(cas_id) INTO :&r_casid FROM target.cas WHERE cas_scnid=&g_scnid;
51  %IF &&&r_casid=. %THEN %DO;
52  %PUT &g_error: _sasunit_asserts: Fehler beim Ermitteln der Testfall-Id;
53  %RETURN;
54  %END;
55  /* generate a new check number */
56  SELECT max(tst_id) INTO :&r_tstid
57  FROM target.tst
58  WHERE
59  tst_scnid = &g_scnid AND
60  tst_casid = &&&r_casid
61  ;
62  %IF &&&r_tstid=. %THEN %LET &r_tstid=1;
63  %ELSE %LET &r_tstid=%eval(&&&r_tstid+1);
64  INSERT INTO target.tst VALUES (
65  &g_scnid
66  ,&&&r_casid
67  ,&&&r_tstid
68  ,"&i_type"
69  ,%sysfunc(quote(&i_desc%str( )))
70  ,%sysfunc(quote(&i_expected%str( )))
71  ,%sysfunc(quote(&i_actual%str( )))
72  ,&i_result
73  );
74 QUIT;
75 
76 %PUT ========================== Check &&&r_casid...&&&r_tstid (&i_type) =====================================;
77 
78 %LET &r_casid = %sysfunc(putn(&&&r_casid,z3.));
79 %LET &r_tstid = %sysfunc(putn(&&&r_tstid,z3.));
80 
81 %MEND _sasunit_asserts;