當前位置: 首頁>>代碼示例>>C++>>正文


C++ CuFail_Line函數代碼示例

本文整理匯總了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);
}
開發者ID:josiahcampbell,項目名稱:cis343,代碼行數:7,代碼來源:CuTest.c

示例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);
}
開發者ID:josiahcampbell,項目名稱:cis343,代碼行數:7,代碼來源:CuTest.c

示例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);
}
開發者ID:remysaissy,項目名稱:libslds,代碼行數:8,代碼來源:CuTest.c

示例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);
}
開發者ID:turingmachine,項目名稱:augeas,代碼行數:9,代碼來源:cutest.c

示例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;
}
開發者ID:MonteCarlos,項目名稱:Cutest-CC65-Version,代碼行數:12,代碼來源:CuTestAssertLine.c

示例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;
}
開發者ID:neutrinog,項目名稱:Crest---Tarantula,代碼行數:15,代碼來源:CrestTests.c

示例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;
}
開發者ID:MonteCarlos,項目名稱:Cutest-CC65-Version,代碼行數:36,代碼來源:CuTestAssertGeneralEqualsLineMsg.c

示例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);
}
開發者ID:remysaissy,項目名稱:libslds,代碼行數:5,代碼來源:CuTest.c

示例9: CuTestAssertForDb

void CuTestAssertForDb(const char *msg, const char *file, int line)
{
	CuFail_Line(NULL, file, line, NULL, msg);
}
開發者ID:hyc,項目名稱:BerkeleyDB,代碼行數:4,代碼來源:Runner.c


注:本文中的CuFail_Line函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。