text
stringlengths 0
2.2M
|
---|
const int INPUT_LENGTH =
|
static_cast<int>(bsl::strlen(INPUT)) - 1;
|
Type mX;
|
int retCode = Util::parseText(&mX, INPUT, INPUT_LENGTH);
|
LOOP2_ASSERT(LINE, retCode, 0 != retCode);
|
}
|
}
|
} break;
|
case 5: {
|
// --------------------------------------------------------------------
|
// TESTING 'parseList' FUNCTIONS
|
//
|
// Concerns:
|
//
|
// Plan:
|
// --------------------------------------------------------------------
|
if (verbose) cout << "\nTesting 'parseList' Functions"
|
<< "\n=============================" << endl;
|
if (verbose) cout << "\nUsing 'bsl::vector<int>'." << endl;
|
{
|
typedef int ElemType;
|
typedef bsl::vector<ElemType> Type;
|
static const struct {
|
int d_lineNum;
|
const char *d_input;
|
ElemType d_result[5];
|
int d_numResult;
|
} DATA[] = {
|
//line input result numResult
|
//---- ----- ------ ---------
|
{ L_, "X", { }, 0, },
|
{ L_, "1X", { 1 }, 1, },
|
{ L_, "1 4X", { 1, 4 }, 2, },
|
{ L_, "1 4 2X", { 1, 4, 2 }, 3, },
|
{ L_, "1 4 2 8X", { 1, 4, 2, 8 }, 4, },
|
{ L_, "1 4 2 8 23X", { 1, 4, 2, 8, 23 }, 5, },
|
};
|
const int NUM_DATA = sizeof DATA / sizeof *DATA;
|
for (int i = 0; i < NUM_DATA; ++i) {
|
const int LINE = DATA[i].d_lineNum;
|
const char *INPUT = DATA[i].d_input;
|
const int INPUT_LENGTH =
|
static_cast<int>(bsl::strlen(INPUT)) - 1;
|
const ElemType *RESULT = DATA[i].d_result;
|
const int NUM_RESULT = DATA[i].d_numResult;
|
const Type EXPECTED_RESULT(RESULT, RESULT + NUM_RESULT);
|
Type mX; const Type& X = mX;
|
int retCode = Util::parseList(&mX, INPUT, INPUT_LENGTH);
|
LOOP2_ASSERT(LINE, retCode, 0 == retCode);
|
LOOP2_ASSERT(LINE, X, EXPECTED_RESULT == X);
|
}
|
}
|
} break;
|
case 4: {
|
// --------------------------------------------------------------------
|
// TESTING 'parseHex' FUNCTIONS
|
//
|
// Concerns:
|
//
|
// Plan:
|
// --------------------------------------------------------------------
|
if (verbose) cout << "\nTesting 'parseHex' Functions"
|
<< "\n============================" << endl;
|
static const struct {
|
int d_lineNum;
|
const char *d_input;
|
const char *d_result;
|
} DATA[] = {
|
//line input result
|
//---- ----- ------
|
{ L_, "X", "" },
|
{ L_, "61X", "a" },
|
{ L_, "6162X", "ab" },
|
{ L_, "616263X", "abc" },
|
{ L_, "61626364X", "abcd" },
|
};
|
const int NUM_DATA = sizeof DATA / sizeof *DATA;
|
if (verbose) cout << "\nUsing 'bsl::string'." << endl;
|
{
|
typedef bsl::string Type;
|
for (int i = 0; i < NUM_DATA; ++i) {
|
const int LINE = DATA[i].d_lineNum;
|
const char *INPUT = DATA[i].d_input;
|
const char *RESULT = DATA[i].d_result;
|
const int INPUT_LENGTH =
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.