Published on :
Macro CREATION_INTERNE

Unit test for the mf_wordsinstr1andstr2 macro

This code is also available in: Deutsch Español Français
Awaiting validation
This program tests the 'mf_wordsinstr1andstr2' macro, which identifies words present in a first string that are also found in a second. The result is stored in a macro variable, then validated via the 'mp_assert' assertion macro which generates a results table in the WORK library.
Data Analysis

Type : CREATION_INTERNE


No external data is read. Inputs are static character strings defined in the code. The output table 'work.test_results' is created by the test macro.

1 Code Block
MACRO CALL
Explanation :
Call to the macro function 'mf_wordsinstr1andstr2' to identify common words between the two strings provided as parameters. The result is stored in the macro variable &x.
Copied!
1%let x=%mf_wordsinstr1andstr2(str1=xx DOLLAR x $CHAR xxx W MONNAME
2,str2=DOLLAR $CHAR W MONNAME xxxxxx
3);
4 
2 Code Block
MACRO CALL Data
Explanation :
Use of the 'mp_assert' macro to verify that the &x variable contains the expected string ('DOLLAR $CHAR W MONNAME'). The test result is recorded in 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.