![]() |
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
The entities defined in this section are targeted to help development and testing instead of representing usual classes embedded in your application.
ELM provides a small macro found in <elm/deprecated.h>, called DEPRECATED.
When put at the start of a function body, it displays a warning deprecation message the first time it is called.
ELM provides several helper method for using the different classes. They are prefixed by a double underscore and all only compiled if a matching define is not provided.
__size(): gives the full size of the data structure (removed if NSIZE is defined) __print(): display an internal representation of the class (removed if NDEBUG is defined)This module provides a poor, but existing, solution to unit testing in C++. It provides macros and classes to perform statistics on unit testing and makes automatic some test procedures.
The example show how the module works:
The test must be enclosed in CHECK_BEGIN / CHECK_END pair and the test case name must be given. Then the test are performed ending with a call to a macro allowing to test and record result of the test.
The existing macro are:
CHECK(x) – check if x is true CHECK_EQUAL(result, expected) – test equality and, if it fails, display the failed result value CHECK_EXCEPTION(exception, action) – perform the action and the test fails if the exception is not thrown FAIL_ON_EXCEPTION(exception, action) – perform the action and the test fails if the exception is thrownThere are also some useful macros as:
REQUIRE(cnd, action) – perform the action only if the given condition is true, else stop the test.