本文整理汇总了C++中CuFail_Line函数的典型用法代码示例。如果您正苦于以下问题:C++ CuFail_Line函数的具体用法?C++ CuFail_Line怎么用?C++ CuFail_Line使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CuFail_Line函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CuAssertPtrEquals_LineMsg
void CuAssertPtrEquals_LineMsg(CuTest *tc, const char *file, int line, const char *message,
void *expected, void *actual) {
char buf[STRING_MAX];
if (expected == actual) return;
sprintf(buf, "expected pointer <0x%p> but was <0x%p>", expected, actual);
CuFail_Line(tc, file, line, message, buf);
}
示例2: CuAssertIntEquals_LineMsg
void CuAssertIntEquals_LineMsg(CuTest *tc, const char *file, int line, const char *message,
int expected, int actual) {
char buf[STRING_MAX];
if (expected == actual) return;
sprintf(buf, "expected <%d> but was <%d>", expected, actual);
CuFail_Line(tc, file, line, message, buf);
}
示例3: CuAssertDblEquals_LineMsg
void CuAssertDblEquals_LineMsg(CuTest* tc, const char* file, int line, const char* message,
double expected, double actual, double delta)
{
char buf[STRING_MAX];
if (fabs(expected - actual) <= delta) return;
sprintf(buf, "expected <%e> but was <%e>", expected, actual);
CuFail_Line(tc, file, line, message, buf);
}
示例4: CuAssertPtrNotEqual_LineMsg
void CuAssertPtrNotEqual_LineMsg(CuTest* tc, const char* file, int line,
const char* message,
const void* expected, const void* actual) {
char buf[STRING_MAX];
if (expected != actual) return;
sprintf(buf, "expected pointer <0x%p> to be different from <0x%p>",
expected, actual);
CuFail_Line(tc, file, line, message, buf);
}
示例5: CuAssert_Line
bool CuAssert_Line (CuTest_t *tc, const char *file, unsigned long int line, const char *message, int condition) {
if (tc) {
++tc->assertCnt;
if (condition) return false;
CuFail_Line (tc, file, line, message, NULL);
return true;
}
return false;
}
示例6: Extended_CuAssertIntArrayEquals_LineMsg
void Extended_CuAssertIntArrayEquals_LineMsg(CuTest* tc, const char* file, int line, const char* message, int* expected, int* actual, int elementCount)
{
int i;
char buf[STRING_MAX];
for(i = 0; i < elementCount; ++i)
{
if(expected[i] != actual[i])
{
sprintf(buf, "Mismatched elements at index [%d]: Expected (%d) but found (%d)", i, expected[i], actual[i]);
CuFail_Line(tc, file, line, message, buf);
}
}
return;
}
示例7: CuAssertGeneralEquals_LineMsg
bool CuAssertGeneralEquals_LineMsg(CuTest_t* tc, const char* file, unsigned long int line, const char* message,
const void *expected, const void *actual, char *expectedStr, char *actualStr, size_t maxStrLen, CuTestCmpFncPtr_t cmpFnc)
{
if (tc){
bool result;
//increase counter for assertions within that test
++tc->assertCnt;
//char *expectedStr=NULL, *actualStr=NULL; //init to NULL to enable tracking of missing ptr assignment
// CuString *cmpmsg = CuStringNew();
//char* buf = (char*)calloc(STRING_MAX, sizeof(char));
//assert (NULL != buf);
//String functions will create new instance if NULL Ptr is passed
//CuString *compResult = CuStringNew();
if ( false == (result = cmpFnc (expected, actual, expectedStr, actualStr, maxStrLen, tc->message/*cmpmsg*/) ) ) {
assert (NULL != expectedStr);
assert (NULL != actualStr);
//sprintf(buf, "expected <%d> but was <%d>", expected, actual);
CuFail_Line (tc, file, line, message, " ");
//CuStringAppend(tc->message, ": ");
//here axctual and expected are exchanged which is reasoned in the va macros used in more deeply nested function
//CuStringAppendISvsNOT(tc->message, "%d", actual, expected);
CuStringAppendISvsNOT(tc->message, "%s", actualStr, expectedStr);
// CuTestAppendMessage(tc, CuStringCStr(cmpmsg));
//return true;
}
//CuStringDelete(compResult);
//free(buf);
//CuStringDelete(cmpmsg);
return !result;
}
return true;
}
示例8: CuAssert_Line
void CuAssert_Line(CuTest* tc, const char* file, int line, const char* message, int condition)
{
if (condition) return;
CuFail_Line(tc, file, line, NULL, message);
}
示例9: CuTestAssertForDb
void CuTestAssertForDb(const char *msg, const char *file, int line)
{
CuFail_Line(NULL, file, line, NULL, msg);
}