Published on :
Test NONE

SASUnit Assertion Test

This code is also available in: Deutsch Español Français
The main script consists of two statements: a %put statement to display a simple message in the SAS© log, and a call to the %mp_assert macro. This macro, from the SASUnit unit testing framework, is used to verify logical conditions. Here, it evaluates whether the expression '1=1' is true, which is always the case, and records the test result with a specified description. This code demonstrates the use of an assertion for a unit test and provides simple visual feedback via the SAS© log.
Data Analysis

Type : NONE


The script is a unit test that does not manipulate data in the traditional sense. It evaluates an internal logical condition (`1=1`) without interacting with external or specifically created datasets.

1 Code Block
SAS Statement
Explanation :
This SAS statement displays the string 'this is a test' in the SAS log. It is commonly used for debugging, marking execution steps, or providing information to the user during program execution.
Copied!
1%put this is a test;
2 Code Block
MACRO CALL
Explanation :
This `%mp_assert` macro call is a key feature of the SASUnit test framework. It is used to define and execute an assertion. The `iftrue=(1=1)` parameter specifies the condition to test, which is always true here. The `desc` parameter provides a textual description of the test, which is essential for the readability of unit test reports. Executing this macro will record a positive result for this assertion within the SASUnit context.
Copied!
1%mp_assert(
2 iftrue=(1=1),
3 desc=My Test Description. This will always Pass!
4)
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/.