std.unittest.testmacro Package

Function Description

unittest.testmacro provides macros for the unit test framework.

API List

Macro

NameDescription
AfterAllDeclares that the function in a test class is a test life cycle function. The function modified by this macro runs once after all test cases are completed.
AfterEachDeclares that the function in a test class is a test life cycle function. The function modified by this macro runs once after each test case is completed.
AssertDeclares an assertion. This macro is used in test functions. If the assertion fails, the test case stops.
AssertThrowsDeclares an expected exception assertion. This macro is used in test functions. If the assertion fails, the test case stops.
BeforeAllDeclares that the function in a test class is a test life cycle function. The function modified by this macro runs once before all test cases are completed.
BeforeEachDeclares that the function in a test class is a test life cycle function. The function modified by this macro runs once before each test case is completed.
BenchLabels a function to be executed for multiple times and calculates the scheduled execution time of the function.
ConfigureProvides configuration parameters for test classes or test functions. It can be placed on a test class or test function.
ExpectDeclares an Expect assertion. This macro is used in test functions. If the assertion fails, the test case stops.
ExpectThrowsDeclares an expected exception assertion. This macro is used in test functions. If the assertion fails, the test case still proceeds.
FailDeclares an expected failure assertion. This macro is used in test functions. If the assertion fails, the test case stops.
FailExpectDeclares an expected failure assertion. This macro is used in test functions. If the assertion fails, the test case still proceeds.
ParallelModifies test classes. Test cases in the test class modified by @Parallel can be executed in parallel.
PowerAssertChecks whether a passed expression is true and displays a detailed chart containing the intermediate values and exceptions of the passed expression.
SkipModifies a function that has been modified by @TestCase/@Bench so that the test case is skipped.
StrategyCombines, maps, and reuses various data policies.
TestApplies to top-level functions or classes so that they are converted into unit test classes.
TestBuilderDeclares a dynamic test suite.
TestCaseLabels functions in a unit test class so that these functions become test cases of the unit test.
TimeoutIndicates that a test should be stopped after a specified period of time. It helps test complex algorithms that may run for a long time or enter an infinite loop.
TypesProvides type parameters for test classes or test functions. It can be placed on a test class or test function.