Branch Coverage

hoedown/src/autolink.c
Criterion Covered Total %
branch 37 112 33.0


line true false branch
22 4 0 for (i = 0; i < valid_uris_count; ++i) {
25 4 0 if (link_len > len &&
2 2 if (link_len > len &&
26 0 2 strncasecmp((char *)link, valid_uris[i], len) == 0 &&
40 21 2 for (i = 0; i < link_end; ++i)
41 0 21 if (data[i] == '<') {
46 2 0 while (link_end > 0) {
47 2 0 if (strchr("?!.,:", data[link_end - 1]) != NULL)
50 0 2 else if (data[link_end - 1] == ';') {
53 0 0 while (new_end > 0 && isalpha(data[new_end]))
0 0 while (new_end > 0 && isalpha(data[new_end]))
56 0 0 if (new_end < link_end - 2 && data[new_end] == '&')
0 0 if (new_end < link_end - 2 && data[new_end] == '&')
64 2 0 if (link_end == 0)
77 0 2 if (copen != 0) {
102 0 0 while (i < link_end) {
103 0 0 if (data[i] == copen)
105 0 0 else if (data[i] == cclose)
111 0 0 if (closing != opening)
123 2 0 if (!isalnum(data[0]))
126 12 1 for (i = 1; i < size - 1; ++i) {
127 2 10 if (strchr(".:", data[i]) != NULL) np++;
128 1 9 else if (!isalnum(data[i]) && data[i] != '-') break;
0 1 else if (!isalnum(data[i]) && data[i] != '-') break;
131 2 0 if (allow_short) {
140 2 0 return np ? i : 0;
155 0 0 if (max_rewind > 0 && !ispunct(data[-1]) && !isspace(data[-1]))
0 0 if (max_rewind > 0 && !ispunct(data[-1]) && !isspace(data[-1]))
158 0 0 if (size < 4 || memcmp(data, "www.", strlen("www.")) != 0)
0 0 if (size < 4 || memcmp(data, "www.", strlen("www.")) != 0)
163 0 0 if (link_end == 0)
166 0 0 while (link_end < size && !isspace(data[link_end]))
0 0 while (link_end < size && !isspace(data[link_end]))
171 0 0 if (link_end == 0)
192 0 0 for (rewind = 0; rewind < max_rewind; ++rewind) {
195 0 0 if (isalnum(c))
198 0 0 if (strchr(".+-_", c) != NULL)
204 0 0 if (rewind == 0)
207 0 0 for (link_end = 0; link_end < size; ++link_end) {
210 0 0 if (isalnum(c))
213 0 0 if (c == '@')
215 0 0 else if (c == '.' && link_end < size - 1)
0 0 else if (c == '.' && link_end < size - 1)
217 0 0 else if (c != '-' && c != '_')
221 0 0 if (link_end < 2 || nb != 1 || np == 0 ||
227 0 0 if (link_end == 0)
247 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] != '/')
250 9 1 while (rewind < max_rewind && isalpha(data[-1 - rewind]))
8 1 while (rewind < max_rewind && isalpha(data[-1 - rewind]))
253 2 0 if (!hoedown_autolink_is_safe(data - rewind, size + rewind))
263 2 0 if (domain_len == 0)
267 3 1 while (link_end < size && !isspace(data[link_end]))
2 1 while (link_end < size && !isspace(data[link_end]))
272 2 0 if (link_end == 0)