BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslim_testutil

Macros

#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).
 

Detailed Description

Outline

Purpose

Provide test utilities for components above bsl.

Classes

Macros

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.

Macro Definition Documentation

◆ 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:
BSLIM_TESTUTIL_NUM_ARGS(__VA_ARGS__), __VA_ARGS__)
#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

#define BSLIM_TESTUTIL_LOOP0_ASSERT    BSLIM_TESTUTIL_ASSERT

◆ BSLIM_TESTUTIL_LOOP1_ASSERT

#define BSLIM_TESTUTIL_LOOP1_ASSERT    BSLIM_TESTUTIL_LOOP_ASSERT

◆ BSLIM_TESTUTIL_LOOP2_ASSERT

#define BSLIM_TESTUTIL_LOOP2_ASSERT (   I,
  J,
 
)
Value:
if (!(X)) { bsl::cout << #I ": " << BSLIM_TESTUTIL_DEBUG_REP(I) << "\t" \
<< #J ": " << BSLIM_TESTUTIL_DEBUG_REP(J) << "\n"; \
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,
 
)
Value:
if (!(X)) { bsl::cout << #I ": " << BSLIM_TESTUTIL_DEBUG_REP(I) << "\t" \
<< #J ": " << BSLIM_TESTUTIL_DEBUG_REP(J) << "\t" \
<< #K ": " << BSLIM_TESTUTIL_DEBUG_REP(K) << "\n"; \
aSsErT(1, #X, __LINE__); }

◆ BSLIM_TESTUTIL_LOOP4_ASSERT

#define BSLIM_TESTUTIL_LOOP4_ASSERT (   I,
  J,
  K,
  L,
 
)
Value:
if (!(X)) { bsl::cout << #I ": " << BSLIM_TESTUTIL_DEBUG_REP(I) << "\t" \
<< #J ": " << BSLIM_TESTUTIL_DEBUG_REP(J) << "\t" \
<< #K ": " << BSLIM_TESTUTIL_DEBUG_REP(K) << "\t" \
<< #L ": " << BSLIM_TESTUTIL_DEBUG_REP(L) << "\n"; \
aSsErT(1, #X, __LINE__); }

◆ BSLIM_TESTUTIL_LOOP5_ASSERT

#define BSLIM_TESTUTIL_LOOP5_ASSERT (   I,
  J,
  K,
  L,
  M,
 
)
Value:
if (!(X)) { bsl::cout << #I ": " << BSLIM_TESTUTIL_DEBUG_REP(I) << "\t" \
<< #J ": " << BSLIM_TESTUTIL_DEBUG_REP(J) << "\t" \
<< #K ": " << BSLIM_TESTUTIL_DEBUG_REP(K) << "\t" \
<< #L ": " << BSLIM_TESTUTIL_DEBUG_REP(L) << "\t" \
<< #M ": " << BSLIM_TESTUTIL_DEBUG_REP(M) << "\n"; \
aSsErT(1, #X, __LINE__); }

◆ BSLIM_TESTUTIL_LOOP6_ASSERT

#define BSLIM_TESTUTIL_LOOP6_ASSERT (   I,
  J,
  K,
  L,
  M,
  N,
 
)
Value:
if (!(X)) { bsl::cout << #I ": " << BSLIM_TESTUTIL_DEBUG_REP(I) << "\t" \
<< #J ": " << BSLIM_TESTUTIL_DEBUG_REP(J) << "\t" \
<< #K ": " << BSLIM_TESTUTIL_DEBUG_REP(K) << "\t" \
<< #L ": " << BSLIM_TESTUTIL_DEBUG_REP(L) << "\t" \
<< #M ": " << BSLIM_TESTUTIL_DEBUG_REP(M) << "\t" \
<< #N ": " << BSLIM_TESTUTIL_DEBUG_REP(N) << "\n"; \
aSsErT(1, #X, __LINE__); }

◆ BSLIM_TESTUTIL_LOOP7_ASSERT

#define BSLIM_TESTUTIL_LOOP7_ASSERT (   I,
  J,
  K,
  L,
  M,
  N,
  O,
 
)
Value:
if (!(X)) { bsl::cout << #I ": " << BSLIM_TESTUTIL_DEBUG_REP(I) << "\t" \
<< #J ": " << BSLIM_TESTUTIL_DEBUG_REP(J) << "\t" \
<< #K ": " << BSLIM_TESTUTIL_DEBUG_REP(K) << "\t" \
<< #L ": " << BSLIM_TESTUTIL_DEBUG_REP(L) << "\t" \
<< #M ": " << BSLIM_TESTUTIL_DEBUG_REP(M) << "\t" \
<< #N ": " << BSLIM_TESTUTIL_DEBUG_REP(N) << "\t" \
<< #O ": " << BSLIM_TESTUTIL_DEBUG_REP(O) << "\n"; \
aSsErT(1, #X, __LINE__); }

◆ BSLIM_TESTUTIL_LOOP8_ASSERT

#define BSLIM_TESTUTIL_LOOP8_ASSERT (   I,
  J,
  K,
  L,
  M,
  N,
  O,
  V,
 
)
Value:
if (!(X)) { bsl::cout << #I ": " << BSLIM_TESTUTIL_DEBUG_REP(I) << "\t" \
<< #J ": " << BSLIM_TESTUTIL_DEBUG_REP(J) << "\t" \
<< #K ": " << BSLIM_TESTUTIL_DEBUG_REP(K) << "\t" \
<< #L ": " << BSLIM_TESTUTIL_DEBUG_REP(L) << "\t" \
<< #M ": " << BSLIM_TESTUTIL_DEBUG_REP(M) << "\t" \
<< #N ": " << BSLIM_TESTUTIL_DEBUG_REP(N) << "\t" \
<< #O ": " << BSLIM_TESTUTIL_DEBUG_REP(O) << "\t" \
<< #V ": " << BSLIM_TESTUTIL_DEBUG_REP(V) << "\n"; \
aSsErT(1, #X, __LINE__); }

◆ BSLIM_TESTUTIL_LOOP_ASSERT

#define BSLIM_TESTUTIL_LOOP_ASSERT (   I,
 
)
Value:
if (!(X)) { bsl::cout << #I ": " << BSLIM_TESTUTIL_DEBUG_REP(I) << "\n"; \
aSsErT(1, #X, __LINE__); }

◆ BSLIM_TESTUTIL_LOOPN_ASSERT

#define BSLIM_TESTUTIL_LOOPN_ASSERT (   N,
  ... 
)     BSLIM_TESTUTIL_LOOPN_ASSERT_IMPL(N, __VA_ARGS__)

◆ 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

#define BSLIM_TESTUTIL_P (   X)     bsl::cout << #X " = " << BSLIM_TESTUTIL_DEBUG_REP(X) << bsl::endl;

◆ BSLIM_TESTUTIL_P_

#define BSLIM_TESTUTIL_P_ (   X)     bsl::cout << #X " = " << BSLIM_TESTUTIL_DEBUG_REP(X) << ", " << bsl::flush;

◆ 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;