text
stringlengths 0
2.2M
|
---|
{ L_, "0001-13-00T00:00:00.000",
|
1, 1, 1, 24, 0, 0, 0, 0, false },
|
{ L_, "0001-01-32T00:00:00.000",
|
1, 1, 1, 24, 0, 0, 0, 0, false },
|
{ L_, "0001-01-01T25:00:00.000",
|
1, 1, 1, 24, 0, 0, 0, 0, false },
|
{ L_, "0001-01-01T00:61:00.000",
|
1, 1, 1, 24, 0, 0, 0, 0, false },
|
{ L_, "0001-01-01T00:00:61.000",
|
1, 1, 1, 24, 0, 0, 0, 0, false },
|
};
|
const int NUM_DATA = sizeof DATA / sizeof *DATA;
|
for (int i = 0; i < NUM_DATA; ++i) {
|
const int LINE = DATA[i].d_line;
|
const bsl::string INPUT = DATA[i].d_input_p;
|
const int YEAR = DATA[i].d_year;
|
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 bool IS_VALID = DATA[i].d_isValid;
|
bdlt::Datetime exp(YEAR, MONTH, DAY,
|
HOUR, MINUTE, SECOND,
|
MILLISECOND, MICROSECOND);
|
const bdlt::Datetime& EXP = exp;
|
bdlt::Datetime mX; const bdlt::Datetime& 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);
|
}
|
}
|
}
|
if (verbose) cout << "\nUsing 'DatetimeTz'." << endl;
|
{
|
static const struct {
|
int d_line; // source line number
|
const char *d_input_p; // input
|
int d_year; // year under test
|
int d_month; // month under test
|
int d_day; // day under test
|
int d_hour; // hour under test
|
int d_minutes; // minutes under test
|
int d_seconds; // seconds under test
|
int d_milliSecs; // milli seconds under test
|
int d_microSecs; // micro seconds under test
|
int d_tzoffset; // time zone offset
|
bool d_isValid; // isValid flag
|
} DATA[] = {
|
//line input year month day hour min sec ms us offset isValid
|
//---- ----- ---- ----- --- ---- --- --- -- -- ------ -------
|
{ L_, "0001-01-01T00:00:00.000+00:00",
|
1, 1, 1, 0, 0, 0, 0, 0, 0, true },
|
{ L_, "0001-01-01T00:00:00.000+00:45",
|
1, 1, 1, 0, 0, 0, 0, 0, 45, true },
|
{ L_, "0001-01-01T00:00:00.000-23:59",
|
1, 1, 1, 0, 0, 0, 0, 0, -1439, true },
|
{ L_, "0001-01-01T00:00:00.000000+00:00",
|
1, 1, 1, 0, 0, 0, 0, 0, 0, true },
|
{ L_, "0001-01-01T00:00:00.000000+00:45",
|
1, 1, 1, 0, 0, 0, 0, 0, 45, true },
|
{ L_, "0001-01-01T00:00:00.000000-23:59",
|
1, 1, 1, 0, 0, 0, 0, 0, -1439, true },
|
{ L_, "0001-01-01T01:01:01.001+00:00",
|
1, 1, 1, 1, 1, 1, 1, 0, 0, true },
|
{ L_, "0001-01-01T01:01:01.001+08:20",
|
1, 1, 1, 1, 1, 1, 1, 0, 500, true },
|
{ L_, "0001-01-01T01:01:01.001000+00:00",
|
1, 1, 1, 1, 1, 1, 1, 0, 0, true },
|
{ L_, "0001-01-01T01:01:01.001000+08:20",
|
1, 1, 1, 1, 1, 1, 1, 0, 500, true },
|
{ L_, "0001-01-01T00:00:00.000000-23:59",
|
1, 1, 1, 0, 0, 0, 0, 0, -1439, true },
|
{ L_, "0001-01-01T01:23:59.059059+00:00",
|
1, 1, 1, 1, 23, 59, 59, 59, 0, true },
|
{ L_, "0001-01-01T01:23:59.059059+23:59",
|
1, 1, 1, 1, 23, 59, 59, 59, 1439, true },
|
{ L_, "0001-01-01T01:23:59.059059-23:59",
|
1, 1, 1, 1, 23, 59, 59, 59, -1439, true },
|
{ L_, "0001-01-02T00:00:00.000000+00:00",
|
1, 1, 2, 0, 0, 0, 0, 0, 0, true },
|
{ L_, "0001-01-02T00:00:00.000000+23:59",
|
1, 1, 2, 0, 0, 0, 0, 0, 1439, true },
|
{ L_, "0001-01-02T00:00:00.000000-23:59",
|
1, 1, 2, 0, 0, 0, 0, 0, -1439, true },
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.