|
Classes | |
| class | ut_Group |
| Class that hold identification of particular unit tests, it's used by ut_Basic class. More... | |
| class | ut_Basic |
Defines | |
| #define | ivd_UT_MATCH_X_m(A, B) |
| Different macroes for unit test classes. | |
| #define | ivd_UT_NOTMATCH_X_m(A, B, COMMENT) |
| #define | ivd_UT_MATCH_A_m(A, B) |
| #define | ivd_UT_MATCH_m(A, B) |
| #define | ivd_UT_MATCH_COMM_m(A, B, COMMENT) |
| #define | ivd_UT_COMPARE_m(MEM) |
| #define | ivd_UT_COMPARE_S_m(MEM) |
| #define | ivd_UT_COMPARE_AB_m(A, B) |
| #define | ivd_UT_COMPARE_BC_m(BASE_CLASS) |
| #define | ivd_UT_COMPARE_PTR_VAL_m(TYPE, MEM) |
| #define | ivd_UT_COMPARE_VAL_m(UT_TYPE, MEM) |
| #define | ivd_UT_COMPARE_PTR_m(UT_TYPE, MEM) |
| #define | ivd_UT_COMPARE_ARR_m(TYPE, SIZEO, SIZES, MEM) |
| #define | ivd_UT_COMPARE_VEC_m(TYPE, MEM) |
| #define | ivd_UT_COMPARE_VEC_OF_PTR_m(UT_TYPE, VEC_TYPE, MEM) |
| #define | ut_GROUP_m(_libName, _modName, _header, _text) |
| #define | ut_BELAP_m(_testID, _text, _elapsedTime) |
| Class that hold information about basic (elementary) unit test. | |
| #define | ut_BASIC_m(_testID, _text) |
Functions | |
| IVD_UT_DECL_d Int64_t | Rand (Int64_t to=RAND_MAX, Int64_t from=0) |
| void | ut_CompareHeaderOutput_On () |
| void | ut_CompareHeaderOutput_Off () |
| void | ut_ClassNameComment (const string &a_className) |
Variables | |
| stx_Stream | ut_resultStream_g |
| Stream that store unit result to file "ut_result" on current directory. | |
| ut_Group * | ut_currentUnitTest_p |
| Pointer to current unit test group. | |
| const unsigned int | ut_DESCRIPTION_LEN_c |
| Maximum length of basic test description. | |
| const unsigned int | ut_TESTID_LEN_c |
| Maximum length of basic test identification (testID) concatenate with library name, module name, and test ID. | |
| bool | ut_compareHeaderOutput_g |
| #define ivd_UT_COMPARE_AB_m | ( | A, | |||
| B | ) |
| #define ivd_UT_COMPARE_BC_m | ( | BASE_CLASS | ) |
| #define ivd_UT_COMPARE_m | ( | MEM | ) |
Value:
if (MEM != tObj.MEM) { \ cout << " " << s_className << "::" << #MEM \ << " " << tObj.MEM \ << " != " << MEM << endl; \ ret = false; \ };
| #define ivd_UT_COMPARE_PTR_m | ( | UT_TYPE, | |||
| MEM | ) |
Value:
{ \
if (ut_compareHeaderOutput_g) \
cout << " Compare prt of type " << #UT_TYPE \
<< " " << s_className << "::" << #MEM << endl;\
void *a(MEM); \
void *b(tObj.MEM); \
if ( a == NULL && b != NULL \
|| a != NULL && b == NULL) { \
cout << " " << s_className << "::" << #MEM \
<< " " << tObj.MEM \
<< " != " << MEM << endl; \
ret = false; \
} \
else if (a != NULL) { \
if (!(*static_cast<UT_TYPE*>(MEM) == *tObj.MEM)) { \
ret = false; \
} \
} \
}
| #define ivd_UT_COMPARE_PTR_VAL_m | ( | TYPE, | |||
| MEM | ) |
Value:
{ \
if (ut_compareHeaderOutput_g) \
cout << " Compare prt val " << s_className << "::" << #MEM << endl;\
const TYPE *a = MEM; \
const TYPE *b = tObj.MEM; \
if ( a == NULL && b != NULL \
|| a != NULL && b == NULL) { \
cout << " " << s_className << "::" << #MEM \
<< " " << tObj.MEM \
<< " != " << MEM << endl; \
ret = false; \
} \
else if (a != NULL) { \
if ((*MEM) != *tObj.MEM) { \
cout << " *" << s_className << "::" << #MEM \
<< " " << *tObj.MEM \
<< " != " << *MEM << endl; \
ret = false; \
} \
} \
}
| #define ivd_UT_COMPARE_S_m | ( | MEM | ) |
Value:
if (MEM != tObj.MEM) { \ cout << " " << s_className << "::" << #MEM \ << " '" << tObj.MEM \ << "' != '" << MEM << "'" << endl; \ ret = false; \ };
| #define ivd_UT_COMPARE_VAL_m | ( | UT_TYPE, | |||
| MEM | ) |
Value:
{ \
const UT_TYPE &sam = *static_cast<const UT_TYPE*>(&MEM); \
if (sam != tObj.MEM) { \
cout << " Member(s) of " << s_className << "::" << #MEM \
<< " doesn't match" << endl; \
ret = false; \
} \
}
| #define ivd_UT_MATCH_A_m | ( | A, | |||
| B | ) |
| #define ivd_UT_MATCH_COMM_m | ( | A, | |||
| B, | |||||
| COMMENT | ) |
| #define ivd_UT_MATCH_m | ( | A, | |||
| B | ) |
| #define ivd_UT_MATCH_X_m | ( | A, | |||
| B | ) |
| #define ivd_UT_NOTMATCH_X_m | ( | A, | |||
| B, | |||||
| COMMENT | ) |
| #define ut_BASIC_m | ( | _testID, | |||
| _text | ) |
| #define ut_BELAP_m | ( | _testID, | |||
| _text, | |||||
| _elapsedTime | ) |
Value:
ostringstream sStr; \
sStr << _text; \
ut_Basic basict(_testID, sStr.str(), _elapsedTime);
It use functionality of ut_Group class that is singleton and is instantiate in ut_Group.cpp file as ut_Group_g.
Example:
ut_Group fileioTest("fileio");
{ ut_Basic basict("0002", "Seek end of file");
...
succeed = <some expresion>;
basict.SetStatus(succeed);
}
| #define ut_GROUP_m | ( | _libName, | |||
| _modName, | |||||
| _header, | |||||
| _text | ) |
Definition at line 38 of file ut_Group.cpp.
00038 { 00039 Int64_t diff = to - from + 1; // number of different numbers 00040 return ((Int64_t)rand() * diff) / (RAND_MAX + 1LL) + from; 00041 }
| void ut_ClassNameComment | ( | const string & | a_className | ) |
Definition at line 47 of file ut_Group.cpp.
00047 { 00048 string s(string("Test of class ") + a_className); 00049 cout 00050 << s << endl 00051 << string(s.length(), '=') << endl; 00052 }
| void ut_CompareHeaderOutput_Off | ( | ) |
Definition at line 46 of file ut_Group.cpp.
References ut_compareHeaderOutput_g.
00046 {ut_compareHeaderOutput_g = false;}
| void ut_CompareHeaderOutput_On | ( | ) |
Definition at line 45 of file ut_Group.cpp.
References ut_compareHeaderOutput_g.
00045 {ut_compareHeaderOutput_g = true;}
Definition at line 43 of file ut_Group.cpp.
Referenced by ut_CompareHeaderOutput_Off(), and ut_CompareHeaderOutput_On().
Pointer to current unit test group.
Pointer to current unit test group.
It is used by ut_Basic::Result method to set
Definition at line 60 of file ut_Group.cpp.
Referenced by ut_Basic::Header(), ut_Basic::SetStatus(), ut_Basic::ut_Basic(), and ut_Basic::~ut_Basic().
| const unsigned int ut_DESCRIPTION_LEN_c |
Maximum length of basic test description.
Definition at line 43 of file ut_Basic.cpp.
Referenced by ut_Group::Header(), and ut_Basic::ut_Basic().
Stream that store unit result to file "ut_result" on current directory.
Referenced by ut_Basic::Begin(), ut_Group::Init(), ut_Basic::~ut_Basic(), and ut_Group::~ut_Group().
| const unsigned int ut_TESTID_LEN_c |
Maximum length of basic test identification (testID) concatenate with library name, module name, and test ID.
Definition at line 44 of file ut_Basic.cpp.
Referenced by ut_Group::Header(), and ut_Basic::ut_Basic().
1.5.6