Published on :
Test CREATION_INTERNE

Test of the mf_verifymacvars macro

This code is also available in: Deutsch Español Français
Awaiting validation
This script aims to validate that the macro function 'mf_verifymacvars' correctly detects the existence of specified macro variables. It uses the 'mp_assertscope' macro to monitor variable scope (potential leaks) and 'mp_assert' to execute the logical test and store the result.
Data Analysis

Type : CREATION_INTERNE


The script does not use any external data. It defines macro variables (%let) for the test and generates an internal results table (work.test_results).

1 Code Block
MACRO ASSIGNMENT
Explanation :
Initialization of macro variables 'var1' and 'var2' which will serve as test cases.
Copied!
1%let var1=x;
2%let var2=y;
2 Code Block
MACRO CALL
Explanation :
Taking a snapshot of the macro variable environment before test execution to verify code cleanliness later.
Copied!
1%mp_assertscope(SNAPSHOT)
3 Code Block
MACRO CALL Data
Explanation :
Call to the 'mp_assert' assertion macro. It checks the condition (if 'mf_verifymacvars' returns 1 for the created variables) and records the test result in the 'work.test_results' table.
Copied!
1%mp_assert(
2 iftrue=(%mf_verifymacvars(var1 var2)=1),
3 desc=Checking macvars exist,
4 outds=work.test_results
5)
4 Code Block
MACRO CALL
Explanation :
Comparison of the current state of macro variables with the initial snapshot to ensure that no variables have been inadvertently created or modified (scope check).
Copied!
1%mp_assertscope(COMPARE)
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.