32 %MACRO assertLogMsg (i_logmsg =
33 ,i_desc = Scan
for log messages
39 %IF &g_inTestcase EQ 1 %THEN %DO;
42 %ELSE %IF &g_inTestcase NE 2 %THEN %DO;
43 %PUT &g_error.(SASUNIT): assert must be called after initTestcase;
47 %LOCAL l_casid l_msg_found l_actual l_expected l_assert_failed;
50 SELECT max(cas_id) INTO :l_casid FROM target.cas WHERE cas_scnid = &g_scnid;
53 %IF &l_casid = . OR &l_casid = %THEN %DO;
54 %PUT &g_error.(SASUNIT): assert must not be called before initTestcase;
63 pattern_id = prxparse("/%upcase(&i_logmsg)/");
65 INFILE "&g_log/%sysfunc(putn(&g_scnid,z3.))_%sysfunc(putn(&l_casid,z3.)).log" END=eof TRUNCOVER;
66 INPUT logrec $char256.;
67 logrec = upcase(logrec);
68 IF prxmatch (pattern_id, logrec) THEN DO;
69 call symput ('l_msg_found', '1');
73 %IF &l_msg_found %THEN %DO;
81 %LET l_expected = 2&i_logmsg;
82 %LET l_assert_failed = %eval (&l_msg_found.*2);
85 %LET l_expected = 1&i_logmsg;
86 %LET l_assert_failed = %eval((NOT &l_msg_found)*2);
89 %_asserts(i_type = assertLogMsg
90 ,i_expected = %str(&l_expected)
91 ,i_actual = %str(&l_actual)
93 ,i_result = &l_assert_failed