text
stringlengths
0
2.2M
//LINE PATH IS_PLAUSIBLE
//---- ---- ------------
{ L_, "", false},
{ L_, "Nonexistent", false},
{ L_, ".", false},
{ L_, TEST_DIRECTORY, true},
};
const int NUM_DATA = sizeof DATA / sizeof *DATA;
if (verbose) cout << "\nTesting with various path." << endl;
{
for (int ti = 0; ti < NUM_DATA; ++ti) {
const int LINE = DATA[ti].d_line;
const char *PATH = DATA[ti].d_path;
const bool IS_PLAUSIBLE = DATA[ti].d_isPlausible;
Obj mX; const Obj& X = mX;
if (veryVerbose) { T_ P_(PATH) P(IS_PLAUSIBLE) }
mX.configureRootPath(PATH);
LOOP3_ASSERT(LINE, PATH, X.rootPath(), PATH == X.rootPath());
LOOP3_ASSERT(LINE, IS_PLAUSIBLE, X.isRootPathPlausible(),
IS_PLAUSIBLE == X.isRootPathPlausible());
}
}
} break;
case 3: {
// --------------------------------------------------------------------
// TESTING 'isPlausibleZoneinfoRootPath'
//
// Concerns:
//: 1 'isPlausibleZoneinfoRootPath' returns value returns 'true' if
//: the specified 'path' is a valid directory and contains a file
//: name 'GMT, and false otherwise.
//:
//: 2 'configureRootPathIfPlausible' will only set the root path if the
//: parameter is a plausible Zoneinfo data path.
//
// Plan:
//: 1 Test that 'isPlausibleZoneinfoRootPath' produce expected results
//: at the documented boundaries.
//:
//: 2 Test that 'configureRootPathIfPlausible' set the 'rootPath' and
//: returns 0 for a plausible path, and returns false otherwise.
//
// Testing:
// bool isPlausibleZoneinfoRootPath(const char *path);
// int configureRootPathIfPlausible(const char *path);
// --------------------------------------------------------------------
if (verbose) cout << endl
<< "TESTING 'isPlausibleZoneinfoRootPath'" << endl
<< "=====================================" << endl;
{
Obj mX;
if (veryVerbose) cout << "\tNon-existent directory" << endl;
{
ASSERT(false ==
Obj::isPlausibleZoneinfoRootPath("NonExistentDirectory"));
ASSERT(0 !=
mX.configureRootPathIfPlausible("NonExistentDirectory"));
}
if (veryVerbose) cout << "\tMissing GMT file" << endl;
{
ASSERT(false ==
Obj::isPlausibleZoneinfoRootPath("."));
ASSERT(0 != mX.configureRootPathIfPlausible("."));
}
if (veryVerbose) cout << "\tPlausible root path" << endl;
{
ASSERT(true ==
Obj::isPlausibleZoneinfoRootPath(TEST_DIRECTORY));
ASSERT(0 == mX.configureRootPathIfPlausible(TEST_DIRECTORY));
ASSERT(TEST_DIRECTORY == mX.rootPath());
}
}
} break;
case 2: {
// --------------------------------------------------------------------
// DEFAULT CTOR & PRIMARY MANIPULATORS
//
// Concerns:
//: 1 Default constructor creates an object with an invalid root path.
//:
//: 2 If an allocator is *not* supplied to the default constructor, the
//: default allocator in effect at the time of construction becomes
//: the object allocator for the resulting object.
//:
//: 3 If an allocator is supplied to the default constructor, that
//: allocator becomes the object allocator for the resulting object.
//: