Branch Coverage

src/ldns/util.c
Criterion Covered Total %
branch 44 160 27.5


line true false branch
32 205 20 while (table->name != NULL) {
33 65 140 if (strcasecmp(name, table->name) == 0)
43 282 0 while (table->name != NULL) {
44 46 236 if (table->id == id)
78 0 0 if (bit_nr >= 0 && bit_nr < 8) {
0 0 if (bit_nr >= 0 && bit_nr < 8) {
79 0 0 if (value) {
142 0 0 if (!str || !data) {
0 0 if (!str || !data) {
146 0 0 if (strlen(str) % 2 != 0) {
150 0 0 for (i = 0; i < strlen(str) / 2; i++) {
176 0 2 return LDNS_MOD(year, 4) == 0 && (LDNS_MOD(year, 100) != 0
0 0 return LDNS_MOD(year, 4) == 0 && (LDNS_MOD(year, 100) != 0
0 2 return LDNS_MOD(year, 4) == 0 && (LDNS_MOD(year, 100) != 0
0 0 return LDNS_MOD(year, 4) == 0 && (LDNS_MOD(year, 100) != 0
0 0 return LDNS_MOD(year, 4) == 0 && (LDNS_MOD(year, 100) != 0
0 0 return LDNS_MOD(year, 4) == 0 && (LDNS_MOD(year, 100) != 0
0 0 return LDNS_MOD(year, 4) == 0 && (LDNS_MOD(year, 100) != 0
177 0 0 || LDNS_MOD(year, 400) == 0);
0 0 || LDNS_MOD(year, 400) == 0);
185 0 2 return (LDNS_DIV(y2, 4) - LDNS_DIV(y1, 4)) -
0 2 return (LDNS_DIV(y2, 4) - LDNS_DIV(y1, 4)) -
186 0 2 (LDNS_DIV(y2, 100) - LDNS_DIV(y1, 100)) +
0 2 (LDNS_DIV(y2, 100) - LDNS_DIV(y1, 100)) +
187 0 2 (LDNS_DIV(y2, 400) - LDNS_DIV(y1, 400));
0 2 (LDNS_DIV(y2, 400) - LDNS_DIV(y1, 400));
203 20 2 for (i = 0; i < tm->tm_mon; ++i) {
206 2 0 if (tm->tm_mon > 1 && is_leap_year(year)) {
0 2 if (tm->tm_mon > 1 && is_leap_year(year)) {
339 0 0 if (size < (unsigned int) sizeof(seed_i)){
344 0 0 if(!seed) {
348 0 0 if (!fd) {
349 0 0 if ((rand_f = fopen("/dev/urandom", "r")) == NULL) {
351 0 0 if ((rand_f = fopen("/dev/random", "r")) == NULL) {
354 0 0 for (read = 0; read < size; read++) {
369 0 0 if (read < size) {
371 0 0 if (!fd) fclose(rand_f);
388 0 0 if (!fd) {
389 0 0 if (rand_f) fclose(rand_f);
404 0 51 if (RAND_bytes((unsigned char*)&rid, 2) != 1) {
428 0 0 if(!retval) return NULL;
430 0 0 for (i = 0; i < rounds; i++) {
432 0 0 if ((i + 1 < rounds) || (len % 2 != 0)) {
0 0 if ((i + 1 < rounds) || (len % 2 != 0)) {
441 0 0 if ((i + 1) < rounds) {
493 2 0 const char* b32 = extended_hex ? "0123456789abcdefghijklmnopqrstuv"
502 2 0 : ldns_b32_ntop_calculate_size_no_padding(src_sz);
505 0 2 if (dst_sz < ret_sz + 1)
512 8 2 while (src_sz >= 5) {
568 2 0 if (add_padding) {
621 8 2 while (src_sz) {
623 64 8 for (i = 0; i < 8; i++) {
629 0 64 } while (isspace(ch) && src_sz > 0);
0 0 } while (isspace(ch) && src_sz > 0);
631 64 0 if (ch == '=' || ch == '\0')
64 0 if (ch == '=' || ch == '\0')
634 64 0 else if (extended_hex)
636 64 0 if (ch >= '0' && ch <= '9')
21 43 if (ch >= '0' && ch <= '9')
638 0 43 else if (ch >= 'a' && ch <= 'v')
0 0 else if (ch >= 'a' && ch <= 'v')
640 43 0 else if (ch >= 'A' && ch <= 'V')
43 0 else if (ch >= 'A' && ch <= 'V')
645 0 0 else if (ch >= 'a' && ch <= 'z')
0 0 else if (ch >= 'a' && ch <= 'z')
647 0 0 else if (ch >= 'A' && ch <= 'Z')
0 0 else if (ch >= 'A' && ch <= 'Z')
649 0 0 else if (ch >= '2' && ch <= '7')
0 0 else if (ch >= '2' && ch <= '7')
655 0 8 if (i < 8)
659 0 8 if (dst_sz < 5)
688 2 0 if (i > 0 && i < 8) {
0 2 if (i > 0 && i < 8) {
691 0 0 if (dst_sz < (i + 1) / 2)
720 0 0 if (check_padding) {
722 0 0 if (ch != '=')
726 0 0 for (i = 8 - i - 1; i > 0; i--) {
729 0 0 if (src_sz == 0)
734 0 0 } while (isspace(ch));
736 0 0 if (ch != '=')