Branch Coverage

lib/Net/BART/bart.h
Criterion Covered Total %
branch 121 192 63.0


line true false branch
64 863 6 uint64_t mask = (bit == 63) ? ~0ULL : ((1ULL << (bit + 1)) - 1);
71 7 0 return x ? (64 - __builtin_clzll(x)) : 0;
88 0 13 w = a->w[3] & b->w[3]; if (w) return 192 + bitlen64(w) - 1;
89 0 13 w = a->w[2] & b->w[2]; if (w) return 128 + bitlen64(w) - 1;
90 0 13 w = a->w[1] & b->w[1]; if (w) return 64 + bitlen64(w) - 1;
91 7 6 w = a->w[0] & b->w[0]; if (w) return bitlen64(w) - 1;
118 11 1 if (ancestor_tbl_init) return;
119 256 1 for (int idx = 0; idx < 256; idx++) {
121 1793 256 for (int i = idx; i > 0; i >>= 1) {
152 288 571 if (!bs256_test(&s->bits, idx)) return NULL;
159 11 286 if (bs256_test(&s->bits, idx)) {
161 0 11 if (old_val) *old_val = s->items[rank];
168 36 250 if (s->len >= s->cap) {
169 6 30 int newcap = s->cap ? s->cap * 2 : 4;
186 0 1 if (!bs256_test(&s->bits, idx)) return NULL;
260 0 1 return n->prefixes.len == 0 && n->children.len == 0;
0 0 return n->prefixes.len == 0 && n->children.len == 0;
267 7 6 if (top >= 0) {
286 2 2 if (memcmp(leaf->addr, ip, full_bytes) != 0) return 0;
287 0 2 if (remaining) {
289 0 0 if ((leaf->addr[full_bytes] & mask) != (ip[full_bytes] & mask)) return 0;
295 3 3 if (leaf->prefix_len != prefix_len) return 0;
297 2 1 if (memcmp(leaf->addr, addr, full_bytes) != 0) return 0;
299 1 0 if (remaining) {
301 1 0 if ((leaf->addr[full_bytes] & mask) != (addr[full_bytes] & mask)) return 0;
329 0 35 if (!node) return;
331 277 35 for (int i = 0; i < node->children.len; i++) {
335 11 266 if (tag == NODE_BART) {
348 0 12 if (!t) return;
367 1 801 if (prefix_len == 0) {
371 4 797 if (lastbits && depth == strides) {
2 2 if (lastbits && depth == strides) {
376 797 2 if (!lastbits && depth == strides - 1) {
270 527 if (!lastbits && depth == strides - 1) {
384 9 520 if (!tagged) {
393 6 514 if (tag == NODE_LEAF) {
395 0 6 if (leaf_matches_prefix(leaf, addr, prefix_len)) {
396 0 0 if (old_val) *old_val = leaf->value;
407 5 509 if (tag == NODE_FRINGE) {
409 5 0 if (!lastbits && depth == strides - 1) {
0 5 if (!lastbits && depth == strides - 1) {
410 0 0 if (old_val) *old_val = fringe->value;
430 269 1 if (!tagged) {
439 1 0 if (tag == NODE_FRINGE) {
440 1 0 if (old_val) *old_val = ((fringe_node_t*)child)->value;
444 0 0 if (tag == NODE_BART) {
447 0 0 if (tag == NODE_LEAF) {
467 3 15 bart_node_t *root = is_ipv6 ? t->root6 : t->root4;
468 3 15 int max_depth = is_ipv6 ? 16 : 4;
474 43 0 for (int depth = 0; depth < max_depth; depth++) {
481 8 35 if (!tagged) break;
486 6 29 if (tag == NODE_FRINGE) {
490 4 25 if (tag == NODE_LEAF) {
492 2 2 if (leaf_contains_ip(leaf, ip)) {
502 13 3 for (int i = sp - 1; i >= 0; i--) {
505 7 6 if (ok) {
518 0 3 bart_node_t *root = is_ipv6 ? t->root6 : t->root4;
519 0 3 int max_depth = is_ipv6 ? 16 : 4;
522 3 0 for (int depth = 0; depth < max_depth; depth++) {
524 0 3 if (bart_node_lpm_test(node, octet)) return 1;
527 1 2 if (!tagged) return 0;
532 2 0 if (tag == NODE_FRINGE) return 1;
533 0 0 if (tag == NODE_LEAF) return leaf_contains_ip((leaf_node_t*)child, ip);
543 0 3 bart_node_t *root = is_ipv6 ? t->root6 : t->root4;
549 0 3 if (prefix_len == 0) {
556 0 4 if (lastbits && depth == strides) {
0 0 if (lastbits && depth == strides) {
563 4 0 if (!lastbits && depth == strides - 1) {
3 1 if (!lastbits && depth == strides - 1) {
565 1 2 if (!tagged) { *found = 0; return NULL; }
568 1 1 if (tag == NODE_FRINGE) {
572 1 0 if (tag == NODE_BART) {
583 0 1 if (!tagged) { *found = 0; return NULL; }
587 0 1 if (tag == NODE_LEAF) {
588 0 0 if (leaf_matches_prefix((leaf_node_t*)child, addr, prefix_len)) {
595 0 1 if (tag == NODE_FRINGE) { *found = 0; return NULL; }
607 0 2 if (prefix_len == 0) {
613 0 2 if (lastbits && depth == strides) {
0 0 if (lastbits && depth == strides) {
620 2 0 if (!lastbits && depth == strides - 1) {
1 1 if (!lastbits && depth == strides - 1) {
623 0 1 if (!tagged) { *found = 0; return NULL; }
627 1 0 if (tag == NODE_FRINGE) {
634 0 0 if (tag == NODE_BART) {
637 0 0 if (old && bart_node_is_empty(bn)) {
0 0 if (old && bart_node_is_empty(bn)) {
651 0 1 if (!tagged) { *found = 0; return NULL; }
655 0 1 if (tag == NODE_LEAF) {
657 0 0 if (leaf_matches_prefix(leaf, addr, prefix_len)) {
667 0 1 if (tag == NODE_FRINGE) { *found = 0; return NULL; }
671 1 0 if (*found && bart_node_is_empty(bn)) {
0 1 if (*found && bart_node_is_empty(bn)) {
682 0 295 if (sscanf(str, "%d.%d.%d.%d", &a, &b, &c, &d) != 4)
692 2 278 if (rem && full < addr_len) {
2 0 if (rem && full < addr_len) {
696 342 280 for (int i = full; i < addr_len; i++) addr[i] = 0;