text
stringlengths
0
2.2M
if (verbose) printf("\t...constructing pair with allocators\n");
BSLMA_TESTALLOCATOR_EXCEPTION_TEST_BEGIN(testAllocator) {
my_ClassDef rawBuf[2];
my_PairAA_4_4 *objPtr = rawBuf[0].as<my_PairAA_4_4>();
Util::construct(objPtr, TA);
ASSERT(0 == rawBuf[0].d_value);
ASSERT(TA == rawBuf[0].d_allocator_p);
ASSERT(0 == rawBuf[1].d_value);
ASSERT(TA == rawBuf[1].d_allocator_p);
objPtr->~my_PairAA_4_4();
} BSLMA_TESTALLOCATOR_EXCEPTION_TEST_END
if (verbose) printf("\t...constructing pair with IsPair\n");
// Testing that 'TA' is not passed to the pair constructor and the
// default allocator is used instead.
const bsls::Types::Int64 NUM_ALLOC1 = testAllocator.numAllocations();
BSLMA_TESTALLOCATOR_EXCEPTION_TEST_BEGIN(testAllocator) {
my_ClassDef rawBuf[2];
my_PairBB_4_4 *objPtr = rawBuf[0].as<my_PairBB_4_4>();
Util::construct(objPtr, TA);
ASSERT(0 == rawBuf[0].d_value);
ASSERT(DA == rawBuf[0].d_allocator_p);
ASSERT(0 == rawBuf[1].d_value);
ASSERT(DA == rawBuf[1].d_allocator_p);
objPtr->~my_PairBB_4_4();
} BSLMA_TESTALLOCATOR_EXCEPTION_TEST_END
ASSERT(NUM_ALLOC1 == testAllocator.numAllocations());
if (verbose) printf("Trait selection testing.\n");
{
my_ClassDef rawBuf;
my_ClassFussy *objPtr = rawBuf.as<my_ClassFussy>();
setToGarbage(&rawBuf);
Util::construct(objPtr, XA);
ASSERT(0 == rawBuf.d_value);
ASSERT(0 == rawBuf.d_allocator_p);
if (veryVerbose) { P_(rawBuf.d_value); PP(rawBuf.d_allocator_p); }
}
} break;
case 2: {
// --------------------------------------------------------------------
// TESTING TEST APPARATUS
//
// Concerns:
// The test apparatus must work properly.
//
// Plan:
// Simply test the values of each constant defined.
//
// Testing:
// TEST APPARATUS
// --------------------------------------------------------------------
if (verbose) printf("\nTESTING TEST APPARATUS"
"\n======================\n");
ASSERT(1 == V1.value());
ASSERT(2 == V2.value());
ASSERT(1 == PV1V1.first.value()); ASSERT(1 == PV1V1.second.value());
ASSERT(1 == PV1V2.first.value()); ASSERT(2 == PV1V2.second.value());
ASSERT(2 == PV2V1.first.value()); ASSERT(1 == PV2V1.second.value());
ASSERT(2 == PV2V2.first.value()); ASSERT(2 == PV2V2.second.value());
ASSERT(1 == PAV1V2.first.value()); ASSERT(2 == PAV1V2.second.value());
ASSERT(2 == PAV2V2.first.value()); ASSERT(2 == PAV2V2.second.value());
ASSERT(2 == PAAV2V2.first.value());
ASSERT(2 == PAAV2V2.second.value());
} break;
case 1: {
// --------------------------------------------------------------------
// BREATHING TEST
//
// Concerns:
//: 1 That the templates can be instantiated without errors.
//
// Plan:
//: 1 Simply instantiate the templates in very simple examples,
//: constructing or destroying an object stored in some buffer. No
//: thorough testing is performed, beyond simply asserting the call
//: was forwarded properly by examining the value of the buffer
//: storing the object.
//
// Testing:
// BREATHING TEST
// --------------------------------------------------------------------
if (verbose) printf("\nBREATHING TEST"
"\n==============\n");
my_Class1 v1(1); ASSERT(1 == v1.value());
my_Class2 v2(2); ASSERT(2 == v2.value());
my_ClassDef rawBuf;
bslma::TestAllocator testAllocator(veryVeryVeryVerbose);