Branch Coverage

hoedown/src/autolink.c
Criterion Covered Total %
branch 36 112 32.1


line true false branch
24 2 0 for (i = 0; i < valid_uris_count; ++i) {
27 2 0 if (size > len &&
2 0 if (size > len &&
28 0 2 strncasecmp((char *)data, valid_uris[i], len) == 0 &&
42 21 2 for (i = 0; i < link_end; ++i)
43 0 21 if (data[i] == '<') {
48 2 0 while (link_end > 0) {
49 2 0 if (strchr("?!.,:", data[link_end - 1]) != NULL)
52 0 2 else if (data[link_end - 1] == ';') {
55 0 0 while (new_end > 0 && isalpha(data[new_end]))
0 0 while (new_end > 0 && isalpha(data[new_end]))
58 0 0 if (new_end < link_end - 2 && data[new_end] == '&')
0 0 if (new_end < link_end - 2 && data[new_end] == '&')
66 2 0 if (link_end == 0)
79 0 2 if (copen != 0) {
104 0 0 while (i < link_end) {
105 0 0 if (data[i] == copen)
107 0 0 else if (data[i] == cclose)
113 0 0 if (closing != opening)
125 2 0 if (!isalnum(data[0]))
128 12 1 for (i = 1; i < size - 1; ++i) {
129 2 10 if (strchr(".:", data[i]) != NULL) np++;
130 1 9 else if (!isalnum(data[i]) && data[i] != '-') break;
0 1 else if (!isalnum(data[i]) && data[i] != '-') break;
133 2 0 if (allow_short) {
142 2 0 return np ? i : 0;
157 0 0 if (max_rewind > 0 && !ispunct(data[-1]) && !isspace(data[-1]))
0 0 if (max_rewind > 0 && !ispunct(data[-1]) && !isspace(data[-1]))
160 0 0 if (size < 4 || memcmp(data, "www.", strlen("www.")) != 0)
0 0 if (size < 4 || memcmp(data, "www.", strlen("www.")) != 0)
165 0 0 if (link_end == 0)
168 0 0 while (link_end < size && !isspace(data[link_end]))
0 0 while (link_end < size && !isspace(data[link_end]))
173 0 0 if (link_end == 0)
194 0 0 for (rewind = 0; rewind < max_rewind; ++rewind) {
197 0 0 if (isalnum(c))
200 0 0 if (strchr(".+-_", c) != NULL)
206 0 0 if (rewind == 0)
209 0 0 for (link_end = 0; link_end < size; ++link_end) {
212 0 0 if (isalnum(c))
215 0 0 if (c == '@')
217 0 0 else if (c == '.' && link_end < size - 1)
0 0 else if (c == '.' && link_end < size - 1)
219 0 0 else if (c != '-' && c != '_')
223 0 0 if (link_end < 2 || nb != 1 || np == 0 ||
229 0 0 if (link_end == 0)
249 2 0 if (size < 4 || data[1] != '/' || data[2] != '/')
2 0 if (size < 4 || data[1] != '/' || data[2] != '/')
2 0 if (size < 4 || data[1] != '/' || data[2] != '/')
252 9 1 while (rewind < max_rewind && isalpha(data[-1 - rewind]))
8 1 while (rewind < max_rewind && isalpha(data[-1 - rewind]))
255 2 0 if (!hoedown_autolink_is_safe(data - rewind, size + rewind))
265 2 0 if (domain_len == 0)
269 3 1 while (link_end < size && !isspace(data[link_end]))
2 1 while (link_end < size && !isspace(data[link_end]))
274 2 0 if (link_end == 0)