8#ifndef INCLUDED_BSLMT_TESTUTIL
9#define INCLUDED_BSLMT_TESTUTIL
594#include <bslscm_version.h>
603#include <bsl_iostream.h>
604#include <bsl_string.h>
610#define BSLMT_TESTUTIL_GUARD_NAME_IMPL \
611 bloomberglp_bslmt_tEsTuTiL_GuArD_ ## __LINE__
616#define BSLMT_TESTUTIL_GUARD \
617 BloombergLP::bslmt::TestUtil_Guard BSLMT_TESTUTIL_GUARD_NAME_IMPL
619#define BSLMT_TESTUTIL_OUTPUT_GUARD BSLMT_TESTUTIL_GUARD
620#define BSLMT_TESTUTIL_NESTED_OUTPUT_GUARD BSLMT_TESTUTIL_GUARD
627#define BSLMT_TESTUTIL_GUARDED_STREAM(STREAM) \
628 for (BSLMT_TESTUTIL_GUARD; BSLMT_TESTUTIL_GUARD_NAME_IMPL; \
629 BSLMT_TESTUTIL_GUARD_NAME_IMPL = false) \
634#define BSLMT_TESTUTIL_COUT BSLMT_TESTUTIL_GUARDED_STREAM(bsl::cout)
638#define BSLMT_TESTUTIL_CERR BSLMT_TESTUTIL_GUARDED_STREAM(bsl::cerr)
640#define BSLMT_TESTUTIL_LOOP0_ASSERT(X) \
641 if (X) ; else do { BSLMT_TESTUTIL_GUARD; \
642 aSsErT(1, #X, __LINE__); } while (false)
644#define BSLMT_TESTUTIL_ASSERT(X) BSLMT_TESTUTIL_LOOP0_ASSERT(X)
646#define BSLMT_TESTUTIL_LOOP1_ASSERT(I,X) \
647 if (X) ; else do { BSLMT_TESTUTIL_GUARD; \
648 bsl::cout << #I << ": " << (I) << "\n"; \
649 aSsErT(1, #X, __LINE__); } while (false)
651#define BSLMT_TESTUTIL_LOOP_ASSERT(X) BSLMT_TESTUTIL_LOOP1_ASSERT(X)
653#define BSLMT_TESTUTIL_LOOP2_ASSERT(I,J,X) \
654 if (X) ; else do { BSLMT_TESTUTIL_GUARD; \
655 bsl::cout << #I << ": " << (I) << "\t" \
656 << #J << ": " << (J) << "\n"; \
657 aSsErT(1, #X, __LINE__); } while (false)
659#define BSLMT_TESTUTIL_LOOP3_ASSERT(I,J,K,X) \
660 if (X) ; else do { BSLMT_TESTUTIL_GUARD; \
661 bsl::cout << #I << ": " << (I) << "\t" \
662 << #J << ": " << (J) << "\t" \
663 << #K << ": " << (K) << "\n"; \
664 aSsErT(1, #X, __LINE__); } while (false)
666#define BSLMT_TESTUTIL_LOOP4_ASSERT(I,J,K,L,X) \
667 if (X) ; else do { BSLMT_TESTUTIL_GUARD; \
668 bsl::cout << #I << ": " << (I) << "\t" \
669 << #J << ": " << (J) << "\t" \
670 << #K << ": " << (K) << "\t" \
671 << #L << ": " << (L) << "\n"; \
672 aSsErT(1, #X, __LINE__); } while (false)
674#define BSLMT_TESTUTIL_LOOP5_ASSERT(I,J,K,L,M,X) \
675 if (X) ; else do { BSLMT_TESTUTIL_GUARD; \
676 bsl::cout << #I << ": " << (I) << "\t" \
677 << #J << ": " << (J) << "\t" \
678 << #K << ": " << (K) << "\t" \
679 << #L << ": " << (L) << "\t" \
680 << #M << ": " << (M) << "\n"; \
681 aSsErT(1, #X, __LINE__); } while (false)
683#define BSLMT_TESTUTIL_LOOP6_ASSERT(I,J,K,L,M,N,X) \
684 if (X) ; else do { BSLMT_TESTUTIL_GUARD; \
685 bsl::cout << #I << ": " << (I) << "\t" \
686 << #J << ": " << (J) << "\t" \
687 << #K << ": " << (K) << "\t" \
688 << #L << ": " << (L) << "\t" \
689 << #M << ": " << (M) << "\t" \
690 << #N << ": " << (N) << "\n"; \
691 aSsErT(1, #X, __LINE__); } while (false)
697#define BSLMT_TESTUTIL_EXPAND(X) \
700#define BSLMT_TESTUTIL_NUM_ARGS_IMPL(X6, X5, X4, X3, X2, X1, X0, N, ...) \
703#define BSLMT_TESTUTIL_NUM_ARGS(...) \
704 BSLMT_TESTUTIL_EXPAND(BSLMT_TESTUTIL_NUM_ARGS_IMPL( \
705 __VA_ARGS__, 6, 5, 4, 3, 2, 1, 0, ""))
707#define BSLMT_TESTUTIL_LOOPN_ASSERT_IMPL(N, ...) \
708 BSLMT_TESTUTIL_EXPAND(BSLMT_TESTUTIL_LOOP ## N ## _ASSERT(__VA_ARGS__))
710#define BSLMT_TESTUTIL_LOOPN_ASSERT(N, ...) \
711 BSLMT_TESTUTIL_LOOPN_ASSERT_IMPL(N, __VA_ARGS__)
713#define BSLMT_TESTUTIL_ASSERTV(...) BSLMT_TESTUTIL_LOOPN_ASSERT( \
714 BSLMT_TESTUTIL_NUM_ARGS(__VA_ARGS__), __VA_ARGS__)
721#define BSLMT_TESTUTIL_Q(X) \
722 BSLMT_TESTUTIL_COUT << "<| " #X " |>" << bsl::endl
725#define BSLMT_TESTUTIL_P(X) \
726 BSLMT_TESTUTIL_COUT << #X " = " << (X) << bsl::endl
729#define BSLMT_TESTUTIL_P_(X) \
730 BSLMT_TESTUTIL_COUT << #X " = " << (X) << ", " << bsl::flush
734#define BSLMT_TESTUTIL_T_ \
735 BSLMT_TESTUTIL_COUT << "\t" << bsl::flush;
738#define BSLMT_TESTUTIL_L_ \
763 static void *identityPtr(
void *ptr);
773 template <
class FUNCTION_PTR>
830 void operator=(
bool rhs);
846template <
class FUNCTION_PTR>
852 return reinterpret_cast<FUNCTION_PTR
>(
853 identityPtr(
reinterpret_cast<void *
>(functionPtr)));
864 (d_mutex_p = &singletonMutex())->lock();
874void TestUtil_Guard::operator=(
bool rhs)
Definition bslmt_recursivemutex.h:130
void unlock()
Definition bslmt_recursivemutex.h:206
Definition bslmt_testutil.h:790
TestUtil_Guard()
Definition bslmt_testutil.h:861
~TestUtil_Guard()
Unlock the recursive mutex that was locked by the constructor.
Definition bslmt_testutil.h:868
UnspecifiedBool::BoolType BoolType
Definition bslmt_testutil.h:797
Definition bsls_unspecifiedbool.h:177
int UnspecifiedBool::* BoolType
Definition bsls_unspecifiedbool.h:190
static BoolType makeValue(bool predicate)
Definition bsls_unspecifiedbool.h:231
#define BSLMF_ASSERT(expr)
Definition bslmf_assert.h:229
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#define BSLS_KEYWORD_DELETED
Definition bsls_keyword.h:609
Definition bslmt_barrier.h:344
Definition bslmt_testutil.h:755
static FUNCTION_PTR makeFunctionCallNonInline(FUNCTION_PTR functionPtr)
Definition bslmt_testutil.h:848