Branch Coverage

pl_duk.c
Criterion Covered Total %
branch 147 194 75.7


line true false branch
25 0 392 if (!sv_utf8_decode(ret)) {
43 14 24 ret = get_sv(val ? PL_JSON_BOOLEAN_TRUE : PL_JSON_BOOLEAN_FALSE, 0);
59 35 191 if (duk_is_c_function(ctx, pos)) {
62 3 32 if (duk_get_prop_lstring(ctx, pos, PL_SLOT_GENERIC_CALLBACK, sizeof(PL_SLOT_GENERIC_CALLBACK) - 1)) {
66 80 111 } else if (duk_is_array(ctx, pos)) {
71 3 77 if (answer) {
79 77 0 if (hv_store(seen, kstr, klen, values, 0)) {
85 164 77 for (j = 0; j < array_top; ++j) {
94 162 2 if (exists) {
102 162 2 if (exists) {
103 0 162 if (!nested) {
106 162 0 if (av_store(values_array, j, nested)) {
112 3 108 } else if (duk_is_buffer_data(ctx, pos)) {
122 9 99 if (answer) {
128 99 0 if (hv_store(seen, kstr, klen, values, 0)) {
134 197 99 while (duk_next(ctx, -1, 1)) { /* get key and value */
139 0 197 if (!nested) {
142 197 0 if (hv_store(values_hash, kstr, -klen, nested, 0)) {
175 0 5336 if (SvTYPE(value) >= SVt_PVMG) {
180 5 5331 if (!SvOK(value)) {
182 2 5329 } else if (sv_isa(value, PL_JSON_BOOLEAN_CLASS)) {
185 80 5249 } else if (SvPOK(value)) {
189 4103 1146 } else if (SvIOK(value)) {
191 5 4098 if (ref && (val == 0 || val == 1)) {
3 2 if (ref && (val == 0 || val == 1)) {
2 1 if (ref && (val == 0 || val == 1)) {
196 3 1143 } else if (SvNOK(value)) {
199 1143 0 } else if (SvROK(value)) {
202 15 1128 if (type < SVt_PVAV) {
203 0 15 if (!pl_perl_to_duk_impl(aTHX_ ref, ctx, seen, 1)) {
206 1056 72 } else if (type == SVt_PVAV) {
211 3 1053 if (answer) {
221 1053 0 if (hv_store(seen, kstr, klen, uptr, 0)) {
226 3113 1053 for (j = 0; j <= array_top; ++j) { /* yes, [0, array_top] */
228 3113 0 if (!elem || !*elem) {
3113 0 if (!elem || !*elem) {
231 0 3113 if (!pl_perl_to_duk_impl(aTHX_ *elem, ctx, seen, 0)) {
234 0 3113 if (!duk_put_prop_index(ctx, array_pos, count)) {
240 38 34 } else if (type == SVt_PVHV) {
245 3 35 if (answer) {
252 35 0 if (hv_store(seen, kstr, klen, uptr, 0)) {
263 35 55 if (!entry) {
267 0 55 if (!key) {
271 0 55 if (!kstr) {
276 0 55 if (!value) {
280 0 55 if (!pl_perl_to_duk_impl(aTHX_ value, ctx, seen, 0)) {
283 0 55 if (! duk_put_prop_lstring(ctx, hash_pos, kstr, klen)) {
288 34 0 } else if (type == SVt_PVCV) {
293 33 1 if (skip_func_create==1) {
300 0 1 if (!func) {
304 0 1 if (! duk_put_prop_lstring(ctx, -2, PL_SLOT_GENERIC_CALLBACK, sizeof(PL_SLOT_GENERIC_CALLBACK) - 1)) {
322 29 3000715 if (!seen) {
333 0 2153 if (!seen) {
361 2 3 if (duk_is_array(ctx, pos)) {
364 0 3 else if (duk_is_symbol(ctx, pos)) {
367 0 3 else if (duk_is_pointer(ctx, pos)) {
370 1 2 else if (duk_is_function(ctx, pos)) {
373 0 2 else if (duk_is_c_function(ctx, pos)) {
376 0 2 else if (duk_is_thread(ctx, pos)) {
412 0 41 PUSHMARK(SP);
416 86 41 for (j = 0; j < nargs; j++) {
418 0 86 mXPUSHs(val);
429 41 0 err_tmp = ERRSV;
430 5 36 if (SvTRUE(err_tmp)) {
437 1 4 if (duk->flags & DUK_OPT_FLAG_CATCH_PERL_EXCEPTIONS) {
440 1 0 FREETMPS;
455 36 0 FREETMPS;
464 6036834 1003322 for (; name[l] != '\0'; ++l) {
465 1046 6035788 if (name[l] == '.') {
478 1001164 33 if (last_dot < 0) {
479 1000134 1030 if (duk_get_global_string(ctx, name)) {
486 33 0 if (duk_peval_lstring(ctx, name, last_dot) == 0) {
488 28 5 if (duk_get_prop_lstring(ctx, -1, name + last_dot + 1, len - last_dot - 1)) {
508 30 30 if (find_global_or_property(ctx, name)) {
520 18 2 if (find_global_or_property(ctx, name)) {
533 12 0 if (find_global_or_property(ctx, object)) {
534 9 3 if (find_global_or_property(ctx, class)) {
535 6 3 if (duk_instanceof(ctx, -2, -1)) {
548 1000093 1000 if (find_global_or_property(ctx, name)) {
565 1084 1033 if (SvROK(value)) {
567 33 1051 if (SvTYPE(ref) == SVt_PVCV) {
573 0 33 if (! duk_put_prop_lstring(ctx, -2, PL_SLOT_GENERIC_CALLBACK, sizeof(PL_SLOT_GENERIC_CALLBACK) - 1)) {
581 0 2117 if (pl_perl_to_duk(aTHX_ value, ctx)) {
587 1113 1004 if (last_dot < 0) {
588 0 1113 if (duk_put_global_lstring(ctx, name, len)) {
597 0 1004 if (duk_peval_lstring(ctx, name, last_dot) == 0) {
622 4 4 if (last_dot < 0) {
626 0 4 if (duk_peval_lstring(ctx, name, last_dot) == 0) {
652 2000194 375 if (!file) {
662 0 2000569 if (rc != DUK_EXEC_SUCCESS) {
705 2 1 for (j = 0; j < PL_GC_RUNS; ++j) {
719 205 18 while (duk_next(ctx, -1, 0)) { /* get keys only */
723 205 0 if (av_store(values, count, name)) {
739 0 11 if (!duk_get_prop_lstring(ctx, -1, PL_SLOT_GENERIC_CALLBACK, sizeof(PL_SLOT_GENERIC_CALLBACK) - 1)) {
745 0 11 if (func == 0) {
756 3 0 if (hv_store(hash, key, klen, pval, 0)) {
769 1 0 if (hv_store(hash, key, klen, pval, 0)) {