Branch Coverage

Shared.xs
Criterion Covered Total %
branch 148 220 67.2


line true false branch
31 6 6 if (a->hdr->bitmap_id < b->hdr->bitmap_id) {
40 6 6 if (a->hdr->bitmap_id < b->hdr->bitmap_id) {
61 7 36 const char *p = SvOK(path) ? SvPV_nolen(path) : NULL;
63 3 40 if (!h) croak("Data::RoaringBitmap::Shared->new: %s", errbuf);
76 2 1 const char *nm = SvOK(name) ? SvPV_nolen(name) : NULL; /* undef -> default label */
78 1 2 if (!h) croak("Data::RoaringBitmap::Shared->new_memfd: %s", errbuf);
91 1 1 if (!h) croak("Data::RoaringBitmap::Shared->new_from_fd: %s", errbuf);
100 45 0 if (sv_isobject(self) && sv_derived_from(self, "Data::RoaringBitmap::Shared")) {
45 0 if (sv_isobject(self) && sv_derived_from(self, "Data::RoaringBitmap::Shared")) {
102 43 2 if (h) { sv_setiv(SvRV(self), 0); rb_destroy(h); } /* null first: activates EXTRACT's use-after-destroy croak + makes a double DESTROY a no-op */
110 44630 0 EXTRACT(self);
0 44630 EXTRACT(self);
0 44630 EXTRACT(self);
115 2 44628 if (x > RB_UINT32_MAX_UV)
120 128 44500 if (rb_buckets(h)[hi].type == RB_TYPE_NONE && rb_avail_slots(h) == 0) {
2 126 if (rb_buckets(h)[hi].type == RB_TYPE_NONE && rb_avail_slots(h) == 0) {
129 44597 29 RETVAL = (IV)added;
138 21 0 EXTRACT(self);
0 21 EXTRACT(self);
0 21 EXTRACT(self);
144 21 0 if (!SvROK(ints) || SvTYPE(SvRV(ints)) != SVt_PVAV)
0 21 if (!SvROK(ints) || SvTYPE(SvRV(ints)) != SVt_PVAV)
149 21 0 Newx(vals, n > 0 ? n : 1, UV);
0 21 Newx(vals, n > 0 ? n : 1, UV);
21 0 Newx(vals, n > 0 ? n : 1, UV);
151 39077 20 for (i = 0; i < n; i++) {
153 39077 0 UV v = (e && SvOK(*e)) ? SvUV(*e) : 0;
39077 0 UV v = (e && SvOK(*e)) ? SvUV(*e) : 0;
154 1 39076 if (v > RB_UINT32_MAX_UV) {
162 39073 19 for (i = 0; i < n; i++) {
164 329 38744 if (rb_buckets(h)[hi].type == RB_TYPE_NONE && rb_avail_slots(h) == 0) {
1 328 if (rb_buckets(h)[hi].type == RB_TYPE_NONE && rb_avail_slots(h) == 0) {
174 4 15 RETVAL = total_added;
183 12786 0 EXTRACT(self);
0 12786 EXTRACT(self);
1 12785 EXTRACT(self);
185 1 12784 if (x > RB_UINT32_MAX_UV) { RETVAL = 0; } /* a value out of range is simply absent */
199 5005 0 EXTRACT(self);
0 5005 EXTRACT(self);
0 5005 EXTRACT(self);
202 1 5004 if (x > RB_UINT32_MAX_UV) { RETVAL = 0; } /* out of range -> nothing to remove */
217 37 0 EXTRACT(self);
0 37 EXTRACT(self);
0 37 EXTRACT(self);
229 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
241 8 0 EXTRACT(self);
0 8 EXTRACT(self);
0 8 EXTRACT(self);
248 7 1 RETVAL = found ? newSVuv((UV)v) : &PL_sv_undef;
256 8 0 EXTRACT(self);
0 8 EXTRACT(self);
0 8 EXTRACT(self);
263 7 1 RETVAL = found ? newSVuv((UV)v) : &PL_sv_undef;
271 20 0 EXTRACT(self);
0 20 EXTRACT(self);
0 20 EXTRACT(self);
284 19 1 if (card) av_extend(av, (SSize_t)card - 1); /* room for indices 0..card-1 */
291 395 0 for (uint32_t hi = 0; hi < RB_NUM_BUCKETS && idx < card; hi++) {
375 20 for (uint32_t hi = 0; hi < RB_NUM_BUCKETS && idx < card; hi++) {
292 7 368 if (bt[hi].type == RB_TYPE_NONE) continue;
293 360 8 if (bt[hi].type == RB_TYPE_ARRAY) {
295 15616 360 for (uint32_t i = 0; i < bt[hi].cardinality && idx < card; i++)
15616 0 for (uint32_t i = 0; i < bt[hi].cardinality && idx < card; i++)
299 5468 5 for (uint32_t w = 0; w < 1024 && idx < card; w++) {
5465 3 for (uint32_t w = 0; w < 1024 && idx < card; w++) {
301 43046 5465 while (word && idx < card) {
43046 0 while (word && idx < card) {
320 11 0 EXTRACT(self);
0 11 EXTRACT(self);
0 11 EXTRACT(self);
322 11 0 if (!sv_isobject(other) || !sv_derived_from(other, "Data::RoaringBitmap::Shared"))
0 11 if (!sv_isobject(other) || !sv_derived_from(other, "Data::RoaringBitmap::Shared"))
326 0 11 if (!o) croak("Attempted to use a destroyed Data::RoaringBitmap::Shared object");
331 9 2 if (o == h || o->hdr->bitmap_id == h->hdr->bitmap_id) {
2 7 if (o == h || o->hdr->bitmap_id == h->hdr->bitmap_id) {
339 1 6 if (rb_avail_slots(h) < need) {
360 8 0 EXTRACT(self);
0 8 EXTRACT(self);
0 8 EXTRACT(self);
362 8 0 if (!sv_isobject(other) || !sv_derived_from(other, "Data::RoaringBitmap::Shared"))
0 8 if (!sv_isobject(other) || !sv_derived_from(other, "Data::RoaringBitmap::Shared"))
366 0 8 if (!o) croak("Attempted to use a destroyed Data::RoaringBitmap::Shared object");
370 6 2 if (o == h || o->hdr->bitmap_id == h->hdr->bitmap_id) {
1 5 if (o == h || o->hdr->bitmap_id == h->hdr->bitmap_id) {
390 1 0 EXTRACT(self);
0 1 EXTRACT(self);
0 1 EXTRACT(self);
401 12 0 EXTRACT(self);
0 12 EXTRACT(self);
0 12 EXTRACT(self);
432 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
434 1 2 RETVAL = h->path ? newSVpv(h->path, 0) : &PL_sv_undef;
442 3 0 EXTRACT(self);
0 3 EXTRACT(self);
0 3 EXTRACT(self);
444 0 3 RETVAL = h->backing_fd;
452 2 0 EXTRACT(self);
0 2 EXTRACT(self);
0 2 EXTRACT(self);
454 0 2 if (rb_msync(h) != 0) croak("sync: %s", strerror(errno));
460 1 1 if (sv_isobject(self) && sv_derived_from(self, "Data::RoaringBitmap::Shared")) {
1 0 if (sv_isobject(self) && sv_derived_from(self, "Data::RoaringBitmap::Shared")) {
462 1 0 if (h && h->path) unlink(h->path);
1 0 if (h && h->path) unlink(h->path);
463 1 0 } else if (items >= 2 && SvOK(ST(1))) {
1 0 } else if (items >= 2 && SvOK(ST(1))) {