Branch Coverage

Moment.xs
Criterion Covered Total %
branch 173 396 43.6


line true false branch
78 19 0 if (memEQ(s, "day", 3))
82 114 0 if (memEQ(s, "year", 4))
84 0 0 if (memEQ(s, "hour", 4))
88 19 9 if (memEQ(s, "month", 5))
90 9 0 if (memEQ(s, "epoch", 5))
94 0 87 if (memEQ(s, "minute", 6))
96 0 87 if (memEQ(s, "second", 6))
98 87 0 if (memEQ(s, "offset", 6))
102 66 3 if (memEQ(s, "lenient", 7))
104 3 0 if (memEQ(s, "reduced", 7))
108 212 0 if (memEQ(s, "precision", 9))
112 9 0 if (memEQ(s, "nanosecond", 10))
124 538 0 str = SvPV_const(sv, len);
135 0 4 if (!SvROK(sv))
138 4 0 if (!SvOBJECT(rv) || !SvSTASH(rv))
0 4 if (!SvOBJECT(rv) || !SvSTASH(rv))
140 1 3 if (!(method = gv_fetchmethod(SvSTASH(rv), name)))
145 0 3 PUSHMARK(SP);
146 0 3 XPUSHs(sv);
150 0 3 if (count != 1)
154 3 0 FREETMPS;
161 1 0 if (sv_isobject(sv)) {
173 0 0 if (swap) {
192 0 64 if (!SvROK(sv))
203 0 23748 SvGETMAGIC(sv);
0 0 SvGETMAGIC(sv);
204 0 23748 if (!SvROK(sv))
207 23748 0 if (!(SvOBJECT(rv) && SvSTASH(rv) && SvPOKp(rv) && SvCUR(rv) == size))
23748 0 if (!(SvOBJECT(rv) && SvSTASH(rv) && SvPOKp(rv) && SvCUR(rv) == size))
23744 4 if (!(SvOBJECT(rv) && SvSTASH(rv) && SvPOKp(rv) && SvCUR(rv) == size))
0 23744 if (!(SvOBJECT(rv) && SvSTASH(rv) && SvPOKp(rv) && SvCUR(rv) == size))
209 0 23744 return (SvSTASH(rv) == stash || sv_derived_from(sv, klass));
0 0 return (SvSTASH(rv) == stash || sv_derived_from(sv, klass));
217 0 1480 SvGETMAGIC(sv);
0 0 SvGETMAGIC(sv);
218 0 1480 if (SvROK(sv)) {
220 0 0 if (SvOBJECT(rv) && SvSTASH(rv))
0 0 if (SvOBJECT(rv) && SvSTASH(rv))
223 1480 0 pv = SvPV_nomg_const(sv, len);
224 1480 0 if (len == namelen && memEQ(pv, name, namelen))
1480 0 if (len == namelen && memEQ(pv, name, namelen))
237 0 23537 if (!THX_sv_isa_moment(aTHX_ sv))
251 0 4 if (THX_sv_isa_moment(aTHX_ sv))
254 3 1 if(!res || !THX_sv_isa_moment(aTHX_ res))
0 3 if(!res || !THX_sv_isa_moment(aTHX_ res))
304 0 3295 if (items < 1)
316 0 8 if (items < 3)
321 8 0 swap = cBOOL(SvTRUE(ST(2)));
0 8 swap = cBOOL(SvTRUE(ST(2)));
0 0 swap = cBOOL(SvTRUE(ST(2)));
0 8 swap = cBOOL(SvTRUE(ST(2)));
0 0 swap = cBOOL(SvTRUE(ST(2)));
0 0 swap = cBOOL(SvTRUE(ST(2)));
8 0 swap = cBOOL(SvTRUE(ST(2)));
8 0 swap = cBOOL(SvTRUE(ST(2)));
8 0 swap = cBOOL(SvTRUE(ST(2)));
0 8 swap = cBOOL(SvTRUE(ST(2)));
0 0 swap = cBOOL(SvTRUE(ST(2)));
0 8 swap = cBOOL(SvTRUE(ST(2)));
0 0 swap = cBOOL(SvTRUE(ST(2)));
0 0 swap = cBOOL(SvTRUE(ST(2)));
0 0 swap = cBOOL(SvTRUE(ST(2)));
0 0 swap = cBOOL(SvTRUE(ST(2)));
0 0 swap = cBOOL(SvTRUE(ST(2)));
0 0 swap = cBOOL(SvTRUE(ST(2)));
0 0 swap = cBOOL(SvTRUE(ST(2)));
323 0 8 if (!sv_isa_moment(svm2))
327 0 8 if (swap) {
342 1 1 if (utc)
356 0 1 if (tm == NULL)
406 0 114 if (((items - 1) % 2) != 0)
409 235 114 for (i = 1; i < items; i += 2) {
411 114 0 case MOMENT_PARAM_YEAR: year = SvIV(ST(i+1)); break;
412 19 0 case MOMENT_PARAM_MONTH: month = SvIV(ST(i+1)); break;
413 19 0 case MOMENT_PARAM_DAY: day = SvIV(ST(i+1)); break;
414 0 0 case MOMENT_PARAM_HOUR: hour = SvIV(ST(i+1)); break;
415 0 0 case MOMENT_PARAM_MINUTE: minute = SvIV(ST(i+1)); break;
416 0 0 case MOMENT_PARAM_SECOND: second = SvIV(ST(i+1)); break;
417 0 0 case MOMENT_PARAM_NANOSECOND: ns = SvIV(ST(i+1)); break;
418 83 0 case MOMENT_PARAM_OFFSET: offset = SvIV(ST(i+1)); break;
451 190 232 if (items == 2) {
452 5 185 if (SvIOK(seconds))
453 5 0 RETVAL = moment_from_epoch(SvI64V(seconds), 0, 0);
455 185 0 RETVAL = moment_from_epoch_nv(SvNV(seconds), precision);
457 14 218 else if (items == 3) {
458 14 0 RETVAL = moment_from_epoch(SvI64V(seconds), SvIV(ST(2)), 0);
14 0 RETVAL = moment_from_epoch(SvI64V(seconds), SvIV(ST(2)), 0);
464 0 218 if ((items % 2) != 0)
467 218 218 for (i = 2; i < items; i += 2) {
473 209 0 precision = SvIV(ST(i+1));
480 9 209 if (nanosecond)
481 9 0 RETVAL = moment_from_epoch(SvI64V(seconds), SvIV(nanosecond), 0);
9 0 RETVAL = moment_from_epoch(SvI64V(seconds), SvIV(nanosecond), 0);
483 0 209 if (SvIOK(seconds))
484 0 0 RETVAL = moment_from_epoch(SvI64V(seconds), 0, 0);
486 209 0 RETVAL = moment_from_epoch_nv(SvNV(seconds), precision);
503 0 266 if ((items % 2) != 0)
507 66 266 for (i = 2; i < items; i += 2) {
508 66 0 switch (sv_moment_param(ST(i))) {
510 66 0 lenient = cBOOL(SvTRUE((ST(i+1))));
0 66 lenient = cBOOL(SvTRUE((ST(i+1))));
0 0 lenient = cBOOL(SvTRUE((ST(i+1))));
0 66 lenient = cBOOL(SvTRUE((ST(i+1))));
0 0 lenient = cBOOL(SvTRUE((ST(i+1))));
0 0 lenient = cBOOL(SvTRUE((ST(i+1))));
66 0 lenient = cBOOL(SvTRUE((ST(i+1))));
66 0 lenient = cBOOL(SvTRUE((ST(i+1))));
66 0 lenient = cBOOL(SvTRUE((ST(i+1))));
66 0 lenient = cBOOL(SvTRUE((ST(i+1))));
66 0 lenient = cBOOL(SvTRUE((ST(i+1))));
66 0 lenient = cBOOL(SvTRUE((ST(i+1))));
0 0 lenient = cBOOL(SvTRUE((ST(i+1))));
0 0 lenient = cBOOL(SvTRUE((ST(i+1))));
0 0 lenient = cBOOL(SvTRUE((ST(i+1))));
0 0 lenient = cBOOL(SvTRUE((ST(i+1))));
0 0 lenient = cBOOL(SvTRUE((ST(i+1))));
0 0 lenient = cBOOL(SvTRUE((ST(i+1))));
0 0 lenient = cBOOL(SvTRUE((ST(i+1))));
516 266 0 str = SvPV_const(string, len);
536 0 672 if ((items % 2) != 0)
544 16 672 for (i = 2; i < items; i += 2) {
547 3 0 precision = SvIV(ST(i+1));
550 0 9 epoch = SvNV(ST(i+1));
553 4 0 if (ix == 0) {
554 4 0 offset = SvIV(ST(i+1));
562 225 447 if (ix == 0) RETVAL = moment_from_rd(jd, epoch, precision, offset);
563 223 224 else if (ix == 1) RETVAL = moment_from_jd(jd, epoch, precision);
604 1 51 if (moment_equals(self, &RETVAL))
606 30 21 if (sv_reusable(ST(0))) {
30 0 if (sv_reusable(ST(0))) {
30 0 if (sv_reusable(ST(0))) {
30 0 if (sv_reusable(ST(0))) {
631 25 534 if (value == 0)
634 4 530 if (sv_reusable(ST(0))) {
4 0 if (sv_reusable(ST(0))) {
4 0 if (sv_reusable(ST(0))) {
0 4 if (sv_reusable(ST(0))) {
659 24 502 if (value == 0)
662 0 502 if (sv_reusable(ST(0))) {
0 0 if (sv_reusable(ST(0))) {
0 0 if (sv_reusable(ST(0))) {
0 0 if (sv_reusable(ST(0))) {
698 0 196 SvGETMAGIC(adjuster);
0 0 SvGETMAGIC(adjuster);
699 196 0 if (SvROK(adjuster))
701 196 0 if (SvTYPE(adjuster) != SVt_PVCV || SvOBJECT(adjuster))
0 196 if (SvTYPE(adjuster) != SVt_PVCV || SvOBJECT(adjuster))
703 0 196 PUSHMARK(SP);
707 0 196 if (count != 1)
709 0 196 if (!sv_isa_moment(ST(0)))
744 24 1435 if (moment_equals(self, &RETVAL))
746 30 1405 if (sv_reusable(ST(0))) {
30 0 if (sv_reusable(ST(0))) {
30 0 if (sv_reusable(ST(0))) {
30 0 if (sv_reusable(ST(0))) {
763 25 18 if (ix == 0)
768 7 36 if (moment_equals(self, &RETVAL))
770 4 32 if (sv_reusable(ST(0))) {
4 0 if (sv_reusable(ST(0))) {
4 0 if (sv_reusable(ST(0))) {
4 0 if (sv_reusable(ST(0))) {
862 0 661 if (((items - 1) % 2) != 0)
865 0 661 for (i = 1; i < items; i += 2) {
866 0 0 switch (sv_moment_param(ST(i))) {
868 0 0 precision = SvIV(ST(i+1));
910 2 0 if (ix == 0)
914 0 2 EXTEND(SP, 3);
929 0 4 if ((items % 2) != 0)
932 0 4 for (i = 2; i < items; i += 2) {
933 0 0 switch (sv_moment_param(ST(i))) {
935 0 0 precision = SvIV(ST(i+1));
941 4 0 if (precision == 9)
963 4 4 XSRETURN_BOOL(v);
969 0 0 XSRETURN_BOOL(moment_is_leap_year(self));
980 634 0 str = SvPV_const(format, len);
982 0 634 if (SvUTF8(format))
993 0 1135 if (((items - 1) % 2) != 0)
997 3 1135 for (i = 1; i < items; i += 2) {
998 3 0 switch (sv_moment_param(ST(i))) {
1000 3 0 reduced = cBOOL(SvTRUE((ST(i+1))));
0 3 reduced = cBOOL(SvTRUE((ST(i+1))));
0 0 reduced = cBOOL(SvTRUE((ST(i+1))));
0 3 reduced = cBOOL(SvTRUE((ST(i+1))));
0 0 reduced = cBOOL(SvTRUE((ST(i+1))));
0 0 reduced = cBOOL(SvTRUE((ST(i+1))));
0 3 reduced = cBOOL(SvTRUE((ST(i+1))));
0 0 reduced = cBOOL(SvTRUE((ST(i+1))));
0 0 reduced = cBOOL(SvTRUE((ST(i+1))));
0 0 reduced = cBOOL(SvTRUE((ST(i+1))));
0 0 reduced = cBOOL(SvTRUE((ST(i+1))));
0 0 reduced = cBOOL(SvTRUE((ST(i+1))));
3 0 reduced = cBOOL(SvTRUE((ST(i+1))));
3 0 reduced = cBOOL(SvTRUE((ST(i+1))));
0 3 reduced = cBOOL(SvTRUE((ST(i+1))));
0 0 reduced = cBOOL(SvTRUE((ST(i+1))));
0 0 reduced = cBOOL(SvTRUE((ST(i+1))));
3 0 reduced = cBOOL(SvTRUE((ST(i+1))));
0 0 reduced = cBOOL(SvTRUE((ST(i+1))));