BDE 4.14.0 Production release
|
Macros | |
#define | BSLS_PRECONDITIONS_BEGIN_IMP() |
#define | BSLS_PRECONDITIONS_END_IMP() |
#define | BSLS_PRECONDITIONS_BEGIN() do {} while(false) |
#define | BSLS_PRECONDITIONS_END() do {} while(false) |
Provide macros for use in fuzz testing narrow contract functions.
This component provides macros, BSLS_PRECONDITIONS_BEGIN
and BSLS_PRECONDITIONS_END
, to facilitate fuzz testing narrow contract functions. When fuzz testing is not enabled, the macros expand to nothing. When fuzz testing is enabled, the macros invoke a dynamic handler function via bsls::PreconditionsHandler
.
BSLS_PRECONDITIONS_BEGIN
is used as a marker to identify where precondition checks are begun, while BSLS_PRECONDITIONS_END
is used as a marker to identify where precondition checks are complete. These macros should always be used as a pair, and always at the very beginning of a function, surrounding the function preconditions.
Since the macros contained in this component are intended to be used in conjunction with the macros defined in bsls_fuzztest , this test driver contains only the simplest USAGE EXAMPLE. See the USAGE EXAMPLE in bsls_fuzztest for a fuller treatment.
The following example shows the use of BSLS_PRECONDITIONS_BEGIN
and BSLS_PRECONDITIONS_END
in the definition of a narrow contract function. These macros are to be placed around the function precondition checks, immediately before and after.
In a fuzz-enabled build, we would invoke this function inside the fuzz loop with BSLS_FUZZTEST_EVALUATE
.
#define BSLS_PRECONDITIONS_BEGIN | ( | ) | do {} while(false) |
#define BSLS_PRECONDITIONS_BEGIN_IMP | ( | ) |
#define BSLS_PRECONDITIONS_END | ( | ) | do {} while(false) |
#define BSLS_PRECONDITIONS_END_IMP | ( | ) |