text
stringlengths
0
2.2M
bdlat_FormattingMode::e_BASE64);
LOOP2_ASSERT(LINE, retCode, 0 == retCode);
LOOP2_ASSERT(LINE, X, EXPECTED_RESULT == X);
}
}
if (verbose) cout << "\nUsing 'DEC'." << endl;
{
typedef bool Type;
static const struct {
int d_lineNum;
const char *d_input;
Type d_result;
} DATA[] = {
//line input result
//---- ----- ------
{ L_, "1X", true, },
{ L_, "0X", 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_DEC);
LOOP2_ASSERT(LINE, retCode, 0 == retCode);
LOOP2_ASSERT(LINE, X, EXPECTED_RESULT == X);
}
}
if (verbose) cout << "\nUsing 'DEFAULT' (bool->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_DEFAULT);
LOOP2_ASSERT(LINE, retCode, 0 == retCode);
LOOP2_ASSERT(LINE, X, EXPECTED_RESULT == X);
}
}
if (verbose) cout << "\nUsing 'DEFAULT' (char->DEC)." << endl;
{
typedef char Type;
static const struct {
int d_lineNum;
const char *d_input;
Type d_result;
} DATA[] = {
//line input result
//---- ----- ------
{ L_, "-128X", -128, },
{ L_, "-127X", -127, },
{ L_, "-1X", -1, },
{ L_, "0X", 0, },
{ L_, "1X", 1, },
{ L_, "126X", 126, },
{ L_, "127X", 127, },
};
const int NUM_DATA = sizeof DATA / sizeof *DATA;
for (int i = 0; i < NUM_DATA; ++i) {
const int LINE = DATA[i].d_lineNum;