text stringlengths 0 2.2M |
|---|
const Type EXPECTED_RESULT = DATA[i].d_result;
|
Type mX; const Type& X = mX;
|
int retCode = Util::parseText(&mX, INPUT, INPUT_LENGTH);
|
LOOP2_ASSERT(LINE, retCode, 0 == retCode);
|
LOOP2_ASSERT(LINE, X, EXPECTED_RESULT == X);
|
}
|
}
|
if (verbose) cout << "\nUsing 'bsl::string'." << endl;
|
{
|
typedef bsl::string Type;
|
static const struct {
|
int d_lineNum;
|
const char *d_input;
|
Type d_result;
|
} DATA[] = {
|
//line input result
|
//---- ----- ------
|
{ L_, "X", "", },
|
{ L_, "HelloX", "Hello", },
|
{ L_, "World!!X", "World!!", },
|
};
|
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 Type EXPECTED_RESULT = DATA[i].d_result;
|
Type mX; const Type& X = mX;
|
int retCode = Util::parseText(&mX, INPUT, INPUT_LENGTH);
|
LOOP2_ASSERT(LINE, retCode, 0 == retCode);
|
LOOP2_ASSERT(LINE, X, EXPECTED_RESULT == X);
|
}
|
}
|
if (verbose) cout << "\nUsing 'bsl::vector<char>'." << endl;
|
{
|
typedef bsl::vector<char> Type;
|
static const struct {
|
int d_lineNum;
|
const char *d_input;
|
const char *d_result;
|
} DATA[] = {
|
//line input result
|
//---- ----- ------
|
{ L_, "X", "", },
|
{ L_, "HelloX", "Hello", },
|
{ L_, "World!!X", "World!!", },
|
};
|
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 char *RESULT = DATA[i].d_result;
|
const bsl::size_t RESULT_LENGTH = bsl::strlen(RESULT);
|
const Type EXPECTED_RESULT(RESULT,
|
RESULT + RESULT_LENGTH);
|
Type mX; const Type& X = mX;
|
int retCode = Util::parseText(&mX, INPUT, INPUT_LENGTH);
|
LOOP2_ASSERT(LINE, retCode, 0 == retCode);
|
LOOP2_ASSERT(LINE, X, EXPECTED_RESULT == X);
|
}
|
}
|
if (verbose) cout << "\nUsing 'MyEnumeration::Value' (with success)."
|
<< endl;
|
{
|
typedef test::MyEnumeration::Value Type;
|
static const struct {
|
int d_lineNum;
|
const char *d_input;
|
Type d_result;
|
} DATA[] = {
|
//line input result
|
//---- ----- ------
|
{ L_, "VALUE1X", test::MyEnumeration::VALUE1, },
|
{ L_, "VALUE2X", test::MyEnumeration::VALUE2, },
|
};
|
const int NUM_DATA = sizeof DATA / sizeof *DATA;
|
for (int i = 0; i < NUM_DATA; ++i) {
|
const int LINE = DATA[i].d_lineNum;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.