当前位置: 首页>>代码示例>>C++>>正文


C++ CuStringAppend函数代码示例

本文整理汇总了C++中CuStringAppend函数的典型用法代码示例。如果您正苦于以下问题:C++ CuStringAppend函数的具体用法?C++ CuStringAppend怎么用?C++ CuStringAppend使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CuStringAppend函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CuSuiteDetails

void CuSuiteDetails(CuSuite* testSuite, CuString* details)
{
    int i;
    int failCount = 0;

    if (testSuite->failCount == 0)
    {
        int passCount = testSuite->count - testSuite->failCount;
        const char* testWord = passCount == 1 ? "test" : "tests";
        CuStringAppendFormat(details, "OK (%d %s)\n", passCount, testWord);
    }
    else
    {
        if (testSuite->failCount == 1)
            CuStringAppend(details, "There was 1 failure:\n");
        else
            CuStringAppendFormat(details, "There were %d failures:\n", testSuite->failCount);

        for (i = 0 ; i < testSuite->count ; ++i)
        {
            CuTest* testCase = testSuite->list[i];
            if (testCase->failed)
            {
                failCount++;
                CuStringAppendFormat(details, "%d) %s: %s\n",
                                     failCount, testCase->name, testCase->message);
            }
        }
        CuStringAppend(details, "\n!!!FAILURES!!!\n");

        CuStringAppendFormat(details, "Runs: %d ",   testSuite->count);
        CuStringAppendFormat(details, "Passes: %d ", testSuite->count - testSuite->failCount);
        CuStringAppendFormat(details, "Fails: %d\n",  testSuite->failCount);
    }
}
开发者ID:remysaissy,项目名称:libslds,代码行数:35,代码来源:CuTest.c

示例2: CuSuiteSummary

void CuSuiteSummary(CuSuite *testSuite, CuString *summary) {
    int i;
    for (i = 0; i < testSuite->count; ++i) {
        CuTest *testCase = testSuite->list[i];
        CuStringAppend(summary, testCase->failed ? "F" : ".");
    }
    CuStringAppend(summary, "\n\n");
}
开发者ID:josiahcampbell,项目名称:cis343,代码行数:8,代码来源:CuTest.c

示例3: TestCuStringAppend

void TestCuStringAppend(CuTest* tc)
{
	CuString* str = CuStringNew();
	CuStringAppend(str, "hello");
	CuAssertIntEquals(tc, 5, str->length);
	CuAssertStrEquals(tc, "hello", str->buffer);
	CuStringAppend(str, " world");
	CuAssertIntEquals(tc, 11, str->length);
	CuAssertStrEquals(tc, "hello world", str->buffer);
}
开发者ID:jvbenavi,项目名称:c_prj,代码行数:10,代码来源:CuTestTest.c

示例4: CuFail_Line

void CuFail_Line(CuTest *tc, const char *file, int line, const char *message2, const char *message) {
    CuString string;

    CuStringInit(&string);
    if (message2 != NULL) {
        CuStringAppend(&string, message2);
        CuStringAppend(&string, ": ");
    }
    CuStringAppend(&string, message);
    CuFailInternal(tc, file, line, &string);
}
开发者ID:josiahcampbell,项目名称:cis343,代码行数:11,代码来源:CuTest.c

示例5: TestCuStringAppendNULL

void TestCuStringAppendNULL(CuTest* tc)
{
	CuString* str = CuStringNew();
	CuStringAppend(str, NULL);
	CuAssertIntEquals(tc, 4, str->length);
	CuAssertStrEquals(tc, "NULL", str->buffer);
}
开发者ID:jvbenavi,项目名称:c_prj,代码行数:7,代码来源:CuTestTest.c

示例6: CuStringAppendChar

void CuStringAppendChar(CuString* str, char ch)
{
    char text[2];
    text[0] = ch;
    text[1] = '\0';
    CuStringAppend(str, text);
}
开发者ID:remysaissy,项目名称:libslds,代码行数:7,代码来源:CuTest.c

示例7: CuStringAppendChar

int CuStringAppendChar(CuString* str, char ch, int dump)
{
	char text[2];
	text[0] = ch;
	text[1] = '\0';
	return (CuStringAppend(str, text, dump));
}
开发者ID:galaxyeye,项目名称:bdb,代码行数:7,代码来源:CuTest.c

示例8: CuStringAppendFormat

void CuStringAppendFormat(CuString *str, const char *format, ...) {
    va_list argp;
    char buf[HUGE_STRING_LEN];
    va_start(argp, format);
    vsprintf(buf, format, argp);
    va_end(argp);
    CuStringAppend(str, buf);
}
开发者ID:josiahcampbell,项目名称:cis343,代码行数:8,代码来源:CuTest.c

