Branch Coverage

pl_duk.c
Criterion Covered Total %
branch 160 266 60.1


line true false branch
24 0 366 if (!sv_utf8_decode(ret)) {
42 14 21 ret = get_sv(val ? PL_JSON_BOOLEAN_TRUE : PL_JSON_BOOLEAN_FALSE, 0);
58 31 188 if (duk_is_c_function(ctx, pos)) {
61 3 28 if (duk_get_prop_lstring(ctx, pos, PL_SLOT_GENERIC_CALLBACK, sizeof(PL_SLOT_GENERIC_CALLBACK) - 1)) {
65 77 111 } else if (duk_is_array(ctx, pos)) {
70 3 74 if (answer) {
78 74 0 if (hv_store(seen, kstr, klen, values, 0)) {
84 158 74 for (j = 0; j < array_top; ++j) {
86 0 158 if (!duk_get_prop_index(ctx, pos, j)) {
91 0 158 if (!nested) {
94 158 0 if (av_store(values_array, j, nested)) {
99 3 108 } else if (duk_is_buffer_data(ctx, pos)) {
109 9 99 if (answer) {
115 99 0 if (hv_store(seen, kstr, klen, values, 0)) {
121 181 99 while (duk_next(ctx, -1, 1)) { /* get key and value */
126 0 181 if (!nested) {
129 181 0 if (hv_store(values_hash, kstr, -klen, nested, 0)) {
160 0 5326 if (SvTYPE(value) >= SVt_PVMG) {
165 5 5321 if (!SvOK(value)) {
5 0 if (!SvOK(value)) {
5 0 if (!SvOK(value)) {
167 2 5319 } else if (sv_isa(value, PL_JSON_BOOLEAN_CLASS)) {
168 2 0 int val = SvTRUE(value);
0 2 int val = SvTRUE(value);
0 0 int val = SvTRUE(value);
0 2 int val = SvTRUE(value);
0 0 int val = SvTRUE(value);
0 0 int val = SvTRUE(value);
0 2 int val = SvTRUE(value);
0 0 int val = SvTRUE(value);
0 0 int val = SvTRUE(value);
0 0 int val = SvTRUE(value);
0 0 int val = SvTRUE(value);
0 0 int val = SvTRUE(value);
0 2 int val = SvTRUE(value);
0 0 int val = SvTRUE(value);
0 0 int val = SvTRUE(value);
0 0 int val = SvTRUE(value);
0 0 int val = SvTRUE(value);
0 0 int val = SvTRUE(value);
1 1 int val = SvTRUE(value);
170 1076 4243 } else if (SvPOK(value)) {
172 16 1060 const char* vstr = SvPVutf8(value, vlen);
174 3103 1140 } else if (SvIOK(value)) {
175 3103 0 long val = SvIV(value);
176 5 3098 if (ref && (val == 0 || val == 1)) {
3 2 if (ref && (val == 0 || val == 1)) {
2 1 if (ref && (val == 0 || val == 1)) {
181 3 1137 } else if (SvNOK(value)) {
182 3 0 double val = SvNV(value);
184 1137 0 } else if (SvROK(value)) {
187 15 1122 if (type < SVt_PVAV) {
188 0 15 if (!pl_perl_to_duk_impl(aTHX_ ref, ctx, seen, 1)) {
191 1056 66 } else if (type == SVt_PVAV) {
196 3 1053 if (answer) {
197 0 3 void* ptr = (void*) SvUV(*answer);
206 1053 0 if (hv_store(seen, kstr, klen, uptr, 0)) {
211 3113 1053 for (j = 0; j <= array_top; ++j) { /* yes, [0, array_top] */
213 3113 0 if (!elem || !*elem) {
3113 0 if (!elem || !*elem) {
216 0 3113 if (!pl_perl_to_duk_impl(aTHX_ *elem, ctx, seen, 0)) {
219 0 3113 if (!duk_put_prop_index(ctx, array_pos, count)) {
225 38 28 } else if (type == SVt_PVHV) {
230 3 35 if (answer) {
231 0 3 void* ptr = (void*) SvUV(*answer);
237 35 0 if (hv_store(seen, kstr, klen, uptr, 0)) {
248 35 55 if (!entry) {
252 0 55 if (!key) {
255 4 51 kstr = SvPVutf8(key, klen);
256 0 55 if (!kstr) {
261 0 55 if (!value) {
265 0 55 if (!pl_perl_to_duk_impl(aTHX_ value, ctx, seen, 0)) {
268 0 55 if (! duk_put_prop_lstring(ctx, hash_pos, kstr, klen)) {
273 28 0 } else if (type == SVt_PVCV) {
278 0 28 if (!func) {
282 0 28 if (! duk_put_prop_lstring(ctx, -2, PL_SLOT_GENERIC_CALLBACK, sizeof(PL_SLOT_GENERIC_CALLBACK) - 1)) {
299 26 3000494 if (!seen) {
310 0 2143 if (!seen) {
338 2 3 if (duk_is_array(ctx, pos)) {
341 0 3 else if (duk_is_symbol(ctx, pos)) {
344 0 3 else if (duk_is_pointer(ctx, pos)) {
347 1 2 else if (duk_is_function(ctx, pos)) {
350 0 2 else if (duk_is_c_function(ctx, pos)) {
353 0 2 else if (duk_is_thread(ctx, pos)) {
388 0 35 PUSHMARK(SP);
392 71 35 for (j = 0; j < nargs; j++) {
394 0 71 mXPUSHs(val);
405 35 0 err_tmp = ERRSV;
406 35 0 if (SvTRUE(err_tmp)) {
0 35 if (SvTRUE(err_tmp)) {
0 35 if (SvTRUE(err_tmp)) {
0 0 if (SvTRUE(err_tmp)) {
0 0 if (SvTRUE(err_tmp)) {
35 0 if (SvTRUE(err_tmp)) {
35 0 if (SvTRUE(err_tmp)) {
32 3 if (SvTRUE(err_tmp)) {
0 32 if (SvTRUE(err_tmp)) {
0 0 if (SvTRUE(err_tmp)) {
0 0 if (SvTRUE(err_tmp)) {
0 0 if (SvTRUE(err_tmp)) {
0 0 if (SvTRUE(err_tmp)) {
0 0 if (SvTRUE(err_tmp)) {
0 0 if (SvTRUE(err_tmp)) {
3 32 if (SvTRUE(err_tmp)) {
407 3 0 croak("Perl sub died with error: %s", SvPV_nolen(err_tmp));
417 32 0 FREETMPS;
426 6036729 1003316 for (; name[l] != '\0'; ++l) {
427 1046 6035683 if (name[l] == '.') {
440 1001164 33 if (last_dot < 0) {
441 1000134 1030 if (duk_get_global_string(ctx, name)) {
448 33 0 if (duk_peval_lstring(ctx, name, last_dot) == 0) {
450 28 5 if (duk_get_prop_lstring(ctx, -1, name + last_dot + 1, len - last_dot - 1)) {
470 30 30 if (find_global_or_property(ctx, name)) {
482 18 2 if (find_global_or_property(ctx, name)) {
495 12 0 if (find_global_or_property(ctx, object)) {
496 9 3 if (find_global_or_property(ctx, class)) {
497 6 3 if (duk_instanceof(ctx, -2, -1)) {
510 1000093 1000 if (find_global_or_property(ctx, name)) {
525 0 2111 if (pl_perl_to_duk(aTHX_ value, ctx)) {
531 1107 1004 if (last_dot < 0) {
532 0 1107 if (duk_put_global_lstring(ctx, name, len)) {
541 0 1004 if (duk_peval_lstring(ctx, name, last_dot) == 0) {
561 4 4 if (last_dot < 0) {
565 0 4 if (duk_peval_lstring(ctx, name, last_dot) == 0) {
591 2000088 271 if (!file) {
601 0 2000359 if (rc != DUK_EXEC_SUCCESS) {
644 2 1 for (j = 0; j < PL_GC_RUNS; ++j) {
658 205 18 while (duk_next(ctx, -1, 0)) { /* get keys only */
662 205 0 if (av_store(values, count, name)) {
678 0 11 if (!duk_get_prop_lstring(ctx, -1, PL_SLOT_GENERIC_CALLBACK, sizeof(PL_SLOT_GENERIC_CALLBACK) - 1)) {
684 0 11 if (func == 0) {
695 3 0 if (hv_store(hash, key, klen, pval, 0)) {
708 1 0 if (hv_store(hash, key, klen, pval, 0)) {