text
stringlengths
0
2.2M
// allocator.
LOOP_ASSERT(noa.numBlocksTotal(), 0 == noa.numBlocksTotal());
// -----------------------------------------------------
// Verify that each attribute is independently settable.
// -----------------------------------------------------
// rootPath
{
BSLMA_TESTALLOCATOR_EXCEPTION_TEST_BEGIN(sa){
mX.configureRootPath(A1);
} BSLMA_TESTALLOCATOR_EXCEPTION_TEST_END
LOOP_ASSERT(CONFIG, A1 == X.rootPath());
mX.configureRootPath(B1);
LOOP_ASSERT(CONFIG, B1 == X.rootPath());
mX.configureRootPath(D1);
}
// Reclaim dynamically allocated object under test.
fa.deleteObject(objPtr);
// Verify that there is no longer any memory allocated.
LOOP2_ASSERT(CONFIG, fa.numBlocksInUse(),
0 == fa.numBlocksInUse());
LOOP2_ASSERT(CONFIG, oa.numBlocksInUse(),
0 == oa.numBlocksInUse());
// Temporary string is created for comparison in assertion, so some
// memory is allocated by default allocator, but it should be
// released correctly at this point.
LOOP2_ASSERT(CONFIG, noa.numBlocksInUse(),
0 == noa.numBlocksInUse());
// Double check that at least some object memory got allocated.
LOOP_ASSERT(CONFIG, 1 <= oa.numBlocksTotal());
// Note that memory should be independently allocated for each
// attribute capable of allocating memory.
}
} break;
case 1: {
// --------------------------------------------------------------------
// BREATHING TEST:
// Developers' Sandbox.
//
// Plan:
// Perform and ad-hoc test of the primary modifiers and accessors.
//
// Testing:
// This "test" *exercises* basic functionality, but *tests* nothing.
// --------------------------------------------------------------------
if (verbose) cout << endl << "BREATHING TEST" << endl
<< "==============" << endl;
{
if (veryVerbose) {
cout << "\tTesting 'construction'." << endl;
}
Obj mX(Z);
ASSERT(0 != mX.configureRootPathIfPlausible("junk"));
ASSERT(0 != mX.configureRootPathIfPlausible("."));
bsl::string temp(Z);
ASSERT(0 == defaultAllocator.numBytesInUse());
}
ASSERT(0 == defaultAllocator.numBytesInUse());
{
if (veryVerbose) {
cout << "\tTesting 'loadTimeZoneFilePath' & 'rootPath'."
<< endl;
}
Obj mX(Z); const Obj& X = mX;
ASSERT(0 != mX.configureRootPathIfPlausible("."));
mX.configureRootPath(".");
ASSERT(!X.isRootPathPlausible());
bsl::string path(Z);
ASSERT(0 == X.loadTimeZoneFilePath(&path, "America/New_York"));
#ifndef BSLS_PLATFORM_OS_WINDOWS
ASSERTV(path, path == "./America/New_York");
#else
ASSERTV(path, path == ".\\America\\New_York");
#endif
ASSERT(0 == X.loadTimeZoneFilePath(&path, "Pacific/Fiji"));
#ifndef BSLS_PLATFORM_OS_WINDOWS
ASSERTV(path, path == "./Pacific/Fiji");
#else
ASSERTV(path, path == ".\\Pacific\\Fiji");
#endif
ASSERT(0 == defaultAllocator.numBytesInUse());
}