Branch Coverage

pl_duk.c
Criterion Covered Total %
branch 153 258 59.3


line true false branch
32 14 21 ret = get_sv(val ? PL_JSON_BOOLEAN_TRUE : PL_JSON_BOOLEAN_FALSE, 0);
49 31 179 if (duk_is_c_function(ctx, pos)) {
52 3 28 if (duk_get_prop_lstring(ctx, pos, PL_SLOT_GENERIC_CALLBACK, sizeof(PL_SLOT_GENERIC_CALLBACK) - 1)) {
56 74 105 } else if (duk_is_array(ctx, pos)) {
61 3 71 if (answer) {
69 71 0 if (hv_store(seen, kstr, klen, values, 0)) {
75 146 71 for (j = 0; j < array_top; ++j) {
77 0 146 if (!duk_get_prop_index(ctx, pos, j)) {
82 0 146 if (!nested) {
85 146 0 if (av_store(values_array, j, nested)) {
95 9 96 if (answer) {
101 96 0 if (hv_store(seen, kstr, klen, values, 0)) {
107 178 96 while (duk_next(ctx, -1, 1)) { /* get key and value */
112 0 178 if (!nested) {
115 178 0 if (hv_store(values_hash, kstr, -klen, nested, 0)) {
146 0 5314 if (SvTYPE(value) >= SVt_PVMG) {
151 5 5309 if (!SvOK(value)) {
5 0 if (!SvOK(value)) {
5 0 if (!SvOK(value)) {
153 2 5307 } else if (sv_isa(value, PL_JSON_BOOLEAN_CLASS)) {
154 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);
156 1070 4237 } else if (SvPOK(value)) {
158 1070 0 const char* vstr = SvPV_const(value, vlen);
160 3103 1134 } else if (SvIOK(value)) {
161 3103 0 long val = SvIV(value);
162 5 3098 if (ref && (val == 0 || val == 1)) {
3 2 if (ref && (val == 0 || val == 1)) {
2 1 if (ref && (val == 0 || val == 1)) {
167 3 1131 } else if (SvNOK(value)) {
168 3 0 double val = SvNV(value);
170 1131 0 } else if (SvROK(value)) {
173 15 1116 if (type < SVt_PVAV) {
174 0 15 if (!pl_perl_to_duk_impl(aTHX_ ref, ctx, seen, 1)) {
177 1056 60 } else if (type == SVt_PVAV) {
182 3 1053 if (answer) {
183 0 3 void* ptr = (void*) SvUV(*answer);
192 1053 0 if (hv_store(seen, kstr, klen, uptr, 0)) {
197 3113 1053 for (j = 0; j <= array_top; ++j) { /* yes, [0, array_top] */
199 3113 0 if (!elem || !*elem) {
3113 0 if (!elem || !*elem) {
202 0 3113 if (!pl_perl_to_duk_impl(aTHX_ *elem, ctx, seen, 0)) {
205 0 3113 if (!duk_put_prop_index(ctx, array_pos, count)) {
211 35 25 } else if (type == SVt_PVHV) {
216 3 32 if (answer) {
217 0 3 void* ptr = (void*) SvUV(*answer);
223 32 0 if (hv_store(seen, kstr, klen, uptr, 0)) {
234 32 52 if (!entry) {
238 0 52 if (!key) {
242 52 0 kstr = SvPV(key, klen);
243 0 52 if (!kstr) {
248 0 52 if (!value) {
253 0 52 if (!pl_perl_to_duk_impl(aTHX_ value, ctx, seen, 0)) {
256 0 52 if (! duk_put_prop_lstring(ctx, hash_pos, kstr, klen)) {
261 25 0 } else if (type == SVt_PVCV) {
266 0 25 if (!func) {
270 0 25 if (! duk_put_prop_lstring(ctx, -2, PL_SLOT_GENERIC_CALLBACK, sizeof(PL_SLOT_GENERIC_CALLBACK) - 1)) {
286 24 3000483 if (!seen) {
296 0 2134 if (!seen) {
324 2 3 if (duk_is_array(ctx, pos)) {
327 0 3 else if (duk_is_symbol(ctx, pos)) {
330 0 3 else if (duk_is_pointer(ctx, pos)) {
333 1 2 else if (duk_is_function(ctx, pos)) {
336 0 2 else if (duk_is_c_function(ctx, pos)) {
339 0 2 else if (duk_is_thread(ctx, pos)) {
374 0 35 PUSHMARK(SP);
378 71 35 for (j = 0; j < nargs; j++) {
380 0 71 mXPUSHs(val);
391 35 0 err_tmp = ERRSV;
392 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)) {
393 3 0 croak("Perl sub died with error: %s", SvPV_nolen(err_tmp));
403 32 0 FREETMPS;
412 6036681 1003307 for (; name[l] != '\0'; ++l) {
413 1046 6035635 if (name[l] == '.') {
426 1001164 33 if (last_dot < 0) {
427 1000134 1030 if (duk_get_global_string(ctx, name)) {
434 33 0 if (duk_peval_lstring(ctx, name, last_dot) == 0) {
436 28 5 if (duk_get_prop_lstring(ctx, -1, name + last_dot + 1, len - last_dot - 1)) {
456 30 30 if (find_global_or_property(ctx, name)) {
468 18 2 if (find_global_or_property(ctx, name)) {
479 12 0 if (find_global_or_property(ctx, object)) {
480 9 3 if (find_global_or_property(ctx, class)) {
481 6 3 if (duk_instanceof(ctx, -2, -1)) {
494 1000093 1000 if (find_global_or_property(ctx, name)) {
509 0 2102 if (pl_perl_to_duk(aTHX_ value, ctx)) {
515 1098 1004 if (last_dot < 0) {
516 0 1098 if (duk_put_global_lstring(ctx, name, len)) {
525 0 1004 if (duk_peval_lstring(ctx, name, last_dot) == 0) {
545 4 4 if (last_dot < 0) {
549 0 4 if (duk_peval_lstring(ctx, name, last_dot) == 0) {
575 2000082 264 if (!file) {
585 0 2000346 if (rc != DUK_EXEC_SUCCESS) {
628 2 1 for (j = 0; j < PL_GC_RUNS; ++j) {
642 205 18 while (duk_next(ctx, -1, 0)) { /* get keys only */
647 205 0 if (av_store(values, count, name)) {
663 0 11 if (!duk_get_prop_lstring(ctx, -1, PL_SLOT_GENERIC_CALLBACK, sizeof(PL_SLOT_GENERIC_CALLBACK) - 1)) {
669 0 11 if (func == 0) {