Branch Coverage

XS.xs
Criterion Covered Total %
branch 96 172 55.8


line true false branch
36 1 60 if (v->type_annotation.data != NULL) {
99 0 15 if (!cb) return 0;
104 0 15 PUSHMARK(SP);
105 0 15 XPUSHs(sv_2mortal(newSVuv((UV) bufsize)));
112 15 0 if (SvTRUE(ERRSV)) {
0 15 if (SvTRUE(ERRSV)) {
117 15 0 else if (n >= 1) {
119 15 0 if (SvOK(chunk)) {
122 0 15 if (len > bufsize) len = bufsize;
123 13 2 if (len > 0) memcpy(buf, data, len);
128 15 0 FREETMPS;
165 11 5 RETVAL = (int) KDL_DETECT_VERSION;
172 0 0 RETVAL = (int) KDL_READ_VERSION_1;
179 1 2 RETVAL = (int) KDL_READ_VERSION_2;
186 0 0 RETVAL = (int) KDL_EMIT_COMMENTS;
207 0 17 if (!SvOK(doc_sv))
222 0 17 if (!p->parser) {
242 2 0 if (!SvROK(cb_sv) || SvTYPE(SvRV(cb_sv)) != SVt_PVCV)
0 2 if (!SvROK(cb_sv) || SvTYPE(SvRV(cb_sv)) != SVt_PVCV)
249 0 2 if (!p->parser) {
271 0 195 if (!sv_isa(self_sv, "Text::KDL::XS::Parser"))
276 0 195 if (!ev) croak("kdl_parser_next_event returned NULL");
278 17 178 if (ev->event == KDL_EVENT_EOF) {
281 2 176 else if (ev->event == KDL_EVENT_PARSE_ERROR) {
301 62 114 if (ev->name.data != NULL) {
307 58 118 if (real_event == KDL_EVENT_START_NODE) {
309 0 58 if (ev->value.type_annotation.data != NULL) {
316 61 57 else if (real_event == KDL_EVENT_ARGUMENT
317 4 57 || real_event == KDL_EVENT_PROPERTY) {
333 0 19 if (!sv_isa(self_sv, "Text::KDL::XS::Parser")) return;
335 0 19 if (!p) return;
336 19 0 if (p->parser) kdl_destroy_parser(p->parser);
337 2 17 if (p->read_cb) SvREFCNT_dec(p->read_cb);
338 17 2 if (p->keepalive) SvREFCNT_dec(p->keepalive);
359 0 13 if (version_int == 1) opts.version = KDL_VERSION_1;
360 1 12 else if (version_int == 2) opts.version = KDL_VERSION_2;
361 0 13 if (indent >= 0) opts.indent = indent;
362 0 13 if (escape_mode >= 0) opts.escape_mode = (kdl_escape_mode) escape_mode;
363 0 13 if (identifier_mode >= 0)
368 0 13 if (!e->emitter) {
390 0 39 if (!sv_isa(self_sv, "Text::KDL::XS::Emitter"))
397 0 39 if (SvOK(type_sv)) {
416 0 33 if (!sv_isa(self_sv, "Text::KDL::XS::Emitter"))
422 33 0 if (!SvROK(value_hv_ref) || SvTYPE(SvRV(value_hv_ref)) != SVt_PVHV)
0 33 if (!SvROK(value_hv_ref) || SvTYPE(SvRV(value_hv_ref)) != SVt_PVHV)
436 5 28 if (sv_ann && *sv_ann && SvOK(*sv_ann)) {
5 0 if (sv_ann && *sv_ann && SvOK(*sv_ann)) {
0 5 if (sv_ann && *sv_ann && SvOK(*sv_ann)) {
442 33 0 if (!sv_type || !*sv_type) croak("emit_arg: missing 'type'");
0 33 if (!sv_type || !*sv_type) croak("emit_arg: missing 'type'");
445 1 32 if (strEQ(type_str, "null")) {
448 2 30 else if (strEQ(type_str, "bool")) {
450 2 0 v.boolean = (sv_val && SvTRUE(*sv_val));
1 1 v.boolean = (sv_val && SvTRUE(*sv_val));
452 25 5 else if (strEQ(type_str, "string")) {
457 5 0 else if (strEQ(type_str, "number")) {
459 5 0 const char* kind = sv_kind && *sv_kind ? SvPV_nolen(*sv_kind)
460 5 0 : "integer";
461 4 1 if (strEQ(kind, "integer")) {
465 1 0 else if (strEQ(kind, "float")) {
496 0 1 if (!sv_isa(self_sv, "Text::KDL::XS::Emitter"))
503 1 0 if (!SvROK(value_hv_ref) || SvTYPE(SvRV(value_hv_ref)) != SVt_PVHV)
0 1 if (!SvROK(value_hv_ref) || SvTYPE(SvRV(value_hv_ref)) != SVt_PVHV)
514 1 0 if (sv_ann && *sv_ann && SvOK(*sv_ann)) {
1 0 if (sv_ann && *sv_ann && SvOK(*sv_ann)) {
0 1 if (sv_ann && *sv_ann && SvOK(*sv_ann)) {
520 1 0 if (!sv_type || !*sv_type) croak("emit_property: missing 'type'");
0 1 if (!sv_type || !*sv_type) croak("emit_property: missing 'type'");
523 0 1 if (strEQ(type_str, "null")) {
526 0 1 else if (strEQ(type_str, "bool")) {
528 0 0 v.boolean = (sv_val && SvTRUE(*sv_val));
0 0 v.boolean = (sv_val && SvTRUE(*sv_val));
530 1 0 else if (strEQ(type_str, "string")) {
535 0 0 else if (strEQ(type_str, "number")) {
537 0 0 const char* kind = sv_kind && *sv_kind ? SvPV_nolen(*sv_kind)
538 0 0 : "integer";
539 0 0 if (strEQ(kind, "integer")) {
543 0 0 else if (strEQ(kind, "float")) {
568 0 8 if (!sv_isa(self_sv, "Text::KDL::XS::Emitter"))
581 0 8 if (!sv_isa(self_sv, "Text::KDL::XS::Emitter"))
594 0 12 if (!sv_isa(self_sv, "Text::KDL::XS::Emitter"))
608 0 12 if (!sv_isa(self_sv, "Text::KDL::XS::Emitter"))
612 12 0 RETVAL = newSVpvn(buf.data ? buf.data : "", buf.len);
623 0 13 if (!sv_isa(self_sv, "Text::KDL::XS::Emitter")) return;
625 0 13 if (!e) return;
626 13 0 if (e->emitter) kdl_destroy_emitter(e->emitter);