text stringlengths 0 2.2M |
|---|
if (veryVerbose) cout << "\t'Invalid input'" << endl;
|
{
|
ASSERT_PASS(Util::parse( &result, INPUT, LENGTH));
|
ASSERT_FAIL(Util::parse( &result, 0, LENGTH));
|
ASSERT_PASS(Util::parse(&resultTz, INPUT, LENGTH));
|
ASSERT_FAIL(Util::parse(&resultTz, 0, LENGTH));
|
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 10: {
|
// --------------------------------------------------------------------
|
// PARSE: TIME & TIMETZ
|
//
|
// Concerns:
|
//: 1 All ISO 8601 string representations supported by this component
|
//: (as documented in the header file) for 'Time' and 'TimeTz' values
|
//: are parsed successfully.
|
//:
|
//: 2 If parsing succeeds, the result 'Time' or 'TimeTz' object has the
|
//: expected value.
|
//:
|
//: 3 If the optional zone designator is present in the input string
|
//: when parsing into a 'Time' object, the resulting value is
|
//: converted to the equivalent UTC time.
|
//:
|
//: 4 If the optional zone designator is *not* present in the input
|
//: string when parsing into a 'TimeTz' 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 'Time' and 'TimeTz' 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 Leap seconds and fractional seconds containing more than three
|
//: digits are handled correctly.
|
//:
|
//:10 QoI: Asserted precondition violations are detected when enabled.
|
//
|
// Plan:
|
//: 1 Using the table-driven technique, specify a set of distinct
|
//: 'Time' values ('T'), zone designators ('Z'), and configurations
|
//: ('C').
|
//:
|
//: 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)
|
//:
|
//: 8 Verify that, in appropriate build modes, defensive checks are
|
//: triggered for invalid arguments, but not triggered for adjacent
|
//: valid ones (using the 'BSLS_ASSERTTEST_*' macros). (C-10)
|
//
|
// 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);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.