Branch Coverage

Hash.xs
Criterion Covered Total %
branch 136 176 77.2


line true false branch
48 1111 1689 return alen == strlen(b) && memcmp(a, b, alen) == 0;
645 466 return alen == strlen(b) && memcmp(a, b, alen) == 0;
62 1462 1 for (p = VALID_OPT_KEYS; *p; p++) {
63 381 1081 if (str_eq(key, klen, *p)) return 1;
76 0 134 if (!SvOK(sv))
78 0 134 if (SvROK(sv))
82 1 133 if (!info)
100 0 117 if (!opts_hv) croak("File::Raw::Hash: missing options");
104 382 116 while ((he = hv_iternext(opts_hv))) {
110 1 381 if (!known_opt(key, klen)) {
115 101 280 if (str_eq(key, klen, "algo")) algo_sv = val;
116 16 264 else if (str_eq(key, klen, "algos")) algos_sv = val;
117 115 149 else if (str_eq(key, klen, "into")) opts->into = val;
118 9 140 else if (str_eq(key, klen, "format")) fmt_sv = val;
119 16 124 else if (str_eq(key, klen, "hmac_key")) opts->hmac_key_sv = val;
120 7 117 else if (str_eq(key, klen, "xxh64_seed")) seed_sv = val;
125 101 15 if (algo_sv && SvOK(algo_sv) && algos_sv && SvOK(algos_sv))
101 0 if (algo_sv && SvOK(algo_sv) && algos_sv && SvOK(algos_sv))
1 100 if (algo_sv && SvOK(algo_sv) && algos_sv && SvOK(algos_sv))
1 0 if (algo_sv && SvOK(algo_sv) && algos_sv && SvOK(algos_sv))
129 15 100 if (algos_sv && SvOK(algos_sv)) {
15 0 if (algos_sv && SvOK(algos_sv)) {
132 14 1 if (!SvROK(algos_sv) || SvTYPE(SvRV(algos_sv)) != SVt_PVAV)
0 14 if (!SvROK(algos_sv) || SvTYPE(SvRV(algos_sv)) != SVt_PVAV)
136 1 13 if (n < 1)
138 0 13 if (n > MAX_ALGOS)
141 34 13 for (i = 0; i < n; i++) {
143 34 0 if (!slot || !*slot)
0 34 if (!slot || !*slot)
150 100 0 } else if (algo_sv && SvOK(algo_sv)) {
100 0 } else if (algo_sv && SvOK(algo_sv)) {
162 9 103 if (fmt_sv && SvOK(fmt_sv)) {
9 0 if (fmt_sv && SvOK(fmt_sv)) {
165 0 9 if (SvROK(fmt_sv))
168 1 8 if (hash_format_parse(fp, flen, &opts->format) != 0)
177 7 104 if (seed_sv && SvOK(seed_sv)) {
7 0 if (seed_sv && SvOK(seed_sv)) {
178 1 6 if (SvROK(seed_sv))
187 16 94 if (opts->hmac_key_sv && SvOK(opts->hmac_key_sv)) {
16 0 if (opts->hmac_key_sv && SvOK(opts->hmac_key_sv)) {
189 1 15 if (SvROK(opts->hmac_key_sv))
192 18 10 for (j = 0; j < opts->n_ids; j++) {
194 5 13 if (!info->hmac_able)
204 103 1 if (!opts->into || !SvOK(opts->into))
1 102 if (!opts->into || !SvOK(opts->into))
206 1 101 if (!SvROK(opts->into))
209 10 91 if (phase == PHASE_RECORD) {
210 2 8 if (SvTYPE(SvRV(opts->into)) != SVt_PVAV)
216 9 82 if (opts->multi) {
217 1 8 if (SvTYPE(SvRV(opts->into)) != SVt_PVHV)
223 82 0 if (t == SVt_PVAV || t == SVt_PVHV || t == SVt_PVCV
81 1 if (t == SVt_PVAV || t == SVt_PVHV || t == SVt_PVCV
81 0 if (t == SVt_PVAV || t == SVt_PVHV || t == SVt_PVCV
224 81 0 || t == SVt_PVGV || t == SVt_PVFM || t == SVt_PVIO)
81 0 || t == SVt_PVGV || t == SVt_PVFM || t == SVt_PVIO)
0 81 || t == SVt_PVGV || t == SVt_PVFM || t == SVt_PVIO)
239 0 90 if (hash_runner_init(runner, opts->ids, opts->n_ids, opts->format,
243 9 81 if (opts->hmac_key_sv) {
247 0 9 if (hash_runner_set_hmac(runner, kp, (size_t)klen) != 0) {
256 90 0 if (data && len) hash_runner_update(runner, data, len);
68 22 if (data && len) hash_runner_update(runner, data, len);
258 0 90 if (hash_runner_finish(runner, out_results) != 0) {
270 8 81 if (opts->multi) {
272 22 8 for (i = 0; i < opts->n_ids; i++) {
275 22 0 if (opts->format != HF_RAW) SvUTF8_off(val);
282 79 2 if (opts->format != HF_RAW) SvUTF8_off(target);
297 2 6 if (opts->multi) {
299 6 2 for (i = 0; i < opts->n_ids; i++) {
302 6 0 if (opts->format != HF_RAW) SvUTF8_off(val);
309 5 1 if (opts->format != HF_RAW) SvUTF8_off(val);
332 82 0 if (ctx->data && SvOK(ctx->data)) dp = SvPV(ctx->data, dlen);
82 0 if (ctx->data && SvOK(ctx->data)) dp = SvPV(ctx->data, dlen);
339 0 82 if (!ctx->data) return newSVpvn("", 0);
373 8 0 if (record && SvOK(record)) dp = SvPV(record, dlen);
8 0 if (record && SvOK(record)) dp = SvPV(record, dlen);
381 0 8 if (!record) return &PL_sv_undef;
401 7 95 if (!st) {
403 0 7 if (!st) {
409 0 7 if (hash_runner_init(&st->runner, st->opts.ids, st->opts.n_ids,
416 1 6 if (st->opts.hmac_key_sv) {
420 0 1 if (hash_runner_set_hmac(&st->runner, kp, (size_t)klen) != 0) {
432 95 7 if (chunk && len) {
95 0 if (chunk && len) {
436 7 95 if (eof) {
438 0 7 if (hash_runner_finish(&st->runner, &results) != 0) {
490 0 10 if ((items - 1) % 2 != 0)
496 22 10 for (i = 1; i < items; i += 2) {
504 0 8 if (!result) {