text stringlengths 0 2.2M |
|---|
if (veryVerbose) { T_ P_(LINE) P(INPUT) }
|
bsls::TimeInterval mX(XX); const bsls::TimeInterval& X = mX;
|
bsls::TimeInterval EXPECTED(SEC, USEC);
|
ASSERTV(LINE, INPUT, LENGTH,
|
0 == Util::parse(&mX, INPUT, LENGTH));
|
ASSERTV(LINE, EXPECTED, X, EXPECTED == X);
|
mX = XX;
|
ASSERTV(LINE, INPUT, LENGTH,
|
0 == Util::parse(&mX, StrView(INPUT, LENGTH)));
|
ASSERTV(LINE, EXPECTED, X, EXPECTED == X);
|
}
|
}
|
if (verbose) cout << "\nNegative Testing." << endl;
|
{
|
bsls::AssertTestHandlerGuard hG;
|
const struct {
|
int d_line;
|
const char *d_input;
|
} DATA[] = {
|
{ L_, "1D" },
|
{ L_, "P" },
|
{ L_, "P0" },
|
{ L_, "P1" },
|
{ L_, "PW" },
|
{ L_, "PW1D" },
|
{ L_, "P1D1W" },
|
{ L_, "P1D1D" },
|
{ L_, "P1H" },
|
{ L_, "PT" },
|
{ L_, "PT1" },
|
{ L_, "P1.0W1D" },
|
{ L_, "PT1.1H1M" },
|
{ L_, "PT1.0H1.0S" },
|
};
|
const int NUM_DATA = static_cast<int>(sizeof DATA / sizeof *DATA);
|
for (int ti = 0; ti < NUM_DATA; ++ti) {
|
const int LINE = DATA[ti].d_line;
|
const char *INPUT = DATA[ti].d_input;
|
const int LENGTH = static_cast<int>(bsl::strlen(INPUT));
|
if (veryVerbose) { T_ P_(LINE) P(INPUT) }
|
bsls::TimeInterval mX(XX); const bsls::TimeInterval& X = mX;
|
ASSERTV(LINE, INPUT, LENGTH,
|
0 != Util::parse(&mX, INPUT, LENGTH));
|
ASSERTV(LINE, XX, X, XX == X);
|
ASSERTV(LINE, INPUT, LENGTH,
|
0 != Util::parse(&mX, StrView(INPUT, LENGTH)));
|
ASSERTV(LINE, XX, X, XX == X);
|
}
|
}
|
} break;
|
case 8: {
|
// --------------------------------------------------------------------
|
// PARSE: DATE & DATETZ
|
//
|
// Concerns:
|
//: 1 All ISO 8601 string representations supported by this component
|
//: (as documented in the header file) for 'Date' and 'DateTz' values
|
//: are parsed successfully.
|
//:
|
//: 2 If parsing succeeds, the result 'Date' or 'DateTz' object has the
|
//: expected value.
|
//:
|
//: 3 If the optional zone designator is present in the input string
|
//: when parsing into a 'Date' object, it is parsed for validity but
|
//: is otherwise ignored.
|
//:
|
//: 4 If the optional zone designator is *not* present in the input
|
//: string when parsing into a 'DateTz' object, it is assumed to be
|
//: UTC.
|
//:
|
//: 5 If parsing succeeds, 0 is returned.
|
//:
|
//: 6 All strings that are not ISO 8601 representations supported by
|
//: this component for 'Date' and 'DateTz' values are rejected (i.e.,
|
//: parsing fails).
|
//:
|
//: 7 If parsing fails, the result object is unaffected and a non-zero
|
//: value is returned.
|
//:
|
//: 8 The entire extent of the input string is parsed.
|
//:
|
//: 9 QoI: Asserted precondition violations are detected when enabled.
|
//
|
// Plan:
|
//: 1 Using the table-driven technique, specify a set of distinct
|
//: 'Date' values ('D'), zone designators ('Z'), and configurations
|
//: ('C').
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.