Branch Coverage

Shared.xs
Criterion Covered Total %
branch 131 252 51.9


line true false branch
40 0 10 const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL;
0 0 const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL;
3 7 const char *p = (SvGETMAGIC(path), SvOK(path)) ? SvPV_nolen(path) : NULL;
41 3 7 if (p && strlen(p) != (size_t)SvCUR(path))
0 3 if (p && strlen(p) != (size_t)SvCUR(path))
43 0 10 mode_t mode = (items > 4 && (SvGETMAGIC(ST(4)), SvOK(ST(4)))) ? (mode_t)SvUV(ST(4)) : 0600;
0 0 mode_t mode = (items > 4 && (SvGETMAGIC(ST(4)), SvOK(ST(4)))) ? (mode_t)SvUV(ST(4)) : 0600;
0 0 mode_t mode = (items > 4 && (SvGETMAGIC(ST(4)), SvOK(ST(4)))) ? (mode_t)SvUV(ST(4)) : 0600;
0 0 mode_t mode = (items > 4 && (SvGETMAGIC(ST(4)), SvOK(ST(4)))) ? (mode_t)SvUV(ST(4)) : 0600;
44 10 0 if (max_nodes > UINT32_MAX || max_edges > UINT32_MAX)
0 10 if (max_nodes > UINT32_MAX || max_edges > UINT32_MAX)
47 0 10 if (!h) croak("Data::Graph::Shared->new: %s", errbuf);
61 2 0 if (max_nodes > UINT32_MAX || max_edges > UINT32_MAX)
0 2 if (max_nodes > UINT32_MAX || max_edges > UINT32_MAX)
64 0 2 if (!h) croak("Data::Graph::Shared->new_memfd: %s", errbuf);
77 0 1 if (!h) croak("Data::Graph::Shared->new_from_fd: %s", errbuf);
86 0 13 if (!SvROK(self)) return;
88 0 13 if (!h) return;
96 1 0 EXTRACT_GRAPH(self);
0 1 EXTRACT_GRAPH(self);
0 1 EXTRACT_GRAPH(self);
98 0 1 if (graph_msync(h) != 0) croak("msync: %s", strerror(errno));
105 1 0 if (sv_isobject(self_or_class)) {
107 0 1 if (!h) croak("Attempted to use a destroyed object");
110 0 0 if (items < 2) croak("Usage: ...->unlink($path)");
113 0 1 if (!p) croak("cannot unlink anonymous or memfd object");
114 0 1 if (unlink(p) != 0) croak("unlink(%s): %s", p, strerror(errno));
120 2 0 EXTRACT_GRAPH(self);
0 2 EXTRACT_GRAPH(self);
0 2 EXTRACT_GRAPH(self);
122 0 2 RETVAL = h->backing_fd;
130 2 0 EXTRACT_GRAPH(self);
0 2 EXTRACT_GRAPH(self);
0 2 EXTRACT_GRAPH(self);
133 0 2 if (RETVAL < 0) croak("eventfd: %s", strerror(errno));
142 3 0 EXTRACT_GRAPH(self);
0 3 EXTRACT_GRAPH(self);
0 3 EXTRACT_GRAPH(self);
144 3 0 if (h->notify_fd >= 0 && h->notify_fd != fd) close(h->notify_fd);
2 1 if (h->notify_fd >= 0 && h->notify_fd != fd) close(h->notify_fd);
151 5 0 EXTRACT_GRAPH(self);
0 5 EXTRACT_GRAPH(self);
0 5 EXTRACT_GRAPH(self);
153 0 5 RETVAL = h->notify_fd;
161 3 0 EXTRACT_GRAPH(self);
0 3 EXTRACT_GRAPH(self);
0 3 EXTRACT_GRAPH(self);
163 3 0 RETVAL = graph_notify(h);
171 2 0 EXTRACT_GRAPH(self);
0 2 EXTRACT_GRAPH(self);
0 2 EXTRACT_GRAPH(self);
174 2 0 RETVAL = (n >= 0) ? newSViv((IV)n) : &PL_sv_undef;
183 80 0 EXTRACT_GRAPH(self);
0 80 EXTRACT_GRAPH(self);
0 80 EXTRACT_GRAPH(self);
186 80 0 RETVAL = (idx >= 0) ? newSViv((IV)idx) : &PL_sv_undef;
196 11 0 EXTRACT_GRAPH(self);
0 11 EXTRACT_GRAPH(self);
0 11 EXTRACT_GRAPH(self);
198 10 1 int64_t weight = (items > 3) ? (int64_t)SvIV(ST(3)) : 1;
199 10 1 RETVAL = graph_add_edge(h, (uint32_t)src, (uint32_t)dst, weight);
208 2 0 EXTRACT_GRAPH(self);
0 2 EXTRACT_GRAPH(self);
0 2 EXTRACT_GRAPH(self);
210 2 0 RETVAL = graph_remove_node(h, (uint32_t)node);
219 4 0 EXTRACT_GRAPH(self);
0 4 EXTRACT_GRAPH(self);
0 4 EXTRACT_GRAPH(self);
221 3 1 RETVAL = graph_remove_node_full(h, (uint32_t)node);
230 22 0 EXTRACT_GRAPH(self);
0 22 EXTRACT_GRAPH(self);
0 22 EXTRACT_GRAPH(self);
232 10 12 RETVAL = graph_has_node(h, (uint32_t)node);
241 3 0 EXTRACT_GRAPH(self);
0 3 EXTRACT_GRAPH(self);
0 3 EXTRACT_GRAPH(self);
244 3 0 REQUIRE_NODE(h, node);
0 3 REQUIRE_NODE(h, node);
256 2 0 EXTRACT_GRAPH(self);
0 2 EXTRACT_GRAPH(self);
0 2 EXTRACT_GRAPH(self);
259 2 0 REQUIRE_NODE(h, node);
0 2 REQUIRE_NODE(h, node);
269 4 0 EXTRACT_GRAPH(self);
0 4 EXTRACT_GRAPH(self);
0 4 EXTRACT_GRAPH(self);
275 4 0 REQUIRE_NODE(h, node);
0 4 REQUIRE_NODE(h, node);
278 4 0 uint32_t *dsts = deg ? (uint32_t *)malloc(deg * sizeof(uint32_t)) : NULL;
279 4 0 int64_t *wts = deg ? (int64_t *)malloc(deg * sizeof(int64_t)) : NULL;
280 4 0 if (deg && (!dsts || !wts)) {
4 0 if (deg && (!dsts || !wts)) {
0 4 if (deg && (!dsts || !wts)) {
286 8 4 while (eidx != GRAPH_NONE && i < deg) {
8 0 while (eidx != GRAPH_NONE && i < deg) {
287 0 8 if (eidx >= h->hdr->max_edges) break; /* corrupt/attacker edge index: stop */
294 0 4 EXTEND(SP, (SSize_t)i);
295 8 4 for (uint32_t j = 0; j < i; j++) {
308 4 0 EXTRACT_GRAPH(self);
0 4 EXTRACT_GRAPH(self);
0 4 EXTRACT_GRAPH(self);
311 4 0 REQUIRE_NODE(h, node);
0 4 REQUIRE_NODE(h, node);
321 6 0 EXTRACT_GRAPH(self);
0 6 EXTRACT_GRAPH(self);
0 6 EXTRACT_GRAPH(self);
323 0 6 RETVAL = __atomic_load_n(&h->hdr->node_count, __ATOMIC_ACQUIRE);
331 9 0 EXTRACT_GRAPH(self);
0 9 EXTRACT_GRAPH(self);
0 9 EXTRACT_GRAPH(self);
333 0 9 RETVAL = __atomic_load_n(&h->hdr->edge_count, __ATOMIC_ACQUIRE);
341 2 0 EXTRACT_GRAPH(self);
0 2 EXTRACT_GRAPH(self);
0 2 EXTRACT_GRAPH(self);
343 0 2 RETVAL = h->hdr->max_nodes;
351 1 0 EXTRACT_GRAPH(self);
0 1 EXTRACT_GRAPH(self);
0 1 EXTRACT_GRAPH(self);
353 0 1 RETVAL = h->hdr->max_edges;
361 3 0 EXTRACT_GRAPH(self);
0 3 EXTRACT_GRAPH(self);
0 3 EXTRACT_GRAPH(self);
378 2 0 EXTRACT_GRAPH(self);
0 2 EXTRACT_GRAPH(self);
0 2 EXTRACT_GRAPH(self);
380 1 1 RETVAL = h->path ? newSVpv(h->path, 0) : &PL_sv_undef;