Published on :
Macro CREATION_INTERNE

Unit test for the mf_wordsinstr1butnotstr2 macro

This code is also available in: Deutsch Español Français
Awaiting validation
This script tests the `mf_wordsinstr1butnotstr2` macro, which identifies words present in a first string but absent from a second. The result is stored in a macro variable, then validated by the `%mp_assert` assertion macro which generates a test results table.
Data Analysis

Type : CREATION_INTERNE


The processed data are literal character strings passed as parameters. Test results are stored in the temporary table 'work.test_results'.

1 Code Block
MACRO CALL
Explanation :
Execution of the functional macro to extract words from list 'str1' that are not in list 'str2'. The result is assigned to the macro-variable 'x'.
Copied!
1%let x=%mf_wordsinstr1butnotstr2(str1=xx DOLLAR x $CHAR xxx W MONNAME
2,str2=ff xx x xxx xxxxxx
3);
4 
2 Code Block
MACRO CALL Data
Explanation :
Validation of the result using the `%mp_assert` macro. It compares the value of the macro-variable `&x` to the expected string ('DOLLAR $CHAR W MONNAME') and writes the test result to the 'work.test_results' table.
Copied!
1%mp_assert(
2 iftrue=(
3 "&x"="DOLLAR $CHAR W MONNAME"
4 ),
5 desc=Checking basic string,
6 outds=work.test_results
7)
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.