Skip to content

Instantly share code, notes, and snippets.

@nicolashohm
Last active October 28, 2023 14:22
Show Gist options
  • Save nicolashohm/620ed5e3079b26b6d24c67cf4aefed99 to your computer and use it in GitHub Desktop.
Save nicolashohm/620ed5e3079b26b6d24c67cf4aefed99 to your computer and use it in GitHub Desktop.
Assert methods like they exist in test frameworks for SAS
%macro assertEquals(expected, actual, message);
%if &expected ne &actual %then %do;
%put ERROR: Failed asserting that &actual is equal to &expected - &message;
%end;
%mend;
* Asserts that the value returned by the query in actual is equals to the expectation;
%macro assertSqlEquals(expected, query, message);
proc sql noprint;
&query;
quit;
%assertEquals(&expected, &actual);
%mend;
@nicolashohm
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment