Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mp_assert.test.2.sas
Go to the documentation of this file.
1/**
2
3 @file
4 @brief Testing mp_assert macro
5 @details Covers the failure path - mp_assert.test.sas only exercises a
6 condition that is true. The false condition is recorded against a separate
7 results dataset so the suite does not count it as a failure; what is under
8 test is that FAIL is written for it.
9
10 <h4> SAS Macros </h4>
11 @li mp_assert.sas
12
13**/
14
15%mp_assert(iftrue=(1=0),
16 desc=Checking a false condition records FAIL,
17 outds=work.neg_results
18)
19
20%mp_assert(iftrue=(1=1),
21 desc=Checking a true condition records PASS,
22 outds=work.neg_results
23)
24
25proc sql noprint;
26 select count(*) into: nfail from work.neg_results
27 where test_result='FAIL';
28 select count(*) into: npass from work.neg_results
29 where test_result='PASS';
30quit;
31
32%mp_assert(iftrue=(&nfail=1),
33 desc=Checking the false condition recorded exactly one FAIL)
34
35%mp_assert(iftrue=(&npass=1),
36 desc=Checking the true condition recorded exactly one PASS)