std.unittest.testmacro Package
Function Description
unittest.testmacro provides macros for the unit test framework.
API List
Macro
| Name | Description |
|---|---|
| AfterAll | Declares 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. |
| AfterEach | Declares 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. |
| Assert | Declares an assertion. This macro is used in test functions. If the assertion fails, the test case stops. |
| AssertThrows | Declares an expected exception assertion. This macro is used in test functions. If the assertion fails, the test case stops. |
| BeforeAll | Declares 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. |
| BeforeEach | Declares 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. |
| Bench | Labels a function to be executed for multiple times and calculates the scheduled execution time of the function. |
| Configure | Provides configuration parameters for test classes or test functions. It can be placed on a test class or test function. |
| Expect | Declares an Expect assertion. This macro is used in test functions. If the assertion fails, the test case stops. |
| ExpectThrows | Declares an expected exception assertion. This macro is used in test functions. If the assertion fails, the test case still proceeds. |
| Fail | Declares an expected failure assertion. This macro is used in test functions. If the assertion fails, the test case stops. |
| FailExpect | Declares an expected failure assertion. This macro is used in test functions. If the assertion fails, the test case still proceeds. |
| Parallel | Modifies test classes. Test cases in the test class modified by @Parallel can be executed in parallel. |
| PowerAssert | Checks whether a passed expression is true and displays a detailed chart containing the intermediate values and exceptions of the passed expression. |
| Skip | Modifies a function that has been modified by @TestCase/@Bench so that the test case is skipped. |
| Strategy | Combines, maps, and reuses various data policies. |
| Test | Applies to top-level functions or classes so that they are converted into unit test classes. |
| TestBuilder | Declares a dynamic test suite. |
| TestCase | Labels functions in a unit test class so that these functions become test cases of the unit test. |
| Timeout | Indicates 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. |
| Types | Provides type parameters for test classes or test functions. It can be placed on a test class or test function. |