Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mf_uid.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mf_uid macro
4
5 <h4> SAS Macros </h4>
6 @li mf_uid.sas
7 @li mp_assert.sas
8 @li mp_assertscope.sas
9
10**/
11
12%let today=%sysfunc(today(),yymmddn8.);
13
14%mp_assertscope(SNAPSHOT)
15%put scope check:%mf_uid();
16%mp_assertscope(COMPARE,
17 desc=Checking that mf_uid does not leak scope,
18 outds=work.test_results
19)
20
21%let uid1=%mf_uid();
22%let uid2=%mf_uid();
23
24%mp_assert(
25 iftrue=(%substr(&uid1,1,8)=&today),
26 desc=Checking that the uid starts with the yymmddn8 form of today,
27 outds=work.test_results
28)
29
30%mp_assert(
31 iftrue=(%sysfunc(countw(&uid1,_))=4),
32 desc=Checking that the uid has four underscore separated parts,
33 outds=work.test_results
34)
35
36%mp_assert(
37 iftrue=(%length(&uid1)>=20),
38 desc=Checking that the uid is long enough to carry a timestamp and a job id,
39 outds=work.test_results
40)
41
42%mp_assert(
43 iftrue=(&uid1 ne &uid2),
44 desc=Checking that two calls return different uids,
45 outds=work.test_results
46)