Branch Coverage

include/litavis_ast.h
Criterion Covered Total %
branch 100 124 80.6


line true false branch
66 101421 10366 while (*key)
76 0 19557 if (!dup) LITAVIS_FATAL("out of memory");
101 3441 0 if (rule->selector) free(rule->selector);
102 59 3382 if (rule->at_prelude) free(rule->at_prelude);
103 86 3355 if (rule->source_file) free(rule->source_file);
104 3947 3441 for (i = 0; i < rule->prop_count; i++) {
108 3153 288 if (rule->props) free(rule->props);
109 84 3441 for (i = 0; i < rule->child_count; i++) {
112 71 3370 if (rule->children) free(rule->children);
119 64568 1943 for (i = 0; i < ast->bucket_count; i++) {
121 6204 64568 while (b) {
137 0 6204 if (!b) LITAVIS_FATAL("out of memory");
150 0 16 if (!new_buckets) LITAVIS_FATAL("out of memory");
153 1504 16 for (i = 0; i < ast->bucket_count; i++) {
155 1144 1504 while (b) {
172 0 1686 if (!ast) LITAVIS_FATAL("out of memory");
174 595 1091 if (initial_capacity < 8) initial_capacity = 8;
182 1686 0 if (!ast->rules || !ast->buckets) LITAVIS_FATAL("out of memory");
0 1686 if (!ast->rules || !ast->buckets) LITAVIS_FATAL("out of memory");
188 0 1686 if (!ast) return;
189 3186 1686 for (i = 0; i < ast->count; i++) {
204 590 0 if (src->selector) dst->selector = litavis_strdup(src->selector);
205 11 579 if (src->at_prelude) dst->at_prelude = litavis_strdup(src->at_prelude);
206 17 573 if (src->source_file) dst->source_file = litavis_strdup(src->source_file);
210 579 11 if (src->prop_count > 0) {
214 0 579 if (!dst->props) LITAVIS_FATAL("out of memory");
215 691 579 for (i = 0; i < src->prop_count; i++) {
221 8 582 if (src->child_count > 0) {
225 0 8 if (!dst->children) LITAVIS_FATAL("out of memory");
226 10 8 for (i = 0; i < src->child_count; i++) {
235 0 177 if (!ast) return NULL;
237 580 177 for (i = 0; i < ast->count; i++) {
251 534 2795 while (b) {
252 223 311 if (strcmp(b->key, selector) == 0)
267 33 2777 if (existing) return existing;
270 16 2761 if (ast->count >= ast->capacity) {
273 0 16 if (!new_rules) LITAVIS_FATAL("out of memory");
279 16 2761 if (ast->count * 4 > ast->bucket_count * 3) {
296 171 0 if (index < 0 || index >= ast->count) return;
0 171 if (index < 0 || index >= ast->count) return;
302 1339 171 for (i = index; i < ast->count - 1; i++) {
311 0 171 if (!ast->buckets) LITAVIS_FATAL("out of memory");
312 1442 171 for (i = 0; i < ast->count; i++) {
320 86 0 if (index < 0 || index >= ast->count) return;
0 86 if (index < 0 || index >= ast->count) return;
329 0 86 if (!ast->buckets) LITAVIS_FATAL("out of memory");
330 1405 86 for (i = 0; i < ast->count; i++) {
341 1323 3231 for (i = 0; i < rule->prop_count; i++) {
342 24 1299 if (strcmp(rule->props[i].key, key) == 0) {
350 2583 648 if (rule->prop_count >= rule->prop_cap) {
351 9 2574 int new_cap = rule->prop_cap < 4 ? 4 : rule->prop_cap * 2;
353 0 2583 if (!new_props) LITAVIS_FATAL("out of memory");
365 196 3 for (i = 0; i < rule->prop_count; i++) {
366 132 64 if (strcmp(rule->props[i].key, key) == 0)
379 63 11 if (rule->child_count >= rule->child_cap) {
380 0 63 int new_cap = rule->child_cap < 4 ? 4 : rule->child_cap * 2;
382 0 63 if (!new_children) LITAVIS_FATAL("out of memory");
397 1 1 if (a->prop_count != b->prop_count) return 0;
398 2 1 for (i = 0; i < a->prop_count; i++) {
399 0 2 if (strcmp(a->props[i].key, b->props[i].key) != 0) return 0;
400 0 2 if (strcmp(a->props[i].value, b->props[i].value) != 0) return 0;
408 1092 887 for (i = 0; i < src->prop_count; i++) {