Branch Coverage

blib/lib/Termbox/PP.pm
Criterion Covered Total %
branch 373 796 46.8


line true false branch
60 37 111 if exists $ENV{$_}
72 0 37 exists $ENV{'TB_OPT_EGC'} ? :
77 0 37 exists $ENV{'TB_OPT_PRINTF_BUF'} ? :
82 0 37 exists $ENV{'TB_OPT_READ_BUF'} ? :
87 0 37 exists $ENV{'TB_OPT_LIBC_WCHAR'} ? :
89 0 37 exists $ENV{'PATH_MAX'} ? :
93 0 37 exists $ENV{'TB_TERMINFO_DIR'} ? :
97 0 37 exists $ENV{'TB_RESIZE_FALLBACK_MS'} ? :
102 0 37 exists $ENV{'TB_OPT_TRUECOLOR'} ? :
108 37 0 !defined(undef) ? :
0 37 exists $ENV{'TB_OPT_ATTR_W'} && $ENV{'TB_OPT_ATTR_W'} =~ /^(16|32|64)$/ ? :
708 0 60 if $cp < 0 or $cp > 1114111
709 0 60 if $cp >= 55296 and $cp <= 57343
710 2 58 if $cp == 0
711 4 54 if $cp < 32 or $cp >= 127 and $cp < 160
712 33 21 if $cp <= 126 or $cp >= 160 and $cp <= 255
719 21 0 if (defined $i)
721 0 21 if $v eq "Cc" or $v eq "Cs" or $v eq "Cn"
723 0 17 if $v eq "Mn" or $v eq "Me" or $v eq "Cf" or $v eq "Zl" or $v eq "Zp"
728 17 0 if (defined $i)
730 0 17 if $v eq "Y" or $v eq "Yes" or $v eq "T" or $v eq "True" or $v eq 1
735 17 0 if (defined $i)
737 12 5 if $v eq "W" or $v eq "F"
738 0 1 $is_cjk ? :
1 4 if $v eq "A"
745 37 0 if (eval { do { &POSIX::NCCS } }) { }
753 0 0 unless builtin::blessed($tios) and $tios->isa("POSIX::Termios")
800 39 222 unless (@_)
802 0 56 if @_
819 16 31686 unless (Params::Check::check(\%tmpl, \%in, 0))
849 37 0 $] >= 5.016 ? :
857 0 7 unless ref $aref eq "ARRAY" and @$aref == 1 and ref $aref->[0] eq "HASH"
870 17 18 unless defined $v
871 0 18 if $strict_type and ref $v ne ref $default
872 18 0 unless defined $allow
873 0 0 ref $allow eq 'ARRAY' ? :
914 2 0 length $ch > 1 ? :
919 1 0 $ch =~ /\A\X\z/ && $n > 1 ? :
923 1 0 $ech ? :
936 2 11582 unless length $ch
953 2 3 if not ref $a && ref $b or $a->{'ch'} ne $b->{'ch'} or $a->{'fg'} != $b->{'fg'} or $a->{'bg'} != $b->{'bg'}
1034 0 11557 if $rv = $c->{'cells'}[$i]->set(" ", $Termbox::global->{'fg'}, $Termbox::global->{'bg'})
1056 0 43 if ($x < 0 or $x >= $c->{'width'} or $y < 0 or $y >= $c->{'height'})
1074 0 5 if ($ow == $w and $oh == $h)
1078 0 5 $w < 1 ? :
1079 0 5 $h < 1 ? :
1081 2 3 $w < $ow ? :
1082 1 4 $h < $oh ? :
1087 0 5 if $rv != 0
1089 0 5 if $rv != 0
1096 0 19 unless $c->in_bounds($x, $y)
1098 0 19 unless defined $dst
1100 0 19 if $rv != 0
1140 0 0 unless length $b <=> length $a
1143 3 0 @ordered ? :
1153 0 3 unless length $s
1154 1 2 exists $self->{'prefixes'}{$s} ? :
1163 0 3 unless length $buf
1165 0 3 unless defined $alt
1166 2 1 if $buf =~ /\A($alt)/s
1179 0 3 unless length $cap
1180 0 3 if exists $self->{'exact'}{$cap}
1207 3 0 scalar keys %{$$self{'exact'};} ? :
1211 2 1 if (defined(my $m = $self->best_match($buf))) { }
1 0 elsif ($self->has_prefix($buf)) { }
1218 0 2 $self->has_prefix($m) ? :
1481 1 0 if $Termbox::global->{'initialized'}
1484 0 0 if (not defined $ttyfd or $ttyfd < 0)
1510 0 0 POSIX::isatty($wfd) ? :
2 0 POSIX::isatty($rfd) ? :
1518 0 2 if $rv != 0
1519 0 2 if $rv != 0
1520 0 2 if $rv != 0
1521 0 2 if $rv != 0
1522 0 2 if $rv != 0
1523 0 2 if $rv != 0
1524 0 2 if $rv != 0
1525 0 2 if $rv != 0
1530 0 2 if $rv != 0
1538 1 1 unless $Termbox::global->{'initialized'}
1550 0 1 unless $Termbox::global->{'initialized'}
1557 0 1 unless $Termbox::global->{'initialized'}
1568 1 1 unless $Termbox::global->{'initialized'}
1578 1 1 unless $Termbox::global->{'initialized'}
1591 0 1 unless $Termbox::global->{'initialized'}
1605 0 1 if $rv != 0
1607 0 1 if $rv != 0
1610 1 0 if ($back->{'ch'} =~ /\A\X\z/ and length $back->{'ch'} > 1) { }
1618 0 1 if $w < 1
1620 1 0 if (cell_cmp($back, $front) != 0)
1624 0 1 if ($w > 1 and $x >= $Termbox::global->{'front'}{'width'} - ($w - 1)) { }
1630 1 0 if ($back->{'ch'} =~ /\A\X\z/ and length $back->{'ch'} > 1) { }
1648 0 0 if $rv != 0
1651 0 0 if $rv != 0
1660 0 1 if $rv != 0
1662 0 1 if $rv != 0
1674 1 2 unless $Termbox::global->{'initialized'}
1676 1 1 if $rv != 0
1690 1 1 unless $Termbox::global->{'initialized'}
1692 0 1 if $cx < 0
1693 0 1 if $cy < 0
1696 1 0 if ($Termbox::global->{'cursor_x'} == -1)
1698 0 1 if $rv != 0
1701 0 1 if $rv != 0
1712 0 1 unless $Termbox::global->{'initialized'}
1714 1 0 if ($Termbox::global->{'cursor_x'} >= 0)
1716 0 1 if $rv != 0
1754 3 9 unless $Termbox::global->{'initialized'}
1758 0 9 if $rv != 0
1760 0 9 if $rv != 0
1771 1 2 unless $Termbox::global->{'initialized'}
1777 0 2 if $rv != 0
1795 1 2 unless $Termbox::global->{'initialized'}
1796 0 2 $back ? :
1808 0 2 unless $Termbox::global->{'initialized'}
1810 1 1 if ($mode == 0)
1815 1 0 if (($mode & $esc_or_alt) == 0) { }
0 0 elsif (($mode & $esc_or_alt) == $esc_or_alt) { }
1823 1 0 if ($mode & 4) { }
1840 0 2 unless $Termbox::global->{'initialized'}
1843 1 1 if 0 == $_
1849 0 0 if (1 == $_ or 2 == $_ or 4 == $_ or 8 == $_ or 5 == $_)
1869 1 1 unless $Termbox::global->{'initialized'}
1878 1 1 unless $Termbox::global->{'initialized'}
1892 1 1 unless $Termbox::global->{'initialized'}
1927 7 3 unless $Termbox::global->{'initialized'}
1930 0 3 unless $back->in_bounds($x, $y)
1932 3 0 if defined $out_w
1942 0 7 if ($rv < 0) { }
7 0 elsif ($rv > 0) { }
1951 0 7 if ($uni eq 10)
1958 0 7 unless (tb_iswprint_ex($uni, \$w))
1963 0 7 if ($w < 0) { }
1 6 elsif ($w == 0) { }
1967 1 0 if ($back->in_bounds($x_prev, $y))
1969 0 1 if $rv != 0
1973 6 0 if ($back->in_bounds($x, $y))
1975 0 6 if $rv != 0
1979 6 0 if defined $out_w
2020 1 0 @args ? :
2022 0 1 if $len >= 4096
2038 1 1 unless $warned++
2042 1 1 if (0 == $_)
2046 1 0 if (1 == $_)
2065 0 24 if $c eq ""
2070 0 2 $b < 254 ? :
0 2 $b < 252 ? :
2 2 $b < 248 ? :
1 4 $b < 240 ? :
2 5 $b < 224 ? :
10 7 if ($b < 192) { }
2088 0 19 if $c eq ""
2090 1 18 if $b0 eq "\0"
2106 6 12 if $i != $len
2120 4 1 if ($c <= 1114111)
2130 0 1 if ($c < 128) { }
0 1 elsif ($c < 2048) { }
0 1 elsif ($c < 65536) { }
1 0 elsif ($c < 2097152) { }
0 0 elsif ($c < 67108864) { }
2164 1 3 if (0 == $_)
2167 1 2 if (-2 == $_)
2170 0 2 if (-3 == $_)
2173 0 2 if (-5 == $_)
2176 0 2 if (-6 == $_)
2179 0 2 if (-7 == $_)
2182 0 2 if (-8 == $_)
2185 0 2 if (-9 == $_)
2188 0 2 if (-17 == $_)
2191 0 2 if (-22 == $_)
2194 0 2 if (-21 == $_)
2210 0 1 if (-1 == $_ or -4 == $_ or -10 == $_ or -11 == $_ or -12 == $_ or -13 == $_ or -14 == $_ or -15 == $_ or -16 == $_ or -18 == $_ or -19 == $_ or -20 == $_)
2226 3 1 unless $warned++
2231 0 4 unless ref $back eq "cellbuf" and ref $back->{'cells'} eq "ARRAY"
2350 1 3 @args ? :
2351 0 4 if not defined $str or length $str >= 4096
2362 0 5 if (defined $Termbox::global->{'caps'}[0] and $Termbox::global->{'wfd'} >= 0)
2372 0 5 if ($Termbox::global->{'ttyfd'} >= 0)
2373 0 0 if ($Termbox::global->{'has_orig_tios'})
2376 0 0 if ($Termbox::global->{'ttyfd_open'})
2383 5 0 if exists $SIG{'WINCH'}
2385 0 10 if $fd >= 0
2393 0 5 if $Termbox::global->{'terminfo'}
2395 5 0 if $Termbox::global->{'cap_trie'}
2396 0 5 if $rv != 0
2411 7 12 if defined $width
2414 15 4 $ch != 0 && $w >= 0 ? :
2445 0 10 if ($c == 65038) { }
0 10 elsif ($c == 65039) { }
0 10 elsif ($c == 8205) { }
0 20 elsif ($c >= 127462 and $c <= 127487) { }
2451 0 10 unless defined $w
2452 9 1 if $w > $wmax
2455 8 1 if ($wmax >= 1)
2456 0 8 if $vs15
2457 0 8 if $vs16 or $zwj or $ri >= 2
2471 1 0 if $Termbox::global->{'ttyfd'} < 0
2475 0 0 unless (defined $Termbox::global->{'orig_tios'}->getattr($Termbox::global->{'ttyfd'}))
2487 0 0 unless (defined $tios->setattr($Termbox::global->{'ttyfd'}, 2))
2498 1 0 if (load_terminfo() == 0)
2518 0 3 unless $term
2521 0 3 if (defined(my $terminfo = $ENV{'TERMINFO'}))
2523 0 0 if $rv == 0
2527 3 0 if (defined(my $home = $ENV{'HOME'}))
2530 0 3 if length $tmp >= 4096
2533 0 3 if $rv == 0
2542 0 3 if (defined(my $dirs = $ENV{'TERMINFO_DIRS'}))
2543 0 0 if length $dirs >= 4096
2545 0 0 if $dir eq ""
2547 0 0 if $rv == 0
2552 0 3 if (defined undef)
2554 0 0 if $rv == 0
2568 3 12 if $rv == 0
2585 0 19 if length $tmp >= 4096
2588 4 15 if $rv == 0
2590 0 15 if ($^O eq "darwin")
2593 0 0 if length $tmp >= 4096
2607 15 4 unless open my $fp, "<:raw", $path
2611 0 4 unless (@st)
2621 0 4 if (not defined $nread or $nread != $fsize)
2640 0 2 if $nterminfo < 12
2642 0 2 unless my $terminfo_cap_indexes = eval { do { BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x45\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} require Termbox::PP::Terminfo::Builtin; \@Termbox::PP::Terminfo::Builtin::terminfo_cap_indexes } }
2665 0 2 $magic_number == 542 ? :
2671 2 0 ($nbytes_names + $nbytes_bools) % 2 != 0 ? :
2692 0 76 unless defined $cap
2704 0 1 unless $term
2706 0 1 unless my $builtin_terms = do { require Termbox::PP::Terminfo::Builtin; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x45\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} \%Termbox::PP::Terminfo::Builtin::builtin_terms }
2711 0 1 unless my $builtin_terms_orders = do { require Termbox::PP::Terminfo::Builtin; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x45\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} \@Termbox::PP::Terminfo::Builtin::builtin_terms_orders }
2718 1 0 if (exists $builtin_terms->{$term})
2726 0 0 if index($term, $name) == -1
2727 0 0 unless exists $builtin_terms->{$name}
2747 1 79 if ($index >= $offsets_len)
2755 0 79 if (get_terminfo_int16($table_offset_offset, \$table_offset) != 0)
2761 0 79 if ($table_offset < 0 or $table_offset >= $table_size)
2769 0 79 if ($str_offset >= length $Termbox::global->{'terminfo'})
2777 79 0 $len >= 0 ? :
2786 1 94 if ($offset < 0 or $offset + 2 > length $Termbox::global->{'terminfo'})
2802 0 1 unless (($rfd, $wfd) = POSIX::pipe())
2809 1 0 if exists $SIG{'WINCH'}
2818 1 1 if $rv != 0
2820 0 1 if $rv != 0
2822 0 1 if $rv != 0
2824 0 1 if $rv != 0
2844 1 0 if $Termbox::global->{'ttyfd'} < 0
2847 0 0 unless $fh
2852 0 0 if (eval { do { require "sys/ioctl.ph"; 1 } } and ioctl $fh, &TIOCGWINSZ, $sz)
2862 0 0 if $rv == 0
2879 0 1 if not defined $write_rv or $write_rv != length $move_and_report
2888 0 1 if ($select_rv != 1)
2895 0 1 if (not defined $read_rv or $read_rv < 1)
2900 0 1 unless ($buf =~ /\e\[(\d+);(\d+)R/)
2920 0 0 if $rv != 0
2922 0 0 unless my $builtin_mod_caps = eval { do { BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x45\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} require Termbox::PP::Terminfo::Builtin; \%Termbox::PP::Terminfo::Builtin::builtin_mod_caps } }
2936 0 0 if $rv != 0 and $rv != -22
2948 0 0 if $rv != 0 and $rv != -22
2962 0 0 unless my $trie = $Termbox::global->{'cap_trie'}
2976 0 0 unless my $trie = $Termbox::global->{'cap_trie'}
3008 1 1 if $rv == 0
3014 0 1 $timeout < 0 ? :
3025 0 1 if ($select_rv < 0)
3030 0 1 if ($select_rv == 0)
3037 0 1 if ($tty_has_events)
3040 0 0 if (not defined $read_rv or $read_rv < 0) { }
0 0 elsif ($read_rv > 0) { }
3048 1 0 if ($resize_has_events)
3053 0 1 if $rv != 0
3055 0 1 if $rv != 0
3066 0 0 if $rv == 0
3082 1 2 unless length $in
3086 0 2 if ($b0 eq "\e")
3089 0 0 unless ($Termbox::global->{'input_mode'} & 1 and length $in == 1)
3091 0 0 if $rv != 0 and $rv != -2
3095 0 0 if ($Termbox::global->{'input_mode'} & 1)
3112 0 2 if ($is_ctrl)
3123 2 0 if (length $in >= $need)
3145 1 1 if $rv == 0 or $rv == -2
3148 1 0 if $rv == 0 or $rv == -2
3151 0 0 if $rv == 0 or $rv == -2
3154 0 0 if $rv == 0 or $rv == -2
3167 1 2 $is_post ? :
3168 2 1 unless ref $fn eq "CODE"
3173 1 0 if ($rv == 0)
3177 1 0 if $rv == 0 or $rv == -2
3192 0 3 if (@in < 2) { }
0 3 elsif ($in[1] != 91) { }
0 3 elsif (@in < 3) { }
3202 1 2 if ($in[2] == 77) { }
1 1 elsif ($in[2] == 60) { }
3219 1 2 if (0 == $_)
3221 0 1 if @in < 6
3227 1 0 if (0 == $_)
3228 0 1 $b & 64 ? :
3232 0 0 if (1 == $_)
3233 0 0 $b & 64 ? :
3237 0 0 if (2 == $_)
3241 0 0 if (3 == $_)
3250 0 1 if (($b & 32) != 0)
3265 2 0 if (1 == $_ or 2 == $_)
3272 1 1 if $type == 1
3278 13 6 if ($c >= 48 and $c <= 57)
3280 6 7 if $cur_num == -1
3287 6 0 if ($cur_num != -1 and $num_i < 2 && $c == 59 || $num_i == 2 && ($c == 109 || $c == 77))
3305 0 2 if $num[2] == -1
3310 1 1 if $type == 2
3314 0 2 if (0 == $_)
3315 0 0 $num[0] & 64 ? :
3319 1 1 if (1 == $_)
3320 1 0 $num[0] & 64 ? :
3324 0 1 if (2 == $_)
3328 1 0 if (3 == $_)
3338 0 2 if ($trail == 109)
3342 1 1 if (($num[0] & 32) != 0)
3346 0 2 $num[1] - 1 < 0 ? :
3347 0 2 $num[2] - 1 < 0 ? :
3352 3 0 if $buf_shift > 0
3371 0 3 if $rv != 0
3373 2 1 if ($node->{'is_leaf'}) { }
1 0 elsif ($node->{'nchildren'} > 0 and length $in <= $depth) { }
3401 2 0 $a->equal($b) ? :
3453 0 3 if $rv != 0
3455 0 3 if $rv != 0
3457 0 3 if $rv != 0
3459 0 3 if $rv != 0
3473 0 11 unless $c->{'cells'}
3475 0 7684 if $rv != 0
3496 2 13 unless $c->in_bounds($x, $y)
3498 13 0 defined $$out ? :
3539 0 1 if $rv != 0
3541 0 1 if $rv != 0
3543 0 1 if $rv != 0
3553 0 0 if $rv != 0
3555 0 0 if $rv != 0
3558 0 0 if $rv != 0
3560 0 0 if $rv != 0
3576 1 2 if ($fg == $Termbox::global->{'last_fg'} and $bg == $Termbox::global->{'last_bg'})
3581 0 0 if $rv != 0
3586 0 0 if (1 == $_)
3591 0 0 $fg & 4194304 ? :
3592 0 0 $bg & 4194304 ? :
3595 0 0 if (2 == $_)
3598 0 0 if $fg & 2097152
3599 0 0 if $bg & 2097152
3602 0 0 if (4 == $_)
3605 0 0 if $cfg > 216
3606 0 0 if $cbg > 216
3611 0 0 if (8 == $_)
3614 0 0 if $cfg > 24
3615 0 0 if $cbg > 24
3620 0 0 if (5 == $_)
3623 0 0 if $fg & 2097152
3624 0 0 if $bg & 2097152
3633 0 0 if ($fg & 65536)
3635 0 0 if $rv != 0
3637 0 0 if ($fg & 1048576)
3639 0 0 if $rv != 0
3641 0 0 if ($fg & 131072)
3643 0 0 if $rv != 0
3645 0 0 if ($fg & 524288)
3647 0 0 if $rv != 0
3649 0 0 if ($fg & 8388608)
3651 0 0 if $rv != 0
3654 0 0 if ($fg & '1099511627776')
3657 0 0 if $rv != 0
3659 0 0 if ($fg & '2199023255552')
3662 0 0 if $rv != 0
3664 0 0 if ($fg & '4398046511104')
3667 0 0 if $rv != 0
3669 0 0 if ($fg & '8796093022208')
3671 0 0 if $rv != 0
3675 0 0 if ($fg & 262144 or $bg & 262144)
3677 0 0 if $rv != 0
3681 0 0 if ($Termbox::global->{'output_mode'} == 2)
3682 0 0 if $fg & 2097152
3683 0 0 if $bg & 2097152
3686 0 0 if ($Termbox::global->{'output_mode'} == 5)
3693 0 0 if $rv != 0
3712 0 2 if $fg_is_default and $bg_is_default
3716 2 1 if (1 == $_)
3718 0 0 unless ($fg_is_default)
3720 0 0 unless ($bg_is_default)
3724 0 0 unless ($bg_is_default)
3733 0 1 if (2 == $_ or 4 == $_ or 8 == $_)
3735 0 0 unless ($fg_is_default)
3738 0 0 unless ($bg_is_default)
3742 0 0 unless ($bg_is_default)
3749 0 1 if (5 == $_)
3751 0 0 unless ($fg_is_default)
3758 0 0 unless ($bg_is_default)
3762 0 0 unless ($bg_is_default)
3789 0 2 if $x < 0 or $y < 0
3817 0 0 if ($Termbox::global->{'last_x'} != $x - 1 or $Termbox::global->{'last_y'} != $y)
3819 0 0 if $rv != 0
3825 0 0 unless (tb_iswprint_ex($ch32, undef))
3830 0 0 if $rv != 0
3857 4 1 if &bytes::length($str)
3879 1 2 if $n > length $$b
3891 2 2 unless length $$b
3894 1 1 if (not defined $wrote or $wrote != $want)