text
stringlengths
0
2.2M
const TYPE X;
char buffer[OBJLEN];
ASSERT_SAFE_PASS(Util::generateRaw(buffer, X));
ASSERT_SAFE_FAIL(Util::generateRaw( 0, X));
ASSERT_SAFE_PASS(Util::generateRaw(buffer, X, C));
ASSERT_FAIL(Util::generateRaw( 0, X, C));
}
}
} break;
case 6: {
// --------------------------------------------------------------------
// GENERATE 'TimeTz'
//
// Concerns:
//: 1 The output generated by each method has the expected format and
//: contents.
//:
//: 2 When sufficient capacity is indicated, the method taking
//: 'bufferLength' generates a null terminator.
//:
//: 3 Each method returns the expected value (the correct character
//: count or the supplied 'ostream', depending on the return type).
//:
//: 4 The value of the supplied object is unchanged.
//:
//: 5 The configuration that is in effect, whether user-supplied or the
//: process-wide default, has the desired effect on the output.
//:
//: 6 QoI: Asserted precondition violations are detected when enabled.
//
// Plan:
//: 1 Using the table-driven technique, specify a set of distinct
//: 'Time' values (one per row) and their corresponding ISO 8601
//: string representations.
//:
//: 2 In a second table, specify a set of distinct timezone values (one
//: per row) and their corresponding ISO 8601 string representations.
//:
//: 3 For each element 'R' in the cross product of the tables from P-1
//: and P-2: (C-1..5)
//:
//: 1 Create a 'const' 'TimeTz' object, 'X', from 'R'.
//:
//: 2 Invoke the six methods under test on 'X' for all possible
//: configurations. Also exercise the method taking 'bufferLength'
//: for all buffer lengths in the range '[0 .. L]', where 'L'
//: provides sufficient capacity for a null terminator and a few
//: extra characters. For each call, verify that the generated
//: output matches the string from 'R' (taking the effect of the
//: configuration into account), a null terminator is appended when
//: expected, and the return value is correct. (C-1..5)
//:
//: 3 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-6)
//
// Testing:
// int generate(char *, int, const TimeTz&);
// int generate(char *, int, const TimeTz&, const Config&);
// int generate(string *, const TimeTz&);
// int generate(string *, const TimeTz&, const Config&);
// ostream generate(ostream&, const TimeTz&);
// ostream generate(ostream&, const TimeTz&, const Config&);
// int generateRaw(char *, const TimeTz&);
// int generateRaw(char *, const TimeTz&, const Config&);
#ifndef BDE_OMIT_INTERNAL_DEPRECATED
// int generate(char *, const TimeTz&, int);
// int generate(char *, const TimeTz&, int, bool useZ);
// ostream generate(ostream&, const TimeTz&, bool useZ);
// int generateRaw(char *, const TimeTz&, bool useZ);
#endif // BDE_OMIT_INTERNAL_DEPRECATED
// --------------------------------------------------------------------
if (verbose) cout << endl
<< "GENERATE 'TimeTz'" << endl
<< "=================" << endl;
typedef bdlt::TimeTz TYPE;
const int OBJLEN = Util::k_TIMETZ_STRLEN;
const int BUFLEN = OBJLEN + 4;
char buffer[BUFLEN];
char chaste[BUFLEN]; bsl::memset(chaste, '?', BUFLEN);
const int NUM_TIME_DATA = NUM_DEFAULT_TIME_DATA;
const DefaultTimeDataRow (&TIME_DATA)[NUM_TIME_DATA] =
DEFAULT_TIME_DATA;
const int NUM_ZONE_DATA = NUM_DEFAULT_ZONE_DATA;
const DefaultZoneDataRow (&ZONE_DATA)[NUM_ZONE_DATA] =
DEFAULT_ZONE_DATA;
const int NUM_CNFG_DATA = NUM_DEFAULT_CNFG_DATA;
const DefaultCnfgDataRow (&CNFG_DATA)[NUM_CNFG_DATA] =
DEFAULT_CNFG_DATA;