Branch Coverage

include/litavis_vars.h
Criterion Covered Total %
branch 187 260 71.9


line true false branch
57 0 498 if (!s) LITAVIS_FATAL("out of memory");
67 0 498 if (!scope) return;
68 64 498 for (i = 0; i < scope->count; i++) {
72 52 446 if (scope->vars) free(scope->vars);
81 14 64 for (i = 0; i < scope->count; i++) {
82 0 14 if (strcmp(scope->vars[i].name, name) == 0) {
89 52 12 if (scope->count >= scope->capacity) {
90 0 52 int new_cap = scope->capacity < 8 ? 8 : scope->capacity * 2;
92 0 52 if (!nv) LITAVIS_FATAL("out of memory");
105 76 4 while (s) {
106 85 4 for (i = 0; i < s->count; i++) {
107 72 13 if (strcmp(s->vars[i].name, name) == 0)
119 0 498 if (!s) LITAVIS_FATAL("out of memory");
128 0 498 if (!store) return;
129 21 498 for (i = 0; i < store->count; i++) {
131 51 21 for (j = 0; j < store->mixins[i].prop_count; j++) {
135 21 0 if (store->mixins[i].props) free(store->mixins[i].props);
137 19 479 if (store->mixins) free(store->mixins);
144 19 2 if (store->count >= store->capacity) {
145 0 19 int new_cap = store->capacity < 4 ? 4 : store->capacity * 2;
147 0 19 if (!nm) LITAVIS_FATAL("out of memory");
155 21 0 m->props = (LitavisProp*)malloc(sizeof(LitavisProp) * (size_t)(prop_count > 0 ? prop_count : 1));
156 0 21 if (!m->props) LITAVIS_FATAL("out of memory");
157 51 21 for (i = 0; i < prop_count; i++) {
165 20 1 for (i = 0; i < store->count; i++) {
166 18 2 if (strcmp(store->mixins[i].name, name) == 0)
176 0 498 if (!s) LITAVIS_FATAL("out of memory");
185 0 498 if (!store) return;
186 21 498 for (i = 0; i < store->count; i++) {
188 51 21 for (j = 0; j < store->maps[i].count; j++) {
192 21 0 if (store->maps[i].entries) free(store->maps[i].entries);
194 19 479 if (store->maps) free(store->maps);
201 19 2 if (store->count >= store->capacity) {
202 0 19 int new_cap = store->capacity < 4 ? 4 : store->capacity * 2;
204 0 19 if (!nm) LITAVIS_FATAL("out of memory");
212 21 0 m->entries = (LitavisMapEntry*)malloc(sizeof(LitavisMapEntry) * (size_t)(count > 0 ? count : 1));
213 0 21 if (!m->entries) LITAVIS_FATAL("out of memory");
214 51 21 for (i = 0; i < count; i++) {
222 11 1 for (i = 0; i < store->count; i++) {
223 11 0 if (strcmp(store->maps[i].name, name) == 0) {
224 20 1 for (j = 0; j < store->maps[i].count; j++) {
225 10 10 if (strcmp(store->maps[i].entries[j].key, key) == 0)
245 211 84 while (*p && bpos < 8100) {
211 0 while (*p && bpos < 8100) {
246 86 125 if (*p == '$') {
250 393 68 while (*name_end && (isalnum((unsigned char)*name_end) || *name_end == '-' || *name_end == '_'))
373 20 while (*name_end && (isalnum((unsigned char)*name_end) || *name_end == '-' || *name_end == '_'))
2 18 while (*name_end && (isalnum((unsigned char)*name_end) || *name_end == '-' || *name_end == '_'))
0 18 while (*name_end && (isalnum((unsigned char)*name_end) || *name_end == '-' || *name_end == '_'))
253 86 0 if (name_end > name_start) {
256 0 86 if (name_len > 255) name_len = 255;
261 11 75 if (*name_end == '{') {
264 67 0 while (*key_end && *key_end != '}')
56 11 while (*key_end && *key_end != '}')
266 11 0 if (*key_end == '}') {
269 0 11 if (key_len > 255) key_len = 255;
273 11 0 char *map_val = maps ? litavis_map_get(maps, name, key) : NULL;
274 10 1 if (map_val) {
276 10 0 if (bpos + vlen < 8192) {
288 72 4 if (var_val) {
290 72 0 if (bpos + vlen < 8192) {
318 64 8 while (*p && count < max_props) {
64 0 while (*p && count < max_props) {
320 547 13 while (*p && (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\r')) p++;
457 90 while (*p && (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\r')) p++;
0 90 while (*p && (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\r')) p++;
39 51 while (*p && (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\r')) p++;
0 51 while (*p && (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\r')) p++;
321 13 51 if (!*p) break;
324 1 50 if (*p == '%') {
327 6 0 while (*p && (isalnum((unsigned char)*p) || *p == '-' || *p == '_'))
5 1 while (*p && (isalnum((unsigned char)*p) || *p == '-' || *p == '_'))
0 1 while (*p && (isalnum((unsigned char)*p) || *p == '-' || *p == '_'))
0 1 while (*p && (isalnum((unsigned char)*p) || *p == '-' || *p == '_'))
331 1 0 while (*p && (*p == ' ' || *p == '\t')) p++;
0 1 while (*p && (*p == ' ' || *p == '\t')) p++;
0 1 while (*p && (*p == ' ' || *p == '\t')) p++;
332 1 0 if (*p == ';') p++;
334 1 0 if (ref_len > 1 && count < max_props) {
1 0 if (ref_len > 1 && count < max_props) {
336 0 1 if (!key) LITAVIS_FATAL("out of memory");
348 379 0 while (*p && *p != ':' && *p != ';') p++;
329 50 while (*p && *p != ':' && *p != ';') p++;
329 0 while (*p && *p != ':' && *p != ';') p++;
349 0 50 if (*p != ':') { if (*p == ';') p++; continue; }
0 0 if (*p != ':') { if (*p == ';') p++; continue; }
353 50 0 while (key_len > 0 && (key_start[key_len - 1] == ' ' || key_start[key_len - 1] == '\t'))
0 50 while (key_len > 0 && (key_start[key_len - 1] == ' ' || key_start[key_len - 1] == '\t'))
0 50 while (key_len > 0 && (key_start[key_len - 1] == ' ' || key_start[key_len - 1] == '\t'))
358 100 0 while (*p && (*p == ' ' || *p == '\t')) p++;
50 50 while (*p && (*p == ' ' || *p == '\t')) p++;
0 50 while (*p && (*p == ' ' || *p == '\t')) p++;
362 339 0 while (*p && *p != ';') p++;
289 50 while (*p && *p != ';') p++;
365 50 0 while (val_len > 0 && (val_start[val_len - 1] == ' ' || val_start[val_len - 1] == '\t'))
0 50 while (val_len > 0 && (val_start[val_len - 1] == ' ' || val_start[val_len - 1] == '\t'))
0 50 while (val_len > 0 && (val_start[val_len - 1] == ' ' || val_start[val_len - 1] == '\t'))
368 50 0 if (key_len > 0) {
371 50 0 if (!key || !val) LITAVIS_FATAL("out of memory");
0 50 if (!key || !val) LITAVIS_FATAL("out of memory");
381 50 0 if (*p == ';') p++;
399 654 211 while (i < ast->count) {
403 64 590 if (rule->selector[0] == '$') {
406 64 0 if (rule->prop_count > 0) {
414 21 569 if (rule->selector[0] == '%' && rule->is_at_rule) {
21 0 if (rule->selector[0] == '%' && rule->is_at_rule) {
416 21 0 if (rule->prop_count > 0) {
424 21 0 if (body_count > 0) {
428 51 21 for (j = 0; j < body_count; j++) {
436 51 21 for (j = 0; j < body_count; j++) {
448 674 569 while (j < rule->prop_count) {
449 0 674 if (rule->props[j].key[0] == '$') {
456 0 0 for (k = j; k < rule->prop_count - 1; k++) {
473 213 211 while (changed && max_passes-- > 0) {
213 0 while (changed && max_passes-- > 0) {
475 69 213 for (i = 0; i < global_scope->count; i++) {
476 3 66 if (strchr(global_scope->vars[i].value, '$')) {
478 3 0 if (strcmp(resolved, global_scope->vars[i].value) != 0) {
491 569 211 for (i = 0; i < ast->count; i++) {
495 718 569 while (j < rule->prop_count) {
497 19 699 if (rule->props[j].key[0] == '%') {
500 18 1 if (mixin && mixin->prop_count > 0) {
18 0 if (mixin && mixin->prop_count > 0) {
504 7 18 for (k = j; k < rule->prop_count - 1; k++) {
511 10 8 if (need > rule->prop_cap) {
514 0 10 if (!np) LITAVIS_FATAL("out of memory");
519 7 18 for (k = rule->prop_count - 1; k >= j; k--) {
523 44 18 for (k = 0; k < mixin->prop_count; k++) {
535 0 1 for (k = j; k < rule->prop_count - 1; k++) {
544 81 618 if (strchr(rule->props[j].value, '$')) {