MCPcopy Create free account
hub / github.com/JuliaStrings/utf8proc / testbytes

Function testbytes

test/iterate.c:11–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9#define CHECKINVALID(pos, val, len) buf[pos] = val; testbytes(buf,len,UTF8PROC_ERROR_INVALIDUTF8,__LINE__)
10
11static void testbytes(utf8proc_uint8_t *buf, utf8proc_ssize_t len, utf8proc_ssize_t retval, int line)
12{
13 utf8proc_int32_t out[16];
14 utf8proc_ssize_t ret;
15
16 /* Make a copy to ensure that memory is left uninitialized after "len"
17 * bytes. This way, Valgrind can detect overreads.
18 */
19 utf8proc_uint8_t tmp[16];
20 memcpy(tmp, buf, (unsigned long int)len);
21
22 tests++;
23 if ((ret = utf8proc_iterate(tmp, len, out)) != retval) {
24 fprintf(stderr, "Failed (%d):", line);
25 for (utf8proc_ssize_t i = 0; i < len ; i++) {
26 fprintf(stderr, " 0x%02x", tmp[i]);
27 }
28 fprintf(stderr, " -> %zd\n", ret);
29 error++;
30 }
31}
32
33int main(int argc, char **argv)
34{

Callers

nothing calls this directly

Calls 1

utf8proc_iterateFunction · 0.85

Tested by

no test coverage detected