42 %MACRO assertLibrary (i_actual       = _NONE_
 
   44                      ,i_desc         = Compare libraries
 
   45                      ,i_libraryCheck = STRICT
 
   46                      ,i_compareCheck = STRICT
 
   49                      ,i_ExcludeList  = _NONE_
 
   54    %IF &g_inTestcase EQ 1 %THEN %DO;
 
   57    %ELSE %IF &g_inTestcase NE 2 %THEN %DO;
 
   58       %PUT &g_error.(SASUNIT): assert must be called after initTestcase;
 
   62    %LOCAL l_casid l_tstid ;
 
   63    %_getScenarioTestId (i_scnid=&g_scnid, r_casid=l_casid, r_tstid=l_tstid);
 
   65    %local l_actual_ok l_expected_ok l_result l_path_actual l_path_expected _sysinfo l_col_names l_id_col l_counter l_id l_rc l_errMsg;
 
   68    %*************************************************************;
 
   69    %*** Check preconditions                                   ***;
 
   70    %*************************************************************;
 
   72    %*** check 
for valid actual libref ***;
 
   73    %let l_actual_ok=%sysfunc (libref (&i_actual.));
 
   74    %
if (&l_actual_ok. > 0) %then %
do;
 
   76        %let l_errMsg=Libref i_actual (&i_actual.) is invalid!;
 
   80    %*** check for valid expected libref ***;
 
   81    %let l_expected_ok=%sysfunc (libref (&i_expected.));
 
   82    %if (&l_expected_ok. > 0) %then %do;
 
   84        %let l_errMsg=Libref i_expected (&i_expected.) is invalid!;
 
   88    %*** check for equal librefs ***;
 
   89    %if (&i_actual. = &i_expected.) %then  %do;
 
   91        %let l_errMsg=Librefs are identical!;
 
   95    %*** check for identical paths ***;
 
   96    %let l_path_actual = %sysfunc (pathname (&i_actual.));
 
   97    %let l_path_expected = %sysfunc (pathname (&i_expected.));
 
   98    %if ("&l_path_actual."  = "&l_path_expected.") %then %do;
 
  100        %let l_errMsg=Paths of librefs are identical!;
 
  104    %*** Check valid values for i_LibraryCheck ***;
 
  105    %let i_LibraryCheck = %upcase (%trim(&i_LibraryCheck.));
 
  106    %if (&i_LibraryCheck. ne STRICT AND &i_LibraryCheck. ne MORETABLES) %then %do;
 
  108        %let l_errMsg=Value of i_LibraryCheck (%trim(&i_LibraryCheck.)) is invalid!;
 
  112    %*** Check valid values for i_CompareCheck ***;
 
  113    %let i_CompareCheck = %upcase (%trim(&i_CompareCheck.));
 
  114    %if (&i_CompareCheck. ne STRICT AND &i_CompareCheck. ne MORECOLUMNS 
 
  115         AND &i_CompareCheck. ne MOREOBS AND &i_CompareCheck. ne MORECOLSNOBS) %then %do;
 
  117        %let l_errMsg=Value of i_CompareCheck (%trim(&i_CompareCheck.)) is invalid!;
 
  121    %let i_ExcludeList = %upcase (%trim(&i_ExcludeList.));
 
  122    %let l_errMsg=Differences between datasets in the libraries! Please check SASUnit documentation for details.;
 
  124    %*************************************************************;
 
  125    %*** start tests                                           ***;
 
  126    %*************************************************************;
 
  127    %_assertLibrary (i_actual      =&i_actual.
 
  128                    ,i_expected    =&i_expected.
 
  129                    ,i_ExcludeList =&i_Excludelist.
 
  130                    ,i_CompareCheck=&i_CompareCheck.
 
  131                    ,i_LibraryCheck=&i_LibraryCheck.
 
  138    *** update result in test database ***;
 
  139    %_asserts(i_type     = assertLibrary
 
  140             ,i_expected = &i_expected.
 
  141             ,i_actual   = &i_actual.
 
  144             ,i_errMsg   = &l_errMsg.