text
stringlengths 0
2.2M
|
---|
const int MONTH = DATA[i].d_month;
|
const int DAY = DATA[i].d_day;
|
const int HOUR = DATA[i].d_hour;
|
const int MINUTE = DATA[i].d_minutes;
|
const int SECOND = DATA[i].d_seconds;
|
const int MILLISECOND = DATA[i].d_milliSecs;
|
const int MICROSECOND = DATA[i].d_microSecs;
|
const int OFFSET = DATA[i].d_tzoffset;
|
const bool IS_VALID = DATA[i].d_isValid;
|
bdlt::Datetime dt(YEAR, MONTH, DAY,
|
HOUR, MINUTE, SECOND,
|
MILLISECOND, MICROSECOND);
|
const bdlt::Datetime& DT = dt;
|
bdlt::DatetimeTz exp(DT, OFFSET);
|
const bdlt::DatetimeTz& EXP = exp;
|
bdlt::DatetimeTz mX; const bdlt::DatetimeTz& X = mX;
|
int retCode = Util::parseDefault(
|
&mX,
|
INPUT.c_str(),
|
static_cast<int>(INPUT.length()));
|
if (IS_VALID) {
|
LOOP2_ASSERT(LINE, retCode, 0 == retCode);
|
LOOP3_ASSERT(LINE, INPUT, X, EXP == X);
|
}
|
else {
|
LOOP2_ASSERT(LINE, retCode, 0 != retCode);
|
}
|
}
|
}
|
} break;
|
case 6: {
|
// --------------------------------------------------------------------
|
// TESTING 'parseText' FUNCTIONS
|
//
|
// Concerns:
|
//
|
// Plan:
|
// --------------------------------------------------------------------
|
if (verbose) cout << "\nTesting 'parseText' 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::parseText(&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[] = {
|
//line input result
|
//---- ----- ------
|
{ L_, "aX", 'a', },
|
{ L_, "bX", 'b', },
|
{ L_, "ZX", 'Z', },
|
{ L_, "zX", 'z', },
|
};
|
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;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.