MCPcopy Index your code
hub / github.com/git/git / test_function

Function test_function

t/helper/test-path-utils.c:67–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67static int test_function(struct test_data *data, char *(*func)(char *input),
68 const char *funcname)
69{
70 int failed = 0, i;
71 char buffer[1024];
72 char *to;
73
74 for (i = 0; data[i].to; i++) {
75 if (!data[i].from)
76 to = func(NULL);
77 else {
78 xsnprintf(buffer, sizeof(buffer), "%s", data[i].from);
79 to = func(buffer);
80 }
81 if (!strcmp(to, data[i].to))
82 continue;
83 if (!data[i].alternative)
84 error("FAIL: %s(%s) => '%s' != '%s'",
85 funcname, data[i].from, to, data[i].to);
86 else if (!strcmp(to, data[i].alternative))
87 continue;
88 else
89 error("FAIL: %s(%s) => '%s' != '%s', '%s'",
90 funcname, data[i].from, to, data[i].to,
91 data[i].alternative);
92 failed = 1;
93 }
94 return failed;
95}
96
97static struct test_data basename_data[] = {
98 /* --- POSIX type paths --- */

Callers 1

cmd__path_utilsFunction · 0.85

Calls 2

xsnprintfFunction · 0.85
errorFunction · 0.85

Tested by

no test coverage detected