Branch Coverage

lib/Apophis.xs
Criterion Covered Total %
branch 158 312 50.6


line true false branch
83 18 11 while ((nread = PerlIO_read(fh, buf, sizeof(buf))) > 0) {
106 0 72 if (id_len < 5)
137 0 20 if (len >= sizeof(buf))
142 400 20 for (p = buf + 1; *p; p++) {
143 60 340 if (*p == '/') {
145 40 20 if (mkdir(buf, 0777) != 0 && errno != EEXIST) {
0 40 if (mkdir(buf, 0777) != 0 && errno != EEXIST) {
153 0 20 if (mkdir(buf, 0777) != 0 && errno != EEXIST) {
0 0 if (mkdir(buf, 0777) != 0 && errno != EEXIST) {
168 0 20 if (len >= sizeof(buf))
173 20 0 if (last_slash) {
195 0 20 if (!fh)
201 0 20 if (written != (SSize_t)content_len) {
206 0 20 if (rename(tmp_path, path) != 0) {
228 0 1 if (!fh)
233 2 1 while ((entry = hv_iternext(meta))) {
247 0 1 if (rename(tmp_path, meta_path) != 0) {
263 1 1 if (stat(meta_path, &st) != 0) return NULL;
266 0 1 if (!fh) return NULL;
269 0 1 if (!buf) { PerlIO_close(fh); return NULL; }
274 0 1 if (nread < 0) { free(buf); return NULL; }
281 2 1 while (p < end) {
284 0 2 if (!line_end) line_end = end;
287 2 0 if (eq) {
308 49 0 if (!svp || !SvOK(*svp))
0 49 if (!svp || !SvOK(*svp))
320 3 65 if (opts) {
322 2 1 if (svp && SvOK(*svp))
2 0 if (svp && SvOK(*svp))
328 66 0 if (svp && SvOK(*svp))
66 0 if (svp && SvOK(*svp))
379 0 0 if (!sv_isobject(self_sv))
384 0 0 if (!SvROK(content_ref_sv))
391 0 0 EXTEND(SP, 1);
429 0 0 if (!sv_isobject(self_sv))
434 0 0 if (!SvROK(content_ref_sv))
452 0 0 if (stat(path, &st) != 0) {
457 0 0 EXTEND(SP, 1);
484 0 0 if (!sv_isobject(self_sv))
494 0 0 EXTEND(SP, 1);
495 0 0 PUSHs(stat(path, &st) == 0 ? &PL_sv_yes : &PL_sv_no);
521 0 0 if (!sv_isobject(self_sv))
531 0 0 EXTEND(SP, 1);
532 0 0 if (stat(path, &st) != 0) {
536 0 0 if (!fh)
545 0 0 if (nread < 0) {
582 0 0 if (!sv_isobject(self_sv))
593 0 0 EXTEND(SP, 1);
595 0 0 if (!fh) {
602 0 0 PUSHs((id_len == HORUS_FMT_STR_LEN &&
0 0 PUSHs((id_len == HORUS_FMT_STR_LEN &&
633 0 0 if (!sv_isobject(self_sv))
650 0 0 EXTEND(SP, 1);
651 0 0 PUSHs(removed ? &PL_sv_yes : &PL_sv_no);
731 0 14 if ((items - 1) % 2 != 0)
735 21 14 for (i = 1; i < items; i += 2) {
737 13 8 if (strEQ(key, "namespace")) {
739 8 0 } else if (strEQ(key, "store_dir")) {
744 1 13 if (!namespace_str)
755 8 5 if (store_dir)
775 0 3 if (!sv_isobject(self))
779 3 0 if (!svp || !SvOK(*svp))
0 3 if (!svp || !SvOK(*svp))
801 0 14 if (!sv_isobject(self))
806 1 13 if (!SvROK(content_ref))
830 0 4 if (!sv_isobject(self))
836 0 4 if (!fh)
865 0 4 if (!sv_isobject(self))
870 0 4 if (items > 2) {
872 0 0 if ((items - 2) % 2 != 0)
876 0 0 for (i = 2; i < items; i += 2) {
917 0 14 if (!sv_isobject(self))
922 0 14 if (!SvROK(content_ref))
928 2 12 if (items > 2) {
930 0 2 if ((items - 2) % 2 != 0)
934 2 2 for (i = 2; i < items; i += 2) {
938 1 1 if (strEQ(k, "meta") && SvROK(v) && SvTYPE(SvRV(v)) == SVt_PVHV) {
1 0 if (strEQ(k, "meta") && SvROK(v) && SvTYPE(SvRV(v)) == SVt_PVHV) {
1 0 if (strEQ(k, "meta") && SvROK(v) && SvTYPE(SvRV(v)) == SVt_PVHV) {
957 13 1 if (stat(path, &st) != 0) {
963 1 13 if (meta) {
995 0 11 if (!sv_isobject(self))
999 1 10 if (items > 2) {
1001 0 1 if ((items - 2) % 2 != 0)
1005 1 1 for (i = 2; i < items; i += 2) {
1018 2 9 if (stat(path, &st) != 0) {
1023 0 9 if (!fh)
1032 0 9 if (nread < 0) {
1062 0 6 if (!sv_isobject(self))
1066 0 6 if (items > 2) {
1068 0 0 if ((items - 2) % 2 != 0)
1072 0 0 for (i = 2; i < items; i += 2) {
1084 4 2 RETVAL = (stat(path, &st) == 0) ? TRUE : FALSE;
1108 0 4 if (!sv_isobject(self))
1112 0 4 if (items > 2) {
1114 0 0 if ((items - 2) % 2 != 0)
1118 0 0 for (i = 2; i < items; i += 2) {
1138 3 1 RETVAL = removed ? TRUE : FALSE;
1163 0 5 if (!sv_isobject(self))
1168 0 5 if (items > 2) {
1170 0 0 if ((items - 2) % 2 != 0)
1174 0 0 for (i = 2; i < items; i += 2) {
1187 1 4 if (!fh) {
1196 4 0 ? TRUE : FALSE;
3 1 ? TRUE : FALSE;
1218 0 1 if (!sv_isobject(self))
1223 1 0 if (!SvROK(refs) || SvTYPE(SvRV(refs)) != SVt_PVAV)
0 1 if (!SvROK(refs) || SvTYPE(SvRV(refs)) != SVt_PVAV)
1228 0 1 if (items > 2) {
1230 0 0 if ((items - 2) % 2 != 0)
1234 0 0 for (j = 2; j < items; j += 2) {
1243 1 0 EXTEND(SP, len);
0 1 EXTEND(SP, len);
1244 3 1 for (i = 0; i < len; i++) {
1254 3 0 if (!svp || !SvROK(*svp))
0 3 if (!svp || !SvROK(*svp))
1268 3 0 if (stat(path, &st) != 0) {
1292 0 1 if (!sv_isobject(self))
1296 1 0 if (!SvROK(ids) || SvTYPE(SvRV(ids)) != SVt_PVAV)
0 1 if (!SvROK(ids) || SvTYPE(SvRV(ids)) != SVt_PVAV)
1301 0 1 if (items > 2) {
1303 0 0 if ((items - 2) % 2 != 0)
1307 0 0 for (j = 2; j < items; j += 2) {
1316 3 1 for (i = 0; i < len; i++) {
1323 3 0 if (!svp || !SvOK(*svp)) continue;
0 3 if (!svp || !SvOK(*svp)) continue;
1329 1 2 if (stat(path, &st) != 0) {
1330 0 1 XPUSHs(sv_2mortal(newSVpvn(id_str, id_len)));
1354 0 2 if (!sv_isobject(self))
1358 0 2 if (items > 2) {
1360 0 0 if ((items - 2) % 2 != 0)
1364 0 0 for (i = 2; i < items; i += 2) {
1380 1 1 if (meta) {
1410 0 2 if (!sv_isobject(self))
1415 0 2 if (!SvROK(content_ref))
1445 0 5 if (!sv_isobject(self))
1450 0 5 if (!SvROK(content_ref))
1463 4 1 if (stat(path, &st) != 0) {
1488 0 6 if (!sv_isobject(self))
1497 3 3 RETVAL = (stat(path, &st) == 0) ? TRUE : FALSE;
1520 0 3 if (!sv_isobject(self))
1529 1 2 if (stat(path, &st) != 0) {
1533 0 2 if (!fh)
1542 0 2 if (nread < 0) {
1573 0 4 if (!sv_isobject(self))
1584 1 3 if (!fh) {
1593 3 0 ? TRUE : FALSE;
3 0 ? TRUE : FALSE;
1616 0 2 if (!sv_isobject(self))
1632 1 1 RETVAL = removed ? TRUE : FALSE;
1647 1 5 if (strEQ(type, "identify")) {
1651 1 4 } else if (strEQ(type, "store")) {
1655 1 3 } else if (strEQ(type, "exists")) {
1659 1 2 } else if (strEQ(type, "fetch")) {
1663 1 1 } else if (strEQ(type, "verify")) {
1667 1 0 } else if (strEQ(type, "remove")) {