No external data is used. The script works with global macro variables defined and manipulated directly within the code to simulate and verify the status of symbols (error, warning, note).
1 Code Block
Macro Declarations and Initializations Data
Explanation : This block initializes the test scenario and declares the global macro variables `g_my_error`, `g_my_warning`, and `g_my_note`. These variables are then initialized to `_NONE_` before the call to the tested macro, to ensure a known starting state.
Explanation : The test case is defined and the `_detectSymbols` macro is called. The previously declared global macro variables are passed by reference (`r_error_symbol`, `r_warning_symbol`, `r_note_symbol`), allowing `_detectSymbols` to modify their values according to its internal logic. `%endTestcall` marks the end of the tested code execution.
Copied!
%initTestcase(i_object=_detectSymbols.sas, i_desc=Test with correct call);
%_detectSymbols(r_error_symbol=g_my_error, r_warning_symbol=g_my_warning, r_note_symbol=g_my_note);
%endTestcall;
1
%initTestcase(i_object=_detectSymbols.sas, i_desc=Test with correct call);
Explanation : Three `%assertEquals` assertions are used to verify that the `_detectSymbols` macro has correctly updated the global macro variables. It is expected that `g_my_error` contains 'ERROR', `g_my_warning` contains 'WARNING', and `g_my_note` contains 'NOTE'. `%endTestcase` closes the individual test case.
Copied!
%assertEquals (i_actual = &g_my_error.
,i_expected = ERROR
,i_desc = ERROR-Symbol is set properly
);
%assertEquals (i_actual = &g_my_warning.
,i_expected = WARNING
,i_desc = WARNING-Symbol is set properly
);
%assertEquals (i_actual = &g_my_note.
,i_expected = NOTE
,i_desc = NOTE-Symbol is set properly
);
%endTestcase;
1
%assertEquals (i_actual = &g_my_error.
2
,i_expected = ERROR
3
,i_desc = ERROR-Symbol is SET properly
4
);
5
6
%assertEquals (i_actual = &g_my_warning.
7
,i_expected = WARNING
8
,i_desc = WARNING-Symbol is SET properly
9
);
10
%assertEquals (i_actual = &g_my_note.
11
,i_expected = NOTE
12
,i_desc = NOTE-Symbol is SET properly
13
);
14
%endTestcase;
4 Code Block
SASUnit Scenario End
Explanation : This block marks the end of the global test scenario defined by `%initScenario`. It is a standard closing command of the SASUnit framework.
Copied!
%endScenario();
1
%endScenario();
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.
Copyright Info : Copyright 2010-2023 HMS Analytical Software GmbH, http://www.analytical-software.de. This file is part of SASUnit, the unit testing framework for SAS(R) programs. For copyright information and terms of use under the GNU Lesser General Public License, see the included README.md file or https://github.com/HMS-Analytical-Software/SASUnit/wiki/readme/.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.