8#ifndef INCLUDED_BSLS_BSLTESTUTIL
9#define INCLUDED_BSLS_BSLTESTUTIL
449#include <bsls_platform.h>
451#if defined(BSLS_PLATFORM_CMP_MSVC)
461#define BSLS_BSLTESTUTIL_ASSERT(X) \
462 do { aSsErT(!(X), #X, __LINE__); } while (false)
464#define BSLS_BSLTESTUTIL_LOOP0_ASSERT \
465 BSLS_BSLTESTUTIL_ASSERT
467#define BSLS_BSLTESTUTIL_LOOP_ASSERT(I,X) do { \
468 if (!(X)) { BloombergLP::bsls:: \
469 BslTestUtil::callDebugprint(I, #I ": ", "\n"); \
470 aSsErT(true, #X, __LINE__); } } while (false)
472#define BSLS_BSLTESTUTIL_LOOP1_ASSERT \
473 BSLS_BSLTESTUTIL_LOOP_ASSERT
475#define BSLS_BSLTESTUTIL_LOOP2_ASSERT(I,J,X) do { \
476 if (!(X)) { BloombergLP::bsls:: \
477 BslTestUtil::callDebugprint(I, #I ": ", "\t"); \
478 BloombergLP::bsls:: \
479 BslTestUtil::callDebugprint(J, #J ": ", "\n"); \
480 aSsErT(true, #X, __LINE__); } } while (false)
482#define BSLS_BSLTESTUTIL_LOOP3_ASSERT(I,J,K,X) do { \
483 if (!(X)) { BloombergLP::bsls:: \
484 BslTestUtil::callDebugprint(I, #I ": ", "\t"); \
485 BloombergLP::bsls:: \
486 BslTestUtil::callDebugprint(J, #J ": ", "\t"); \
487 BloombergLP::bsls:: \
488 BslTestUtil::callDebugprint(K, #K ": ", "\n"); \
489 aSsErT(true, #X, __LINE__); } } while (false)
491#define BSLS_BSLTESTUTIL_LOOP4_ASSERT(I,J,K,L,X) do { \
492 if (!(X)) { BloombergLP::bsls:: \
493 BslTestUtil::callDebugprint(I, #I ": ", "\t"); \
494 BloombergLP::bsls:: \
495 BslTestUtil::callDebugprint(J, #J ": ", "\t"); \
496 BloombergLP::bsls:: \
497 BslTestUtil::callDebugprint(K, #K ": ", "\t"); \
498 BloombergLP::bsls:: \
499 BslTestUtil::callDebugprint(L, #L ": ", "\n"); \
500 aSsErT(true, #X, __LINE__); } } while (false)
502#define BSLS_BSLTESTUTIL_LOOP5_ASSERT(I,J,K,L,M,X) do { \
503 if (!(X)) { BloombergLP::bsls:: \
504 BslTestUtil::callDebugprint(I, #I ": ", "\t"); \
505 BloombergLP::bsls:: \
506 BslTestUtil::callDebugprint(J, #J ": ", "\t"); \
507 BloombergLP::bsls:: \
508 BslTestUtil::callDebugprint(K, #K ": ", "\t"); \
509 BloombergLP::bsls:: \
510 BslTestUtil::callDebugprint(L, #L ": ", "\t"); \
511 BloombergLP::bsls:: \
512 BslTestUtil::callDebugprint(M, #M ": ", "\n"); \
513 aSsErT(true, #X, __LINE__); } } while (false)
515#define BSLS_BSLTESTUTIL_LOOP6_ASSERT(I,J,K,L,M,N,X) do { \
516 if (!(X)) { BloombergLP::bsls:: \
517 BslTestUtil::callDebugprint(I, #I ": ", "\t"); \
518 BloombergLP::bsls:: \
519 BslTestUtil::callDebugprint(J, #J ": ", "\t"); \
520 BloombergLP::bsls:: \
521 BslTestUtil::callDebugprint(K, #K ": ", "\t"); \
522 BloombergLP::bsls:: \
523 BslTestUtil::callDebugprint(L, #L ": ", "\t"); \
524 BloombergLP::bsls:: \
525 BslTestUtil::callDebugprint(M, #M ": ", "\t"); \
526 BloombergLP::bsls:: \
527 BslTestUtil::callDebugprint(N, #N ": ", "\n"); \
528 aSsErT(true, #X, __LINE__); } } while (false)
530#define BSLS_BSLTESTUTIL_LOOP7_ASSERT(I,J,K,L,M,N,O,X) do { \
531 if (!(X)) { BloombergLP::bsls:: \
532 BslTestUtil::callDebugprint(I, #I ": ", "\t"); \
533 BloombergLP::bsls:: \
534 BslTestUtil::callDebugprint(J, #J ": ", "\t"); \
535 BloombergLP::bsls:: \
536 BslTestUtil::callDebugprint(K, #K ": ", "\t"); \
537 BloombergLP::bsls:: \
538 BslTestUtil::callDebugprint(L, #L ": ", "\t"); \
539 BloombergLP::bsls:: \
540 BslTestUtil::callDebugprint(M, #M ": ", "\t"); \
541 BloombergLP::bsls:: \
542 BslTestUtil::callDebugprint(N, #N ": ", "\t"); \
543 BloombergLP::bsls:: \
544 BslTestUtil::callDebugprint(O, #O ": ", "\n"); \
545 aSsErT(true, #X, __LINE__); } } while (false)
547#define BSLS_BSLTESTUTIL_LOOP8_ASSERT(I,J,K,L,M,N,O,V,X) do { \
548 if (!(X)) { BloombergLP::bsls:: \
549 BslTestUtil::callDebugprint(I, #I ": ", "\t"); \
550 BloombergLP::bsls:: \
551 BslTestUtil::callDebugprint(J, #J ": ", "\t"); \
552 BloombergLP::bsls:: \
553 BslTestUtil::callDebugprint(K, #K ": ", "\t"); \
554 BloombergLP::bsls:: \
555 BslTestUtil::callDebugprint(L, #L ": ", "\t"); \
556 BloombergLP::bsls:: \
557 BslTestUtil::callDebugprint(M, #M ": ", "\t"); \
558 BloombergLP::bsls:: \
559 BslTestUtil::callDebugprint(N, #N ": ", "\t"); \
560 BloombergLP::bsls:: \
561 BslTestUtil::callDebugprint(O, #O ": ", "\t"); \
562 BloombergLP::bsls:: \
563 BslTestUtil::callDebugprint(V, #V ": ", "\n"); \
564 aSsErT(true, #X, __LINE__); } } while (false)
569#define BSLS_BSLTESTUTIL_EXPAND(X) \
572#define BSLS_BSLTESTUTIL_NUM_ARGS_IMPL(X8, X7, X6, X5, X4, X3, X2, X1, X0, \
576#define BSLS_BSLTESTUTIL_NUM_ARGS(...) \
577 BSLS_BSLTESTUTIL_EXPAND(BSLS_BSLTESTUTIL_NUM_ARGS_IMPL( \
578 __VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1, 0, ""))
580#define BSLS_BSLTESTUTIL_LOOPN_ASSERT_IMPL(N, ...) \
581 BSLS_BSLTESTUTIL_EXPAND(BSLS_BSLTESTUTIL_LOOP ## N ## _ASSERT(__VA_ARGS__))
583#define BSLS_BSLTESTUTIL_LOOPN_ASSERT(N, ...) \
584 BSLS_BSLTESTUTIL_LOOPN_ASSERT_IMPL(N, __VA_ARGS__)
586#define BSLS_BSLTESTUTIL_ASSERTV(...) \
587 BSLS_BSLTESTUTIL_LOOPN_ASSERT( \
588 BSLS_BSLTESTUTIL_NUM_ARGS(__VA_ARGS__), __VA_ARGS__)
593#define BSLS_BSLTESTUTIL_Q(X) \
594 BloombergLP::bsls:: \
595 BslTestUtil::printStringNoFlush("<| " #X " |>\n");
598#define BSLS_BSLTESTUTIL_P(X) \
599 BloombergLP::bsls:: \
600 BslTestUtil::callDebugprint(X, #X " = ", "\n");
603#define BSLS_BSLTESTUTIL_P_(X) \
604 BloombergLP::bsls:: \
605 BslTestUtil::callDebugprint(X, #X " = ", ", ");
608#define BSLS_BSLTESTUTIL_L_ __LINE__
611#define BSLS_BSLTESTUTIL_T_ BloombergLP::bsls::BslTestUtil::printTab();
614#if defined(BSLS_PLATFORM_CMP_MSVC)
615# define BSLS_BSLTESTUTIL_FORMAT_ZU "%Iu"
617# define BSLS_BSLTESTUTIL_FORMAT_ZU "%zu"
622#if defined(BSLS_PLATFORM_CMP_MSVC)
623# define BSLS_BSLTESTUTIL_FORMAT_TD "%Id"
625# define BSLS_BSLTESTUTIL_FORMAT_TD "%td"
630#if defined(BSLS_PLATFORM_CMP_MSVC)
631# define BSLS_BSLTESTUTIL_FORMAT_I64 "%I64d"
633# define BSLS_BSLTESTUTIL_FORMAT_I64 "%lld"
638#if defined(BSLS_PLATFORM_CMP_MSVC)
639# define BSLS_BSLTESTUTIL_FORMAT_U64 "%I64u"
641# define BSLS_BSLTESTUTIL_FORMAT_U64 "%llu"
646#if defined(BSLS_PLATFORM_CPU_64_BIT)
647# if defined(BSLS_PLATFORM_CMP_MSVC)
648# define BSLS_BSLTESTUTIL_FORMAT_PTR "%llX"
650# define BSLS_BSLTESTUTIL_FORMAT_PTR "%lX"
653# define BSLS_BSLTESTUTIL_FORMAT_PTR "%X"
678 static void *identityPtr(
void *ptr);
700 template <
class TYPE>
702 const char *leadingString = 0,
703 const char *trailingString = 0);
720 template <
class FUNCTION_PTR>
777template <
class RESULT>
791 const char *leadingString,
792 const char *trailingString)
795 BloombergLP::bsls::BslTestUtil::printStringNoFlush(leadingString);
800 if (trailingString) {
801 BloombergLP::bsls::BslTestUtil::printStringNoFlush(trailingString);
806template <
class FUNCTION_PTR>
819 enum { k_STATIC_ASSERT = 1 /
820 static_cast<int>(
sizeof(FUNCTION_PTR) ==
sizeof(
void *)) };
822 return reinterpret_cast<FUNCTION_PTR
>(identityPtr(
reinterpret_cast<void *
>(
829template <
class RESULT>
832 uintptr_t address =
reinterpret_cast<uintptr_t
>(v);
833 debugprint(
reinterpret_cast<void *
>(address));
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bdlt_iso8601util.h:691
Definition bsls_bsltestutil.h:670
static void flush()
Write any unwritten text in the output buffer to stdout.
static void printStringNoFlush(const char *s)
static void callDebugprint(const TYPE &object, const char *leadingString=0, const char *trailingString=0)
Definition bsls_bsltestutil.h:790
static FUNCTION_PTR makeFunctionCallNonInline(FUNCTION_PTR functionPtr)
Definition bsls_bsltestutil.h:808