Ejemplo n.º 1
0
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);
}
Ejemplo n.º 2
0
void CuFail_Line(CuTest* tc, const char* file, int line,
                 const char* message2, const char* message) {
    char *string = NULL;

	if (message2 != NULL) {
		asprintf_or_die(&string, "%s:%s", message2, message);
	} else {
        string = strdup(message);
    }
	CuFailInternal(tc, file, line, string);
}
Ejemplo n.º 3
0
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);
}
Ejemplo n.º 4
0
void CuAssertStrNotEqual_LineMsg(CuTest* tc, const char* file, int line,
                                 const char* message,
                                 const char* expected, const char* actual) {
	char *string = NULL;

    if (expected != NULL && actual != NULL && strcmp(expected, actual) != 0)
        return;

	if (message != NULL) {
        asprintf_or_die(&string, "%s: expected <%s> but was <%s>", message,
                        expected, actual);
	} else {
        asprintf_or_die(&string, "expected <%s> but was <%s>", expected, actual);
    }
	CuFailInternal(tc, file, line, string);
}