Branch Coverage

Shared.xs
Criterion Covered Total %
branch 94 144 65.2


line true false branch
32 5 14 const char *p = SvOK(path) ? SvPV_nolen(path) : NULL;
34 2 17 if (!h) croak("Data::DisjointSet::Shared->new: %s", errbuf);
47 2 1 const char *nm = SvOK(name) ? SvPV_nolen(name) : NULL; /* undef -> default label */
49 1 2 if (!h) croak("Data::DisjointSet::Shared->new_memfd: %s", errbuf);
62 1 1 if (!h) croak("Data::DisjointSet::Shared->new_from_fd: %s", errbuf);
71 22 0 if (sv_isobject(self) && sv_derived_from(self, "Data::DisjointSet::Shared")) {
22 0 if (sv_isobject(self) && sv_derived_from(self, "Data::DisjointSet::Shared")) {
73 20 2 if (h) { sv_setiv(SvRV(self), 0); dsu_destroy(h); } /* null first: activates EXTRACT's use-after-destroy croak + makes a double DESTROY a no-op */
81 3041 0 EXTRACT(self);
0 3041 EXTRACT(self);
1 3040 EXTRACT(self);
84 1 3039 if (x >= h->hdr->n)
101 2014 0 EXTRACT(self);
0 2014 EXTRACT(self);
0 2014 EXTRACT(self);
103 1 2013 if (a >= h->hdr->n)
106 1 2012 if (b >= h->hdr->n)
122 5654 0 EXTRACT(self);
0 5654 EXTRACT(self);
0 5654 EXTRACT(self);
124 1 5653 if (a >= h->hdr->n)
127 1 5652 if (b >= h->hdr->n)
143 10 0 EXTRACT(self);
0 10 EXTRACT(self);
0 10 EXTRACT(self);
147 9 1 if (!SvROK(pairs) || SvTYPE(SvRV(pairs)) != SVt_PVAV)
0 9 if (!SvROK(pairs) || SvTYPE(SvRV(pairs)) != SVt_PVAV)
152 8 1 STRLEN cnt = (top >= 0) ? (STRLEN)(top + 1) : 0, i;
157 1 8 if (cnt & 1)
161 7 1 if (cnt) { /* resolve + range-check ALL before locking */
162 0 7 Newx(vals, cnt, uint32_t); SAVEFREEPV(vals); /* freed on return OR unwind */
163 36 5 for (i = 0; i < cnt; i++) { /* a croak here holds NO lock; SAVEFREEPV cleans up */
165 36 0 UV v = (el && *el) ? SvUV(*el) : 0;
36 0 UV v = (el && *el) ? SvUV(*el) : 0;
166 2 34 if (v >= n)
173 14 6 for (i = 0; i < npairs; i++)
177 0 6 RETVAL = merged;
187 2130 0 EXTRACT(self);
0 2130 EXTRACT(self);
0 2130 EXTRACT(self);
189 1 2129 if (x >= h->hdr->n)
204 2016 0 EXTRACT(self);
0 2016 EXTRACT(self);
0 2016 EXTRACT(self);
216 4 0 EXTRACT(self);
0 4 EXTRACT(self);
0 4 EXTRACT(self);
218 0 4 RETVAL = (UV)h->hdr->n; /* immutable after creation -- lock-free */
226 2 0 EXTRACT(self);
0 2 EXTRACT(self);
0 2 EXTRACT(self);
237 1 0 EXTRACT(self);
0 1 EXTRACT(self);
0 1 EXTRACT(self);
264 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
266 1 2 RETVAL = h->path ? newSVpv(h->path, 0) : &PL_sv_undef;
274 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
276 0 3 RETVAL = h->backing_fd;
284 2 0 EXTRACT(self);
0 2 EXTRACT(self);
0 2 EXTRACT(self);
286 0 2 if (dsu_msync(h) != 0) croak("sync: %s", strerror(errno));
292 1 1 if (sv_isobject(self) && sv_derived_from(self, "Data::DisjointSet::Shared")) {
1 0 if (sv_isobject(self) && sv_derived_from(self, "Data::DisjointSet::Shared")) {
294 1 0 if (h && h->path) unlink(h->path);
1 0 if (h && h->path) unlink(h->path);
295 1 0 } else if (items >= 2 && SvOK(ST(1))) {
1 0 } else if (items >= 2 && SvOK(ST(1))) {