text
stringlengths
0
2.2M
ASSERT_PASS(Util::parse( &result, stringRef));
ASSERT_FAIL(Util::parse( &result, nullRef));
ASSERT_PASS(Util::parse(&resultTz, stringRef));
ASSERT_FAIL(Util::parse(&resultTz, nullRef));
}
if (veryVerbose) cout << "\t'Invalid length'" << endl;
{
ASSERT_PASS(Util::parse( &result, INPUT, LENGTH));
ASSERT_PASS(Util::parse( &result, INPUT, 0));
ASSERT_FAIL(Util::parse( &result, INPUT, -1));
ASSERT_PASS(Util::parse(&resultTz, INPUT, LENGTH));
ASSERT_PASS(Util::parse(&resultTz, INPUT, 0));
ASSERT_FAIL(Util::parse(&resultTz, INPUT, -1));
}
}
} break;
case 9: {
// --------------------------------------------------------------------
// PARSE: bsls::TimeInterval
//
// Concerns:
//: 1 All ISO 8601 string representations supported by this component
//: (as documented in the header file) for 'TimeInterval' values are
//: parsed successfully.
//:
//: 2 If parsing succeeds, the result 'TimeInterval' object has the
//: expected value.
//:
//: 3 If parsing succeeds, 0 is returned.
//:
//: 4 All strings that are not ISO 8601 representations supported by
//: this component for 'TimeInterval' values are rejected (i.e.,
//: parsing fails).
//:
//: 5 If parsing fails, the result object is uneffected and a non-zero
//: value is returned.
//:
//: 6 The entire extent of the input string is parsed.
//:
//: 7 Fractional seconds containing more than nine digits are handled
//: correctly.
//
// Plan:
//: 1 Using the table-driven technique, specify a set of distinct
//: 'TimeInterval' values.
//:
//: 2 Apply the (fully-tested) 'generateRaw' functions to each element
//: in the cross product, 'T x Z x C', of the test data from P-1.
//:
//: 3 Invoke the 'parse' functions on the strings generated in P-2 and
//: verify that parsing succeeds, i.e., that 0 is returned and the
//: result objects have the expected values. (C-1..5)
//:
//: 4 Using the table-driven technique, specify a set of distinct
//: strings that are not ISO 8601 representations supported by this
//: component for 'Time' and 'TimeTz' values.
//:
//: 5 Invoke the 'parse' functions on the strings from P-4 and verify
//: that parsing fails, i.e., that a non-zero value is returned and
//: the result objects are unchanged. (C-6..8)
//:
//: 6 Using the table-driven technique, specify a set of distinct
//: ISO 8601 strings that specifically cover cases involving leap
//: seconds and fractional seconds containing more than three digits.
//:
//: 7 Invoke the 'parse' functions on the strings from P-6 and verify
//: the results are as expected. (C-9)
//
// Testing:
// int parse(Time *, const char *, int);
// int parse(TimeTz *, const char *, int);
// int parse(Time *result, const StringRef& string);
// int parse(TimeTz *result, const StringRef& string);
// --------------------------------------------------------------------
if (verbose) cout << endl
<< "PARSE: bsls::TimeInterval" << endl
<< "=========================" << endl;
const bsls::TimeInterval XX(2, 4); // A control, distinct from any
// test data.
if (verbose) cout << "\nTesting bsls::TimeInterval." << endl;
{
const int NUM_INTERVAL_DATA = NUM_DEFAULT_INTERVAL_DATA;
const DefaultIntervalDataRow (&INTERVAL_DATA)[NUM_INTERVAL_DATA] =
DEFAULT_INTERVAL_DATA;
for (int ti = 0; ti < NUM_INTERVAL_DATA; ++ti) {
const int LINE = INTERVAL_DATA[ti].d_line;
const char *INPUT = INTERVAL_DATA[ti].d_iso8601;
const int LENGTH =
static_cast<int>(bsl::strlen(INPUT));
const bsls::Types::Int64 SEC = INTERVAL_DATA[ti].d_sec;
const int USEC = INTERVAL_DATA[ti].d_usec;