Branch Coverage

XS.xs
Criterion Covered Total %
branch 340 404 84.1


line true false branch
88 0 32 PUSHMARK(SP);
94 736 32 for (i = 0; i < TSTR_FORMAT_TYPE_COUNT; i++)
98 704 32 while ((entry = hv_iternext(mapping))) {
100 0 704 const char *key = HePV(entry, klen);
105 0 704 if (fmt == TSTR_FORMAT_UNKNOWN)
110 0 704 if (!rx)
117 32 0 FREETMPS;
123 2 12 if (!SvROK(sv))
127 0 12 if (SvOBJECT(sv))
134 6 43 if (!SvROK(sv))
138 3 40 if (!SvOBJECT(sv))
142 37 3 if ((*method = gv_fetchmethod_autoload (stash, name, 0)))
156 0 30 PUSHMARK(SP);
157 0 30 EXTEND(SP, 2);
165 0 30 if (count != 1)
171 30 0 FREETMPS;
205 152 0 dXSTARG;
216 151 1 if (items < 1 || !(items & 1))
1 150 if (items < 1 || !(items & 1))
221 261 136 for (i = 1; i < items; i += 2) {
235 1 36 if (timezone)
245 4 12 if (!tstr_fetch_method(aTHX_ val, "offset_for_utc", &method))
247 1 11 if (offset != INT_MAX)
256 135 1 if (epoch < MIN_EPOCH || epoch > MAX_EPOCH)
1 134 if (epoch < MIN_EPOCH || epoch > MAX_EPOCH)
259 110 24 if (nanosecond < 0 && SvNOK(ST(0))) {
110 0 if (nanosecond < 0 && SvNOK(ST(0))) {
263 30 80 int scale_exp = (precision >= 0) ? precision : DEFAULT_PRECISION;
270 4 106 if (nanosecond >= NANOS_PER_SECOND) {
276 0 134 if (nanosecond < 0)
279 10 124 if (timezone)
281 89 35 else if (offset == INT_MAX)
284 45 89 if (offset) {
286 44 1 if (local < MIN_EPOCH || local > MAX_EPOCH)
1 43 if (local < MIN_EPOCH || local > MAX_EPOCH)
290 4 128 if (fmt == TSTR_FORMAT_RFC5280) {
291 2 2 fmt = (epoch < EPOCH_20500101) ? TSTR_FORMAT_ASN1UT : TSTR_FORMAT_ASN1GT;
299 41 91 (void)SvUPGRADE(TARG, SVt_PV);
300 57 75 (void)SvGROW(TARG, 30);
41 16 (void)SvGROW(TARG, 30);
304 0 132 if (!tstr_time2str(aTHX_ TARG, &dt, precision, fmt))
306 0 132 PUSHTARG;
321 269 1 if (items < 1 || !(items & 1))
1 268 if (items < 1 || !(items & 1))
324 324 259 for (i = 1; i < items; i += 2) {
343 4 21 if (!tstr_fetch_method(aTHX_ val, "offset_for_local", &method))
348 3 11 if (!tstr_is_hashref(aTHX_ val))
360 11 248 if (parsed.flags & TSTR_PARSED_HAS_TZ_ABBREV) {
362 10 1 if (timezone_map)
364 10 1 if (timezone_map && svp) {
8 2 if (timezone_map && svp) {
366 4 4 if (!tstr_fetch_method(aTHX_ obj, "offset_for_local", &method))
377 26 226 if (!(parsed.flags & TSTR_PARSED_HAS_OFFSET) && !timezone)
6 20 if (!(parsed.flags & TSTR_PARSED_HAS_OFFSET) && !timezone)
387 2 244 if (!(parsed.flags & TSTR_PARSED_HAS_MONTH))
389 5 241 if (!(parsed.flags & TSTR_PARSED_HAS_DAY))
392 0 246 if (parsed.flags & TSTR_PARSED_HAS_MERIDIEM)
409 226 20 if (parsed.flags & TSTR_PARSED_HAS_OFFSET)
414 18 228 if (leap_second) {
425 63 177 if (parsed.flags & TSTR_PARSED_HAS_NANOSECOND) {
426 60 3 int scale_exp = (precision >= 0) ? precision : DEFAULT_PRECISION;
449 784 1 if (items < 1 || !(items & 1))
1 783 if (items < 1 || !(items & 1))
452 779 779 for (i = 1; i < items; i += 2) {
475 4 760 if (GIMME_V == G_ARRAY) {
477 4 0 EXTEND(SP, tstr_parsed_field_count(&parsed) * 2);
0 4 EXTEND(SP, tstr_parsed_field_count(&parsed) * 2);
496 1 81 if (items != 1)
499 6 75 if (!tstr_token_parse_day(src, len, &value))
510 1 25 if (items != 1)
513 4 21 if (!tstr_token_parse_day_name(src, len, &value))
524 1 81 if (items != 1)
527 6 75 if (!tstr_token_parse_month(src, len, &value))
538 1 14 if (items != 1)
541 4 10 if (!tstr_token_parse_meridiem(src, len, &value))
552 1 44 if (items != 1)
555 12 32 if (!tstr_token_parse_tz_offset(src, len, &value))
567 1 25 if (items != 1)
569 14 11 if (tstr_calendar_leap_year((int)SvIV(ST(0))))
578 1 17 if (items != 2)
587 1 43 if (items != 3)
589 23 20 if (tstr_calendar_valid_ymd((int)SvIV(ST(0)), (int)SvIV(ST(1)), (int)SvIV(ST(2))))
598 1 74 if (items != 3)
608 1 30 if (items != 3)
618 1 52 if (items != 2)
622 0 48 EXTEND(SP, 2);
632 1 17 if (items != 1)
635 16 1 if (rdn < TSTR_CALENDAR_RDN_MIN || rdn > TSTR_CALENDAR_RDN_MAX)
1 15 if (rdn < TSTR_CALENDAR_RDN_MIN || rdn > TSTR_CALENDAR_RDN_MAX)
638 0 15 EXTEND(SP, 3);
648 1 32 if (items != 1)
651 31 1 if (rdn < TSTR_CALENDAR_RDN_MIN || rdn > TSTR_CALENDAR_RDN_MAX)
1 30 if (rdn < TSTR_CALENDAR_RDN_MIN || rdn > TSTR_CALENDAR_RDN_MAX)
660 1 58 if (items != 3)
670 1 255 if (items != 4)
676 254 1 if (y < 1 || y > 9999)
1 253 if (y < 1 || y > 9999)
678 252 1 if (m < 1 || m > 12)
1 251 if (m < 1 || m > 12)
680 250 1 if (ord < -4 || ord > 4 || ord == 0)
249 1 if (ord < -4 || ord > 4 || ord == 0)
1 248 if (ord < -4 || ord > 4 || ord == 0)
682 247 1 if (dow < 1 || dow > 7)
1 246 if (dow < 1 || dow > 7)
691 1 21 if (items != 2)
694 20 1 if (year < 0 || year > 99)
1 19 if (year < 0 || year > 99)
706 1 11 if (items != 3)
708 5 6 if (tstr_time_valid_hms((int)SvIV(ST(0)), (int)SvIV(ST(1)), (int)SvIV(ST(2))))
715 1 9 if (items != 3)
717 3 6 if (tstr_time_valid_hms60((int)SvIV(ST(0)), (int)SvIV(ST(1)), (int)SvIV(ST(2))))
726 1 301 if (items != 6)
734 300 1 if (y < 1 || y > 9999)
1 299 if (y < 1 || y > 9999)
736 298 1 if (m < 1 || m > 12)
1 297 if (m < 1 || m > 12)
738 296 1 if (d < 1 || d > tstr_calendar_month_days(y, m))
2 294 if (d < 1 || d > tstr_calendar_month_days(y, m))
740 294 0 if (H < 0 || H > 23)
1 293 if (H < 0 || H > 23)
742 293 0 if (M < 0 || M > 59)
1 292 if (M < 0 || M > 59)
744 292 0 if (S < 0 || S > 59)
1 291 if (S < 0 || S > 59)
758 1 21 if (items != 1)
765 20 1 if (epoch < TSTR_TIME_EPOCH_MIN || epoch > TSTR_TIME_EPOCH_MAX)
1 19 if (epoch < TSTR_TIME_EPOCH_MIN || epoch > TSTR_TIME_EPOCH_MAX)
768 0 19 EXTEND(SP, 9);
785 0 114 if (items != 1)
792 114 0 if (epoch < TSTR_TIME_EPOCH_MIN || epoch > TSTR_TIME_EPOCH_MAX)
0 114 if (epoch < TSTR_TIME_EPOCH_MIN || epoch > TSTR_TIME_EPOCH_MAX)
795 0 114 EXTEND(SP, 1);
803 1 9 if (items != 6)
811 8 1 if (y < -1899 || y > 8099)
1 7 if (y < -1899 || y > 8099)
814 6 1 if (m < 0 || m > 11)
1 5 if (m < 0 || m > 11)
817 5 0 if (d < 1 || d > tstr_calendar_month_days(y, m))
0 5 if (d < 1 || d > tstr_calendar_month_days(y, m))
819 5 0 if (H < 0 || H > 23)
0 5 if (H < 0 || H > 23)
821 5 0 if (M < 0 || M > 59)
0 5 if (M < 0 || M > 59)
823 5 0 if (S < 0 || S > 59)
0 5 if (S < 0 || S > 59)
843 25 2 if (items < 2 || items > 4)
1 24 if (items < 2 || items > 4)
845 23 1 if (!SvROK(ST(0)) || SvTYPE(SvRV(ST(0))) != SVt_PVAV)
0 23 if (!SvROK(ST(0)) || SvTYPE(SvRV(ST(0))) != SVt_PVAV)
851 3 20 lo = (items >= 3) ? SvIV(ST(2)) : 0;
852 3 20 hi = (items >= 4) ? SvIV(ST(3)) : len;
853 23 0 if (lo < 0 || lo > len)
0 23 if (lo < 0 || lo > len)
855 23 0 if (hi < 0 || hi > len)
0 23 if (hi < 0 || hi > len)
857 0 23 if (lo > hi)
861 53 23 while (lo < hi) {
865 53 0 if (elem && SvI64V(*elem) < value)
21 32 if (elem && SvI64V(*elem) < value)
871 18 5 if (lo != hi_orig) {
873 18 0 found = elem && !(value < SvI64V(*elem));
10 8 found = elem && !(value < SvI64V(*elem));
875 10 13 XSRETURN_BOOL(found);
884 27 1 if (items < 2 || items > 4)
0 27 if (items < 2 || items > 4)
886 26 1 if (!SvROK(ST(0)) || SvTYPE(SvRV(ST(0))) != SVt_PVAV)
0 26 if (!SvROK(ST(0)) || SvTYPE(SvRV(ST(0))) != SVt_PVAV)
892 2 24 lo = (items >= 3) ? SvIV(ST(2)) : 0;
893 2 24 hi = (items >= 4) ? SvIV(ST(3)) : len;
894 26 0 if (lo < 0 || lo > len)
0 26 if (lo < 0 || lo > len)
896 26 0 if (hi < 0 || hi > len)
0 26 if (hi < 0 || hi > len)
898 0 26 if (lo > hi)
901 61 26 while (lo < hi) {
905 61 0 if (elem && SvI64V(*elem) < value)
22 39 if (elem && SvI64V(*elem) < value)
920 1 12 if (items != 3)
922 11 1 if (!SvROK(ST(0)) || SvTYPE(SvRV(ST(0))) != SVt_PVAV)
0 11 if (!SvROK(ST(0)) || SvTYPE(SvRV(ST(0))) != SVt_PVAV)
927 1 10 if (min_value > max_value)
933 24 10 while (lo < hi) {
937 24 0 if (elem && SvI64V(*elem) < min_value)
8 16 if (elem && SvI64V(*elem) < min_value)
945 23 3 while (hi < len) {
947 23 0 if (elem && SvI64V(*elem) <= max_value)
16 7 if (elem && SvI64V(*elem) <= max_value)
952 0 10 EXTEND(SP, 2);
963 121 1 if (items < 2 || items > 4)
0 121 if (items < 2 || items > 4)
965 120 1 if (!SvROK(ST(0)) || SvTYPE(SvRV(ST(0))) != SVt_PVAV)
0 120 if (!SvROK(ST(0)) || SvTYPE(SvRV(ST(0))) != SVt_PVAV)
971 2 118 lo = (items >= 3) ? SvIV(ST(2)) : 0;
972 2 118 hi = (items >= 4) ? SvIV(ST(3)) : len;
973 120 0 if (lo < 0 || lo > len)
0 120 if (lo < 0 || lo > len)
975 120 0 if (hi < 0 || hi > len)
0 120 if (hi < 0 || hi > len)
977 0 120 if (lo > hi)
980 259 120 while (lo < hi) {
984 259 0 if (elem && value < SvI64V(*elem))
147 112 if (elem && value < SvI64V(*elem))