assertreport.sas

Go to the documentation of this file.
00001  
00028 /* 
00029    30.06.2008 AM  - kleine Dokumentationsänderung
00030    15.02.2008 AM  - kleine Dokumentationsänderung
00031    06.02.2008 AM  - umbenannt nach assertReport
00032                   - Parameter i_manual hinzugefügt, um auch eine Reine Prüfung auf 
00033                     existierendes File (mit grünem Symbol) durchführen zu können
00034                   - Prüfung auf neueres File hinzugefügt
00035                     Unterstrich vor den Dateinamen der kopierten Reports hinzugefügt, 
00036                     damit auch SAS-Dateien korrekt gehandhabt werden
00037 */
00038 
00039 %MACRO assertReport (
00040     i_expected =       
00041    ,i_actual   =       
00042    ,i_desc     =       
00043    ,i_manual   = 1
00044 );
00045 
00046 /*-- enforce sequence of calls ----- -----------------------------------------*/
00047 %GLOBAL g_inTestcase;
00048 %IF &g_inTestcase EQ 1 %THEN %DO;
00049    %endTestcall;
00050 %END;
00051 %ELSE %IF &g_inTestcase NE 2 %THEN %DO;
00052    %PUT &g_error: assert must be called after initTestcase;
00053    %RETURN;
00054 %END;
00055 
00056 /*-- check for existence and check change date -------------------------------*/
00057 %LOCAL l_rep_ext l_result;
00058 %LET l_result=1;
00059 %IF "&i_actual" NE "" %THEN %DO;
00060    %local d_dir;
00061    %_sasunit_tempFileName(d_dir)
00062    %_sasunit_dir(i_path=&i_actual, o_out=&d_dir)
00063 data _null_;
00064    set &d_dir nobs=nobs;
00065    if nobs ne 1 then stop;
00066    if changed < dhms (today(), hour (input ("&systime",time5.)), minute (input ("&systime",time5.)), 0) then stop;
00067    call symput ('l_result', '2');
00068    stop;
00069 run;
00070 proc sql;
00071    drop table &d_dir;
00072 quit;
00073    %IF %sysfunc(fileexist(&i_actual)) %THEN %LET l_rep_ext = %_sasunit_getExtension(&i_actual);
00074 %END;
00075 
00076 %IF NOT &i_manual AND &l_result=2 %THEN %LET l_result=0;
00077 
00078 %LOCAL l_expected l_exp_ext;
00079 %LET l_expected = %_sasunit_abspath(&g_refdata,&i_expected);
00080 %IF "&l_expected" NE "" %THEN %DO;
00081    %IF %sysfunc(fileexist(&l_expected)) %THEN %DO;
00082       %LET l_exp_ext = %_sasunit_getExtension(&l_expected);
00083    %END;
00084 %END;
00085 
00086 %LOCAL l_casid l_tstid;
00087 %_sasunit_asserts(
00088     i_type     = assertReport
00089    ,i_expected = &l_exp_ext
00090    ,i_actual   = &l_rep_ext
00091    ,i_desc     = &i_desc
00092    ,i_result   = &l_result
00093    ,r_casid    = l_casid
00094    ,r_tstid    = l_tstid
00095 )
00096 
00097 /* copy actual report if it exists */
00098 %IF &l_rep_ext NE %THEN %DO;
00099    %_sasunit_copyFile(&i_actual, &g_testout/_%substr(00&g_scnid,%length(&g_scnid))_&l_casid._&l_tstid._man_act&l_rep_ext);
00100 %END;
00101 
00102 /* copy expected report if it exists  */
00103 %IF &l_exp_ext NE %THEN %DO;
00104    %_sasunit_copyFile(&l_expected, &g_testout/_%substr(00&g_scnid,%length(&g_scnid))_&l_casid._&l_tstid._man_exp&l_exp_ext);
00105 %END;
00106 
00107 %MEND assertReport;

Generated on Sun Oct 10 14:10:15 2010 for SASUnit Examples by  doxygen 1.5.3