| 1 | package Term::Fabulous::Widget::Table::Borders; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use v5.32; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use feature 'signatures'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | no warnings 'experimental::signatures'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | our $VERSION = '0.02'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | our @EXPORT_OK = qw(resolve_borders); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use List::Util qw(any first); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use Scalar::Util qw(refaddr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use Term::Fabulous::Enum::BorderStyle; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | my $HIDDEN = Term::Fabulous::Enum::BorderStyle->Hidden; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | my $BLANK = Term::Fabulous::Enum::BorderStyle->Blank; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 70 | ▶ | sub _is_line ($style) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_line: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 70 | ▶ | return defined $style && refaddr($style) != refaddr($HIDDEN) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $style and builtin::refaddr($style) != builtin::refaddr($HIDDEN)
MC/DC50%1/2
defined $style and builtin::refaddr($style) != builtin::refaddr($HIDDEN)
defined $style
builtin::refaddr($style) != builtin::refaddr($HIDDEN)
Truth table66%2/3
A and B
A= defined $styleB= builtin::refaddr($style) != builtin::refaddr($HIDDEN)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # Whether a style has joint glyphs, so that its lines join with others. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 84 | ▶ | sub _joins ($style) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_joins: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 84 | ▶ | return defined $style->joints ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # Whether a frame side is drawn on the background outside the table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # (see Term::Fabulous::Role::HasBorderStyle/outer_border_sides). Line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # styles are, so that highlights stop at the frame. Block styles (Outer, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | # Inner, Thick, ...) keep the backgrounds their glyphs are made for: a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # side whose glyph sits on the cell's own background stays inside, so the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # cells' colors reach the frame; one whose glyph sits on the background | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | # beside the box (location 1 or 2) is outside, and so are the cells of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | # other lines that end on it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 44 | ▶ | sub _drawn_outside ( $style, $side ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_drawn_outside: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 44 | ▶ | return 1 if _joins($style); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 12 | ▶ | my $location | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | = $side eq 'top' ? ( $style->get_top_locations )[1] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | : $side eq 'bottom' ? ( $style->get_bottom_locations )[1] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | : $side eq 'left' ? $style->get_left_locations | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | : $style->get_right_locations; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 12 | ▶ | return $location == 1 || $location == 2 ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$location == 1 or $location == 2
MC/DC50%1/2
$location == 1 or $location == 2
$location == 1
$location == 2
Truth table66%2/3
A or B
A= $location == 1B= $location == 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # The first style the levels name, from the most specific: a level is an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | # array of candidates, the last one winning within the level (the cell | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | # below, or to the right). Hidden ends the search: there is no line. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 105 | ▶ | sub _first_style (@levels) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_first_style: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 105 | foreach my $level (@levels) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 399 | ▶ | my $style = first { defined } reverse @$level; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 399 | ▶ | return _is_line($style) ? $style : undef if defined $style; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 35 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # Works out the lines of a table. Takes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | # columns => the number of grid columns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | # header => how many of the lines are header lines (they come first) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | # table => { border_top, border_right, border_bottom, border_left, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | # column_lines, row_lines, header_line } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | # column_styles => [ per column { border_left, border_right, row_lines } ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | # lines => [ per line { spanning, style => { border_top, border_right, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # border_bottom, border_left, column_lines }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # cells => [ per cell { border_top, border_right, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | # border_bottom, border_left } ] } ] (a spanning line has | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | # one cell) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | # and returns, per line, per cell: { sides => { top, right, bottom, left } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # (a BorderStyle per drawn side, Blank where a line passes elsewhere but | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # not here), corners => { top_left, ... } (the glyph of every drawn | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | # corner that does not keep the glyph of its style) }. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 7 | ▶ | sub resolve_borders (%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resolve_borders: called CC=26 SCAR=32.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 7 | my ( $columns, $lines ) = @args{qw(columns lines)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 7 | ▶ | my $header_lines = $args{header} // 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{"header"} // 0
MC/DC100%1/1
$args{"header"} // 0
$args{"header"}
Truth table100%2/2
A
A= $args{"header"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 7 | ▶ | my $table = $args{table} // {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{"table"} // {}
MC/DC0%0/1
$args{"table"} // {}
$args{"table"}
Truth table50%1/2
A
A= $args{"table"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 7 | ▶ | my $column_style = $args{column_styles} // []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{"column_styles"} // []
MC/DC100%1/1
$args{"column_styles"} // []
$args{"column_styles"}
Truth table100%2/2
A
A= $args{"column_styles"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 7 | my $last_line = $#$lines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 7 | my $line_count = scalar @$lines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 146 | ▶ | my $cell_style = sub ( $line, $column ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 146 | ▶ | my $cells = $lines->[$line]{cells} // []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$lines->[$line]{"cells"} // []
MC/DC100%1/1
$lines->[$line]{"cells"} // []
$lines->[$line]{"cells"}
Truth table100%2/2
A
A= $lines->[$line]{"cells"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 146 | ▶ | return ( $lines->[$line]{spanning} ? $cells->[0] : $cells->[$column] ) // {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
($lines->[$line]{"spanning"} ? $cells->[0] : $cells->[$column]) // {}
MC/DC100%1/1
($lines->[$line]{"spanning"} ? $cells->[0] : $cells->[$column]) // {}
($lines->[$line]{"spanning"} ? $cells->[0] : $cells->[$column])
Truth table100%2/2
A
A= ($lines->[$line]{"spanning"} ? $cells->[0] : $cells->[$column])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 7 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 7 | ▶ | my $row_style = sub ($line) { $lines->[$line]{style} // {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Condition100%2/2
$lines->[$line]{"style"} // {}
MC/DC100%1/1
$lines->[$line]{"style"} // {}
$lines->[$line]{"style"}
Truth table100%2/2
A
A= $lines->[$line]{"style"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | # The horizontal segment above line $boundary ($line_count: below the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | # last line) in a column. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 52 | ▶ | my $horizontal = sub ( $boundary, $column ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=13 SCAR=25.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 52 | my ( $above, $below ) = ( $boundary - 1, $boundary ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 52 | ▶ | my @cells = ( ( $above >= 0 ? $cell_style->( $above, $column )->{border_bottom} : undef ), ( $below < $line_count ? $cell_style->( $below, $column )->{border_top} : undef ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 52 | ▶ | my @rows = ( ( $above >= 0 ? $row_style->($above)->{border_bottom} : undef ), ( $below < $line_count ? $row_style->($below)->{border_top} : undef ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 52 | ▶ | my $inner = $boundary > 0 && $boundary < $line_count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$boundary > 0 && $boundary < $line_count
MC/DC100%2/2
$boundary > 0 && $boundary < $line_count
$boundary > 0
$boundary < $line_count
Truth table100%3/3
A && B
A= $boundary > 0B= $boundary < $line_count
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 52 | ▶ | my @columns = $inner && $boundary != $header_lines ? ( ( $column_style->[$column] // {} )->{row_lines} ) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%5/5
$inner and $boundary != $header_lines
$column_style->[$column] // {}
MC/DC100%2/2
$inner and $boundary != $header_lines
$inner
$boundary != $header_lines
MC/DC100%1/1
$column_style->[$column] // {}
$column_style->[$column]
Truth table100%3/3
A and B
A= $innerB= $boundary != $header_lines
Truth table100%2/2
A
A= $column_style->[$column]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | my $table_line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | = $boundary == 0 ? $table->{border_top} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | : $boundary == $line_count ? $table->{border_bottom} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | : $boundary == $header_lines ? $table->{header_line} // $table->{row_lines} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 52 | ▶ | : $table->{row_lines}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition33%1/3
$table->{"header_line"} // $table->{"row_lines"}
MC/DC0%0/2
$table->{"header_line"} // $table->{"row_lines"}
$table->{"header_line"}
$table->{"row_lines"}
Truth table33%1/3
A // B
A= $table->{"header_line"}B= $table->{"row_lines"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 52 | return _first_style( \@cells, \@rows, \@columns, [$table_line] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 7 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | # The vertical segment of a line left of grid column $boundary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | # ($columns: right of the last column). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 54 | ▶ | my $vertical = sub ( $line, $boundary ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=14 SCAR=26.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 54 | my $spanning = $lines->[$line]{spanning}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 54 | ▶ | my $outer = $boundary == 0 || $boundary == $columns; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$boundary == 0 || $boundary == $columns
MC/DC100%2/2
$boundary == 0 || $boundary == $columns
$boundary == 0
$boundary == $columns
Truth table100%3/3
A || B
A= $boundary == 0B= $boundary == $columns
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 54 | ▶ | return undef if $spanning && !$outer; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$spanning and not $outer
MC/DC100%2/2
$spanning and not $outer
$spanning
not $outer
Truth table100%3/3
A and not(B)
A= $spanningB= not $outer
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | my @cells = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | ( $boundary > 0 ? $cell_style->( $line, $boundary - 1 )->{border_right} : undef ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 53 | ▶ | ( $boundary < $columns ? $cell_style->( $line, $boundary )->{border_left} : undef ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 53 | my $row = $row_style->($line); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | my @rows | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | = $boundary == 0 ? ( $row->{border_left} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | : $boundary == $columns ? ( $row->{border_right} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 53 | ▶ | : ( $row->{column_lines} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | my @column_levels = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | ( $boundary > 0 ? ( $column_style->[ $boundary - 1 ] // {} )->{border_right} : undef ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 53 | ▶ | ( $boundary < $columns ? ( $column_style->[$boundary] // {} )->{border_left} : undef ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%4/4
$$column_style[$boundary - 1] // {}
$column_style->[$boundary] // {}
MC/DC100%1/1
$$column_style[$boundary - 1] // {}
$$column_style[$boundary - 1]
MC/DC100%1/1
$column_style->[$boundary] // {}
$column_style->[$boundary]
Truth table100%2/2
A
A= $$column_style[$boundary - 1]
Truth table100%2/2
A
A= $column_style->[$boundary]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 53 | ▶ | my $table_line = $boundary == 0 ? $table->{border_left} : $boundary == $columns ? $table->{border_right} : $table->{column_lines}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 53 | return _first_style( \@cells, \@rows, \@column_levels, [$table_line] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 7 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 7 | my ( @h, @v ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 7 | foreach my $boundary ( 0 .. $line_count ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 24 | $h[$boundary] = [ map { $horizontal->( $boundary, $_ ) } 0 .. $columns - 1 ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 7 | foreach my $line ( 0 .. $last_line ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 17 | $v[$line] = [ map { $vertical->( $line, $_ ) } 0 .. $columns ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | my @row_line_exists = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 7 | my $boundary = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 24 | ▶ | ( any { defined } @{ $h[$boundary] } ) ? 1 : 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } 0 .. $line_count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | my @column_line_exists = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 7 | my $boundary = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 22 | ▶ | ( any { defined $v[$_][$boundary] } 0 .. $last_line ) ? 1 : 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } 0 .. $columns; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | # Who draws a horizontal boundary: the line below it, except that a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | # boundary above a spanning line is drawn by the (non-spanning) line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | # above it, the last boundary by the last line, and the boundary below | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | # the header by the header, which does not scroll. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 22 | ▶ | my $drawn_as_bottom = sub ($boundary) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 22 | ▶ | return 1 if $boundary == $line_count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 17 | ▶ | return 0 if $boundary == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 12 | ▶ | return 1 if $boundary == $header_lines; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 8 | ▶ | return $lines->[$boundary]{spanning} && !$lines->[ $boundary - 1 ]{spanning} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$lines->[$boundary]{"spanning"} and not $$lines[$boundary - 1]{"spanning"}
MC/DC50%1/2
$lines->[$boundary]{"spanning"} and not $$lines[$boundary - 1]{"spanning"}
$lines->[$boundary]{"spanning"}
not $$lines[$boundary - 1]{"spanning"}
Truth table66%2/3
A and not(B)
A= $lines->[$boundary]{"spanning"}B= not $$lines[$boundary - 1]{"spanning"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 7 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 92 | ▶ | my $vertical_arm = sub ( $line, $boundary ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 92 | ▶ | return undef if $line < 0 || $line > $last_line; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$line < 0 or $line > $last_line
MC/DC100%2/2
$line < 0 or $line > $last_line
$line < 0
$line > $last_line
Truth table100%3/3
A or B
A= $line < 0B= $line > $last_line
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 64 | return $v[$line][$boundary]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 7 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 92 | ▶ | my $horizontal_arm = sub ( $boundary, $column ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 92 | ▶ | return undef if $column < 0 || $column >= $columns; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$column < 0 or $column >= $columns
MC/DC100%2/2
$column < 0 or $column >= $columns
$column < 0
$column >= $columns
Truth table100%3/3
A or B
A= $column < 0B= $column >= $columns
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 60 | return $h[$boundary][$column]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 7 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | # The glyph of a point of the outer frame when the frame's style has no | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | # joints (Outer, Inner, Thick, ...): the frame runs on with its straight | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | # edge glyph where an inner line meets it, and keeps its own corner | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | # glyphs at the table's corners (undef: no glyph of the table's own). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | # Returns ( 1, $glyph ) for such a point, () for any other. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 46 | ▶ | my $frame_point = sub ( $boundary, $grid_line, $arms ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=15 SCAR=27.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 46 | my $on_top = $boundary == 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 46 | my $on_bottom = $boundary == $line_count; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 46 | ▶ | my $on_side = $grid_line == 0 || $grid_line == $columns; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$grid_line == 0 || $grid_line == $columns
MC/DC100%2/2
$grid_line == 0 || $grid_line == $columns
$grid_line == 0
$grid_line == $columns
Truth table100%3/3
A || B
A= $grid_line == 0B= $grid_line == $columns
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | my $edge | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | = $on_top || $on_bottom ? $arms->{left} // $arms->{right} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | : $on_side ? $arms->{up} // $arms->{down} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 46 | ▶ | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%6/9
$on_top or $on_bottom
$arms->{"left"} // $arms->{"right"}
$arms->{"up"} // $arms->{"down"}
MC/DC100%2/2
$on_top or $on_bottom
$on_top
$on_bottom
MC/DC0%0/2
$arms->{"left"} // $arms->{"right"}
$arms->{"left"}
$arms->{"right"}
MC/DC0%0/2
$arms->{"up"} // $arms->{"down"}
$arms->{"up"}
$arms->{"down"}
Truth table100%3/3
A or B
A= $on_topB= $on_bottom
Truth table66%2/3
A // B
A= $arms->{"left"}B= $arms->{"right"}
Truth table33%1/3
A // B
A= $arms->{"up"}B= $arms->{"down"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 46 | ▶ | return () unless defined $edge && !_joins($edge); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $edge and not _joins($edge)
MC/DC100%2/2
defined $edge and not _joins($edge)
defined $edge
not _joins($edge)
Truth table100%3/3
A and not(B)
A= defined $edgeB= not _joins($edge)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 12 | ▶ | return ( 1, undef ) if ( $on_top || $on_bottom ) && $on_side; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$on_top || $on_bottom and $on_side
$on_top or $on_bottom
MC/DC100%3/3
$on_top || $on_bottom and $on_side
$on_top
$on_bottom
$on_side
Truth table100%5/5
A or B and C
A= $on_topB= $on_bottomC= $on_side
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 4 | ▶ | return ( 1, ( $edge->get_top_glyphs )[1] ) if $on_top; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 3 | ▶ | return ( 1, ( $edge->get_bottom_glyphs )[1] ) if $on_bottom; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 2 | ▶ | return ( 1, ( $grid_line == 0 ? $edge->get_left_glyphs : $edge->get_right_glyphs ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 7 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 46 | ▶ | my $corner = sub ( $boundary, $grid_line ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 46 | my %arms = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | up => $vertical_arm->( $boundary - 1, $grid_line ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | down => $vertical_arm->( $boundary, $grid_line ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | left => $horizontal_arm->( $boundary, $grid_line - 1 ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | right => $horizontal_arm->( $boundary, $grid_line ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 46 | my ( $on_frame, $frame_glyph ) = $frame_point->( $boundary, $grid_line, \%arms ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 46 | ▶ | return $frame_glyph if $on_frame; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 34 | ▶ | return Term::Fabulous::Enum::BorderStyle->junction(%arms) // ' '; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
"Term::Fabulous::Enum::BorderStyle"->junction(%arms) // " "
MC/DC0%0/1
"Term::Fabulous::Enum::BorderStyle"->junction(%arms) // " "
"Term::Fabulous::Enum::BorderStyle"->junction(%arms)
Truth table50%1/2
A
A= "Term::Fabulous::Enum::BorderStyle"->junction(%arms)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 7 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 83 | ▶ | my $side_style = sub ( $exists, $style ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 83 | ▶ | return undef unless $exists; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 69 | ▶ | return $style // $BLANK; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$style // $BLANK
MC/DC0%0/2
$style // $BLANK
$style
$BLANK
Truth table66%2/3
A // B
A= $styleB= $BLANK
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 7 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 7 | my @result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 7 | foreach my $line ( 0 .. $last_line ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 17 | my $spanning = $lines->[$line]{spanning}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 17 | ▶ | my @cell_columns = $spanning ? ( [ 0, $columns - 1 ] ) : map { [ $_, $_ ] } 0 .. $columns - 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 17 | ▶ | my $top_drawn = $row_line_exists[$line] && !$drawn_as_bottom->($line); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$row_line_exists[$line] && !&$drawn_as_bottom($line)
MC/DC100%2/2
$row_line_exists[$line] && !&$drawn_as_bottom($line)
$row_line_exists[$line]
!&$drawn_as_bottom($line)
Truth table100%3/3
A && not(B)
A= $row_line_exists[$line]B= !&$drawn_as_bottom($line)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 17 | ▶ | my $bottom_drawn = $row_line_exists[ $line + 1 ] && $drawn_as_bottom->( $line + 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$row_line_exists[$line + 1] && &$drawn_as_bottom($line + 1)
MC/DC100%2/2
$row_line_exists[$line + 1] && &$drawn_as_bottom($line + 1)
$row_line_exists[$line + 1]
&$drawn_as_bottom($line + 1)
Truth table100%3/3
A && B
A= $row_line_exists[$line + 1]B= &$drawn_as_bottom($line + 1)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 17 | my @cells; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 17 | foreach my $span (@cell_columns) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 36 | my ( $first, $last ) = @$span; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | my %sides = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | left => $side_style->( $column_line_exists[$first], $v[$line][$first] ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | right => ( $last == $columns - 1 ? $side_style->( $column_line_exists[$columns], $v[$line][$columns] ) : undef ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 15 | ▶ | top => ( $top_drawn ? $side_style->( 1, first { defined } @{ $h[$line] }[ $first .. $last ] ) : undef ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 36 | ▶ | bottom => ( $bottom_drawn ? $side_style->( 1, first { defined } @{ $h[ $line + 1 ] }[ $first .. $last ] ) : undef ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 36 | my %corners; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 36 | ▶ | $corners{top_left} = $corner->( $line, $first ) if $sides{top} && $sides{left}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$sides{"top"} and $sides{"left"}
MC/DC50%1/2
$sides{"top"} and $sides{"left"}
$sides{"top"}
$sides{"left"}
Truth table66%2/3
A and B
A= $sides{"top"}B= $sides{"left"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 36 | ▶ | $corners{top_right} = $corner->( $line, $columns ) if $sides{top} && $sides{right}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$sides{"top"} and $sides{"right"}
MC/DC100%2/2
$sides{"top"} and $sides{"right"}
$sides{"top"}
$sides{"right"}
Truth table100%3/3
A and B
A= $sides{"top"}B= $sides{"right"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 36 | ▶ | $corners{bottom_left} = $corner->( $line + 1, $first ) if $sides{bottom} && $sides{left}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$sides{"bottom"} and $sides{"left"}
MC/DC50%1/2
$sides{"bottom"} and $sides{"left"}
$sides{"bottom"}
$sides{"left"}
Truth table66%2/3
A and B
A= $sides{"bottom"}B= $sides{"left"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 36 | ▶ | $corners{bottom_right} = $corner->( $line + 1, $columns ) if $sides{bottom} && $sides{right}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$sides{"bottom"} and $sides{"right"}
MC/DC100%2/2
$sides{"bottom"} and $sides{"right"}
$sides{"bottom"}
$sides{"right"}
Truth table100%3/3
A and B
A= $sides{"bottom"}B= $sides{"right"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 36 | delete @corners{ grep { !defined $corners{$_} } keys %corners }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 36 | my %on_frame = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | left => $first == 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | right => $last == $columns - 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | top => $line == 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | bottom => $line == $last_line, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 36 | ▶ | my @outer = grep { defined $sides{$_} && $on_frame{$_} && _drawn_outside( $sides{$_}, $_ ) } qw(left right top bottom); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
defined $sides{$_} && $on_frame{$_} && _drawn_outside($sides{$_}, $_)
defined $sides{$_} and $on_frame{$_}
MC/DC100%3/3
defined $sides{$_} && $on_frame{$_} && _drawn_outside($sides{$_}, $_)
defined $sides{$_}
$on_frame{$_}
_drawn_outside($sides{$_}, $_)
Truth table100%4/4
A and B && C
A= defined $sides{$_}B= $on_frame{$_}C= _drawn_outside($sides{$_}, $_)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 36 | push @cells, { sides => { map { $_ => $sides{$_} } grep { defined $sides{$_} } keys %sides }, corners => \%corners, outer => \@outer }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 17 | push @result, \@cells; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 7 | return \@result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||