text
stringlengths
0
2.2M
retCode = Util::parse(&mY,
INPUT,
INPUT_LENGTH,
bdlat_FormattingMode::e_LIST
| bdlat_FormattingMode::e_DEC);
LOOP2_ASSERT(LINE, retCode, 0 == retCode);
LOOP2_ASSERT(LINE, Y, EXPECTED_RESULT == Y);
}
}
if (verbose) cout << "\nUsing 'TEXT'." << endl;
{
typedef bool Type;
static const struct {
int d_lineNum;
const char *d_input;
Type d_result;
} DATA[] = {
//line input result
//---- ----- ------
{ L_, "trueX", true, },
{ L_, "falseX", false, },
};
const int NUM_DATA = sizeof DATA / sizeof *DATA;
for (int i = 0; i < NUM_DATA; ++i) {
const int LINE = DATA[i].d_lineNum;
const char *INPUT = DATA[i].d_input;
const int INPUT_LENGTH =
static_cast<int>(bsl::strlen(INPUT)) - 1;
const Type EXPECTED_RESULT = DATA[i].d_result;
Type mX(!EXPECTED_RESULT); const Type& X = mX;
int retCode = Util::parse(&mX,
INPUT,
INPUT_LENGTH,
bdlat_FormattingMode::e_TEXT);
LOOP2_ASSERT(LINE, retCode, 0 == retCode);
LOOP2_ASSERT(LINE, X, EXPECTED_RESULT == X);
}
}
} break;
case 7: {
// --------------------------------------------------------------------
// TESTING 'parseDefault' FUNCTIONS
//
// Concerns:
//
// Plan:
// --------------------------------------------------------------------
if (verbose) cout << "\nTesting 'parseDefault' Functions"
<< "\n================================" << endl;
if (verbose) cout << "\nUsing 'bool'." << endl;
{
typedef bool Type;
static const struct {
int d_lineNum;
const char *d_input;
Type d_result;
} DATA[] = {
//line input result
//---- ----- ------
{ L_, "trueX", true, },
{ L_, "falseX", false, },
};
const int NUM_DATA = sizeof DATA / sizeof *DATA;
for (int i = 0; i < NUM_DATA; ++i) {
const int LINE = DATA[i].d_lineNum;
const char *INPUT = DATA[i].d_input;
const int INPUT_LENGTH =
static_cast<int>(bsl::strlen(INPUT)) - 1;
const Type EXPECTED_RESULT = DATA[i].d_result;
Type mX(!EXPECTED_RESULT); const Type& X = mX;
int retCode = Util::parseDefault(&mX, INPUT, INPUT_LENGTH);
LOOP2_ASSERT(LINE, retCode, 0 == retCode);
LOOP2_ASSERT(LINE, X, EXPECTED_RESULT == X);
}
}
if (verbose) cout << "\nUsing 'char'." << endl;
{
typedef char Type;
static const struct {
int d_lineNum;
const char *d_input;
Type d_result;
} DATA[] = {