示例9: CuAssertStrnEquals_LineMsg

void CuAssertStrnEquals_LineMsg(CuTest* tc, const char* file, int line, const char* message,
                                const char* expected, size_t explen,
                                const char* actual)
{
    CuString string;
    if ((explen == 0) ||
        (expected == NULL && actual == NULL) ||
        (expected != NULL && actual != NULL &&
         strncmp(expected, actual, explen) == 0))
    {
        return;
    }

    CuStringInit(&string);
    if (message != NULL)
    {
        CuStringAppend(&string, message);
        CuStringAppend(&string, ": ");
    }
    CuStringAppend(&string, "expected <");
    CuStringAppend(&string, expected);
    CuStringAppend(&string, "> but was <");
    CuStringAppend(&string, actual);
    CuStringAppend(&string, ">");
    CuFailInternal(tc, file, line, &string);
}
开发者ID:KyleSanderson,项目名称:serf,代码行数:26,代码来源:CuTest.c

示例10: CuStringAppendFormat

int CuStringAppendFormat(CuString* str, int dump, const char* format, ...)
{
	va_list argp;
	char buf[HUGE_STRING_LEN];
	va_start(argp, format);
	vsprintf(buf, format, argp);
	va_end(argp);
	return (CuStringAppend(str, buf, dump));
}
开发者ID:galaxyeye,项目名称:bdb,代码行数:9,代码来源:CuTest.c

示例11: CuStringAppendFormat

void CuStringAppendFormat(CuString* str, const char* format, ...)
{
	va_list argp;
	// http://www.eclipse.org/forums/index.php/t/236510/
	char buf[HUGE_STRING_LEN];
	va_start(argp, format);
	vsprintf(buf, format, argp);
	va_end(argp);
	CuStringAppend(str, buf);
}
开发者ID:JulianZ90,项目名称:UTNDDS,代码行数:10,代码来源:CuTest.c

示例12: TestCuStringResizes

void TestCuStringResizes(CuTest* tc)
{
	CuString* str = CuStringNew();
	int i;
	for(i = 0 ; i < STRING_MAX ; ++i)
	{
		CuStringAppend(str, "aa");
	}
	CuAssertTrue(tc, STRING_MAX * 2 == str->length);
	CuAssertTrue(tc, STRING_MAX * 2 <= str->size);
}
开发者ID:jvbenavi,项目名称:c_prj,代码行数:11,代码来源:CuTestTest.c

示例13: CuSuiteSummary

void CuSuiteSummary(CuSuite* testSuite, CuString* summary)
{
	/*
		Dots used to separate test names with status. I want F or P at
		column 60, so there are 59 dots here.
	*/
	static const char spacer []= "...........................................................";
	int i;
	for (i = 0 ; i < testSuite->count ; ++i)
	{
		CuTest* testCase = testSuite->list[i];
		CuStringAppend(summary, testCase->name);

		/* Bad things happen with really long names */
		if (strlen(testCase->name) < sizeof(spacer) * sizeof(char))
		{
			CuStringAppend(summary, spacer + strlen(testCase->name));
		}
		CuStringAppend(summary, testCase->failed ? "F\n" : "P\n");
	}
	CuStringAppend(summary, "\n\n");
}
开发者ID:Chris--B,项目名称:Cprimes,代码行数:22,代码来源:CuTest.c

示例14: TestCuStringInserts

void TestCuStringInserts(CuTest* tc)
{
	CuString* str = CuStringNew();
	CuStringAppend(str, "world");
	CuAssertIntEquals(tc, 5, str->length);
	CuAssertStrEquals(tc, "world", str->buffer);
	CuStringInsert(str, "hell", 0);
	CuAssertIntEquals(tc, 9, str->length);
	CuAssertStrEquals(tc, "hellworld", str->buffer);
	CuStringInsert(str, "o ", 4);
	CuAssertIntEquals(tc, 11, str->length);
	CuAssertStrEquals(tc, "hello world", str->buffer);
	CuStringInsert(str, "!", 11);
	CuAssertIntEquals(tc, 12, str->length);
	CuAssertStrEquals(tc, "hello world!", str->buffer);
}
开发者ID:jvbenavi,项目名称:c_prj,代码行数:16,代码来源:CuTestTest.c

示例15: CuStringConvertCStr

/** \brief Converts c_str(char *) to CuString
 *
 * \param const char* text
 * \return CuString* string with content of c_str
 *
 */
CuString* CuStringConvertCStr(const char* text){
    CuString *str = CuStringNew();
    CuStringAppend(str, text);//NULL is handled by Append
    return str;
}
开发者ID:MonteCarlos,项目名称:Cutest-CC65-Version,代码行数:11,代码来源:CuStringConvertCStr.c


注:本文中的CuStringAppend函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。