MCPcopy Index your code
hub / github.com/F-Stack/f-stack / testit

Function testit

tools/libutil/tests/trimdomain_test.c:60–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60void
61testit(const char *input, int hostsize, const char *output, const char *test)
62{
63 char *testhost;
64 const char *expected = (output == NULL) ? input : output;
65
66 testhost = strdup(input);
67 trimdomain(testhost, hostsize < 0 ? (int)strlen(testhost) : hostsize);
68 tests++;
69 if (strcmp(testhost, expected) != 0) {
70 printf("not ok %d - %s\n", tests, test);
71 printf("# %s -> %s (expected %s)\n", input, testhost, expected);
72 } else
73 printf("ok %d - %s\n", tests, test);
74 free(testhost);
75 return;
76}
77
78int
79main(void)

Callers 1

mainFunction · 0.70

Calls 5

strdupFunction · 0.85
trimdomainFunction · 0.85
strcmpFunction · 0.85
printfFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected