|
#define | BSLIM_TESTUTIL_ASSERT(X) aSsErT(!(X), #X, __LINE__); |
|
#define | BSLIM_TESTUTIL_DEBUG_REP(X) BloombergLP::bslim::TestUtil::debugRep(X) |
|
#define | BSLIM_TESTUTIL_LOOP0_ASSERT BSLIM_TESTUTIL_ASSERT |
|
#define | BSLIM_TESTUTIL_LOOP_ASSERT(I, X) |
|
#define | BSLIM_TESTUTIL_LOOP1_ASSERT BSLIM_TESTUTIL_LOOP_ASSERT |
|
#define | BSLIM_TESTUTIL_LOOP2_ASSERT(I, J, X) |
|
#define | BSLIM_TESTUTIL_LOOP3_ASSERT(I, J, K, X) |
|
#define | BSLIM_TESTUTIL_LOOP4_ASSERT(I, J, K, L, X) |
|
#define | BSLIM_TESTUTIL_LOOP5_ASSERT(I, J, K, L, M, X) |
|
#define | BSLIM_TESTUTIL_LOOP6_ASSERT(I, J, K, L, M, N, X) |
|
#define | BSLIM_TESTUTIL_LOOP7_ASSERT(I, J, K, L, M, N, O, X) |
|
#define | BSLIM_TESTUTIL_LOOP8_ASSERT(I, J, K, L, M, N, O, V, X) |
|
#define | BSLIM_TESTUTIL_EXPAND(X) X |
|
#define | BSLIM_TESTUTIL_NUM_ARGS_IMPL(X8, X7, X6, X5, X4, X3, X2, X1, X0, N, ...) N |
|
#define | BSLIM_TESTUTIL_NUM_ARGS(...) |
|
#define | BSLIM_TESTUTIL_LOOPN_ASSERT_IMPL(N, ...) BSLIM_TESTUTIL_EXPAND(BSLIM_TESTUTIL_LOOP ## N ## _ASSERT(__VA_ARGS__)) |
|
#define | BSLIM_TESTUTIL_LOOPN_ASSERT(N, ...) BSLIM_TESTUTIL_LOOPN_ASSERT_IMPL(N, __VA_ARGS__) |
|
#define | BSLIM_TESTUTIL_ASSERTV(...) |
|
#define | BSLIM_TESTUTIL_Q(X) bsl::cout << "<| " #X " |>" << bsl::endl; |
| Quote identifier literally.
|
|
#define | BSLIM_TESTUTIL_P(X) bsl::cout << #X " = " << BSLIM_TESTUTIL_DEBUG_REP(X) << bsl::endl; |
| Print identifier and its value.
|
|
#define | BSLIM_TESTUTIL_P_(X) bsl::cout << #X " = " << BSLIM_TESTUTIL_DEBUG_REP(X) << ", " << bsl::flush; |
| P(X) without '
'
|
|
#define | BSLIM_TESTUTIL_L_ __LINE__ |
| current Line number
|
|
#define | BSLIM_TESTUTIL_T_ bsl::cout << "\t" << bsl::flush; |
| Print tab (w/o newline).
|
|
Outline
Purpose
Provide test utilities for components above bsl
.
Classes
Macros
- BSLIM_TESTUTIL_ASSERT(X): record and print error if
!X
- BSLIM_TESTUTIL_LOOP_ASSERT(I, X): print arguments if
!X
- BSLIM_TESTUTIL_LOOP2_ASSERT(I, J, X): print arguments if
!X
- BSLIM_TESTUTIL_LOOP3_ASSERT(I, J, K, X): print arguments if
!X
- BSLIM_TESTUTIL_LOOP4_ASSERT(I, J, K, L, X): print arguments if
!X
- BSLIM_TESTUTIL_LOOP5_ASSERT(I, J, K, L, M, X): print arguments if
!X
- BSLIM_TESTUTIL_LOOP6_ASSERT(I, J, K, L, M, N, X): print arguments if
!X
- BSLIM_TESTUTIL_LOOP7_ASSERT(I, J, K, L, M, N,O, X): print arguments if
!X
- BSLIM_TESTUTIL_LOOP8_ASSERT(I, J, K, L,M,N,O,V, X): print arguments if
!X
- BSLIM_TESTUTIL_ASSERTV(..., X): print generic arguments if
!X
- BSLIM_TESTUTIL_Q(X): quote identifier literally
- BSLIM_TESTUTIL_P(X): print identifier and value
- BSLIM_TESTUTIL_P_(X): print identifier and value without '
'
- BSLIM_TESTUTIL_L_: current line number
- BSLIM_TESTUTIL_T_: print tab without '
'
- See also
- bsls_bsltestutil
Description
This component provides the standard print macros used in BDE-style test drivers (ASSERT
, LOOP_ASSERT
, ASSERTV
, P
, Q
, L
, and T
) for components above the bsl
package group.
This component also defines a set of overloads for the insertion operator (<<
) to support the streaming of test types defined in the bsltf
package. These overloads are required for test drivers above the bsl
package group in order to print objects of the bsltf
types to bsl::cout
.
This component also defines a pair of methods, setFunc
and callFunc
, that allow a test driver to set and call a function by going through another compilation unit to preclude the optimizer from inlining the function call.
◆ BSLIM_TESTUTIL_ASSERT
#define BSLIM_TESTUTIL_ASSERT |
( |
|
X | ) |
aSsErT(!(X), #X, __LINE__); |
Usage
Example 1: Writing a Test Driver
◆ BSLIM_TESTUTIL_ASSERTV
#define BSLIM_TESTUTIL_ASSERTV |
( |
|
... | ) |
|
Value:
#define BSLIM_TESTUTIL_LOOPN_ASSERT(N,...)
Definition bslim_testutil.h:281
#define BSLIM_TESTUTIL_NUM_ARGS(...)
Definition bslim_testutil.h:274
◆ BSLIM_TESTUTIL_DEBUG_REP
#define BSLIM_TESTUTIL_DEBUG_REP |
( |
|
X | ) |
BloombergLP::bslim::TestUtil::debugRep(X) |
◆ BSLIM_TESTUTIL_EXPAND
#define BSLIM_TESTUTIL_EXPAND |
( |
|
X | ) |
X |
◆ BSLIM_TESTUTIL_L_
#define BSLIM_TESTUTIL_L_ __LINE__ |
◆ BSLIM_TESTUTIL_LOOP0_ASSERT
◆ BSLIM_TESTUTIL_LOOP1_ASSERT
◆ BSLIM_TESTUTIL_LOOP2_ASSERT
#define BSLIM_TESTUTIL_LOOP2_ASSERT |
( |
|
I, |
|
|
|
J, |
|
|
|
X |
|
) |
| |
Value:
aSsErT(1, #X, __LINE__); }
#define BSLIM_TESTUTIL_DEBUG_REP(X)
Definition bslim_testutil.h:195
◆ BSLIM_TESTUTIL_LOOP3_ASSERT
#define BSLIM_TESTUTIL_LOOP3_ASSERT |
( |
|
I, |
|
|
|
J, |
|
|
|
K, |
|
|
|
X |
|
) |
| |
Value:
aSsErT(1, #X, __LINE__); }
◆ BSLIM_TESTUTIL_LOOP4_ASSERT
#define BSLIM_TESTUTIL_LOOP4_ASSERT |
( |
|
I, |
|
|
|
J, |
|
|
|
K, |
|
|
|
L, |
|
|
|
X |
|
) |
| |
Value:
aSsErT(1, #X, __LINE__); }
◆ BSLIM_TESTUTIL_LOOP5_ASSERT
#define BSLIM_TESTUTIL_LOOP5_ASSERT |
( |
|
I, |
|
|
|
J, |
|
|
|
K, |
|
|
|
L, |
|
|
|
M, |
|
|
|
X |
|
) |
| |
Value:
aSsErT(1, #X, __LINE__); }
◆ BSLIM_TESTUTIL_LOOP6_ASSERT
#define BSLIM_TESTUTIL_LOOP6_ASSERT |
( |
|
I, |
|
|
|
J, |
|
|
|
K, |
|
|
|
L, |
|
|
|
M, |
|
|
|
N, |
|
|
|
X |
|
) |
| |
Value:
aSsErT(1, #X, __LINE__); }
◆ BSLIM_TESTUTIL_LOOP7_ASSERT
#define BSLIM_TESTUTIL_LOOP7_ASSERT |
( |
|
I, |
|
|
|
J, |
|
|
|
K, |
|
|
|
L, |
|
|
|
M, |
|
|
|
N, |
|
|
|
O, |
|
|
|
X |
|
) |
| |
Value:
aSsErT(1, #X, __LINE__); }
◆ BSLIM_TESTUTIL_LOOP8_ASSERT
#define BSLIM_TESTUTIL_LOOP8_ASSERT |
( |
|
I, |
|
|
|
J, |
|
|
|
K, |
|
|
|
L, |
|
|
|
M, |
|
|
|
N, |
|
|
|
O, |
|
|
|
V, |
|
|
|
X |
|
) |
| |
Value:
aSsErT(1, #X, __LINE__); }
◆ BSLIM_TESTUTIL_LOOP_ASSERT
#define BSLIM_TESTUTIL_LOOP_ASSERT |
( |
|
I, |
|
|
|
X |
|
) |
| |
Value:
aSsErT(1, #X, __LINE__); }
◆ BSLIM_TESTUTIL_LOOPN_ASSERT
◆ BSLIM_TESTUTIL_LOOPN_ASSERT_IMPL
#define BSLIM_TESTUTIL_LOOPN_ASSERT_IMPL |
( |
|
N, |
|
|
|
... |
|
) |
| BSLIM_TESTUTIL_EXPAND(BSLIM_TESTUTIL_LOOP ## N ## _ASSERT(__VA_ARGS__)) |
◆ BSLIM_TESTUTIL_NUM_ARGS
#define BSLIM_TESTUTIL_NUM_ARGS |
( |
|
... | ) |
|
Value:
__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1, 0, ""))
#define BSLIM_TESTUTIL_NUM_ARGS_IMPL(X8, X7, X6, X5, X4, X3, X2, X1, X0, N,...)
Definition bslim_testutil.h:270
#define BSLIM_TESTUTIL_EXPAND(X)
Definition bslim_testutil.h:267
◆ BSLIM_TESTUTIL_NUM_ARGS_IMPL
#define BSLIM_TESTUTIL_NUM_ARGS_IMPL |
( |
|
X8, |
|
|
|
X7, |
|
|
|
X6, |
|
|
|
X5, |
|
|
|
X4, |
|
|
|
X3, |
|
|
|
X2, |
|
|
|
X1, |
|
|
|
X0, |
|
|
|
N, |
|
|
|
... |
|
) |
| N |
◆ BSLIM_TESTUTIL_P
◆ BSLIM_TESTUTIL_P_
◆ BSLIM_TESTUTIL_Q
#define BSLIM_TESTUTIL_Q |
( |
|
X | ) |
bsl::cout << "<| " #X " |>" << bsl::endl; |
◆ BSLIM_TESTUTIL_T_
#define BSLIM_TESTUTIL_T_ bsl::cout << "\t" << bsl::flush; |