24
24
* Originally obtained from "http://cutest.sourceforge.net/" version 1.4.
26
* Modified for serf as follows
27
* 1) added CuStringFree(), CuTestFree(), CuSuiteFree(), and
29
* 0) reformatted the whitespace (doh!)
26
* See CuTest.h for a list of serf-specific modifications.
31
28
#include <assert.h>
32
29
#include <setjmp.h>
205
210
CuFail_Line(tc, file, line, NULL, message);
213
void CuAssertStrnEquals_LineMsg(CuTest* tc, const char* file, int line, const char* message,
214
const char* expected, size_t explen,
219
(expected == NULL && actual == NULL) ||
220
(expected != NULL && actual != NULL &&
221
strncmp(expected, actual, explen) == 0))
226
CuStringInit(&string);
229
CuStringAppend(&string, message);
230
CuStringAppend(&string, ": ");
232
CuStringAppend(&string, "expected <");
233
CuStringAppend(&string, expected);
234
CuStringAppend(&string, "> but was <");
235
CuStringAppend(&string, actual);
236
CuStringAppend(&string, ">");
237
CuFailInternal(tc, file, line, &string);
208
240
void CuAssertStrEquals_LineMsg(CuTest* tc, const char* file, int line, const char* message,
209
241
const char* expected, const char* actual)
227
259
CuStringAppend(&string, "> but was <");
228
260
CuStringAppend(&string, actual);
229
261
CuStringAppend(&string, ">");
230
CuFailInternal(tc, file, line, &string);
262
CuFailInternal(tc, file, line, &string);}
233
264
void CuAssertIntEquals_LineMsg(CuTest* tc, const char* file, int line, const char* message,
234
265
int expected, int actual)
296
329
assert(testSuite->count < MAX_TEST_CASES);
297
330
testSuite->list[testSuite->count] = testCase;
298
331
testSuite->count++;
333
/* CuSuiteAdd is called twice per test, don't reset the callbacks if
335
if (!testCase->setup)
336
testCase->setup = testSuite->setup;
337
if (!testCase->teardown)
338
testCase->teardown = testSuite->teardown;
301
341
void CuSuiteAddSuite(CuSuite* testSuite, CuSuite* testSuite2)
365
405
CuStringAppendFormat(details, "Fails: %d\n", testSuite->failCount);
409
void CuSuiteSetSetupTeardownCallbacks(CuSuite* testSuite, TestCallback setup,
410
TestCallback teardown)
412
testSuite->setup = setup;
413
testSuite->teardown = teardown;
b'\\ No newline at end of file'