/**
  @file
  @brief Testing mpe_refreshtables macro

  <h4> SAS Macros </h4>
  @li mpe_refreshtables.sas
  @li mp_assert.sas
  @li mp_assertscope.sas

  @author 4GL Apps Ltd
  @copyright 4GL Apps Ltd.  This code may only be used within Data Controller
    and may not be re-distributed or re-sold without the express permission of
    4GL Apps Ltd.

**/

%mp_assertscope(SNAPSHOT)
%mpe_refreshtables(FMTONLY)
%mp_assertscope(COMPARE,
  desc=Checking macro variables against previous snapshot
)

/* make sure that the process picks up a library that contains only a single
  catalog */
proc sql;
create table work.libinfo as
  select a.engine,
    a.libname,
    a.paths,
    a.perms,
    a.owners,
    a.schemas,
    a.libid,
    b.libsize,
    b.table_cnt,
    b.catalog_cnt
  from &mpelib..mpe_datacatalog_libs(where=(&dc_dttmtfmt. lt tx_to)) a
  left join &mpelib..mpe_datastatus_libs(where=(&dc_dttmtfmt. lt tx_to)) b
  on a.libref=b.libref
  where a.libref="&libref";

%let test1=0;
data _null_;
  set work.libinfo;
  call symputx('test1',table_cnt);
run;
%mp_assert(
  iftrue=(&test1>0),
  desc=Checking fmtonly.dcfmts was picked up
)