Branch Coverage

blib/lib/Language/RAM.pm
Criterion Covered Total %
branch 129 186 69.3


line true false branch
120 0 0 if $_ eq ''
122 0 0 unless defined $value
123 0 0 if $n_ip == -1
158 0 0 if @_ >= 3
165 0 0 if $_[3]
170 0 0 unless defined $input
177 0 0 unless ($current)
181 0 0 unless (exists $machine->{'stats'}{'command_usage'}{$machine->{'ip'}})
186 0 0 if $_[3]
188 0 0 unless &eval($current, $machine, 0, $_[3])
194 0 0 if ($limit > 0 and $machine->{'steps'} == $limit)
297 0 0 unless exists $snapshots->{$_}[1]
304 0 0 unless defined $input
348 0 0 unless exists $step->[1]
393 2 4 if ($l =~ /\A(\d+):\s*(.+)/)
402 3 3 if ($l =~ /\A(INPUT|OUTPUT)(.*)\Z/)
403 1 2 if ($2 eq '')
408 1 1 if ($1 eq 'INPUT') { }
438 4 6 if (index($_[0], ' ') != -1) { }
443 2 4 if $_ eq ''
445 0 4 unless $r
449 1 3 if (@{$ret;} == 0)
454 1 5 if ($_[0] =~ /\A(\d+)..(\d+)\Z/) { }
4 1 elsif ($_[0] =~ /\A(\d+)\Z/) { }
486 30 94 if ($_[0] =~ /\A(\-?\d+(?:\.\d+)?)\Z/) { }
62 32 elsif ($_[0] =~ /\A(a|i|i1|i2|i3)\Z/) { }
13 19 elsif ($_[0] =~ /\As\[\s*(.+?)\s*\]\Z/) { }
3 16 elsif ($_[0] =~ /\Ajump\s+(.+)\s*\Z/) { }
3 13 elsif ($_[0] =~ /\A(.+?)\s*<--?\s*(.+?)\s*\Z/) { }
2 11 elsif ($_[0] =~ /\A(.+?)\s*(<|<=|!?=|>=|>)\s*0\Z/) { }
0 11 elsif ($_[0] =~ /\Aif\s+(.+?)\s+then\s+(.+)\Z/) { }
11 0 elsif ($_[0] =~ /\A(.+?)\s*(\+|\-|\*|div|mod)\s*(.+)\Z/) { }
0 0 elsif ($_[0] eq 'HALT') { }
489 0 62 $1 eq 'i' ? :
584 0 18 unless my $left = &get_ast($_[0], $_[3], $_[4])
585 0 18 unless my $right = &get_ast($_[2], $_[3], $_[4])
587 1 17 unless $left->[0] eq 'reg'
590 1 16 unless exists $algo_right{$right->[0]}
594 1 10 unless $type or $right->[0] eq 'imm' and $_[1] eq '+' || $_[1] eq '-'
619 0 18 unless my $inner = &get_ast(@_)
621 6 12 if $inner->[0] eq 'imm'
623 10 2 if ($inner->[0] eq 'algo') { }
1 1 elsif ($inner->[0] eq 'reg' and $inner->[1] ne 'a') { }
624 1 9 unless $inner->[1] == 0
662 0 27 unless my $reg = &get_ast($_[0], $_[2], $_[3])
664 1 26 unless $reg->[0] eq 'reg'
689 0 5 unless my $dest = &get_ast(@_)
691 1 4 unless $dest->[0] eq 'imm'
726 0 3 unless my $cond = &get_ast($_[0], $_[2], $_[3])
728 1 2 unless $cond->[0] eq 'cond'
731 0 2 unless my $jump = &get_ast($_[1], $_[2], $_[3])
732 1 1 unless $jump->[0] eq 'jump'
769 0 15 unless my $left = &get_ast($_[0], $_[2], $_[3])
770 0 15 unless my $right = &get_ast($_[1], $_[2], $_[3])
772 10 5 if ($left->[0] eq 'reg') { }
2 3 elsif ($left->[0] eq 'mem') { }
2 1 elsif ($left->[0] eq 'mmem') { }
775 8 2 if ($left->[1] eq 'a') { }
776 1 7 unless $rcheck or exists $assign_a_right{$right->[0]}
779 1 1 unless $rcheck or $right->[0] eq 'algo'
782 1 0 unless not $right->[1] or $right->[0] ne 'algo'
785 1 1 unless $right->[0] eq 'reg'
788 1 1 unless $right->[0] eq 'reg' and $right->[1] eq 'a'
825 0 113 if ($_[0][0] eq 'halt')
828 113 0 if (exists $eval_funcs{$_[0][0]}) { }
880 75 12 unless defined $type
881 6 81 unless (exists $_[1]{'memory'}{$_[0][1]})
887 75 12 unless $type > 0
888 10 2 if $type == 1
903 0 13 unless defined(my $val = &eval($_[0][1], $_[1]))
926 0 32 unless defined(my $left = &eval($_[0][2], $_[1]))
927 0 32 unless defined(my $right = &eval($_[0][4], $_[1]))
929 17 15 if ($_[0][3] eq '+') { }
6 9 elsif ($_[0][3] eq '-') { }
3 6 elsif ($_[0][3] eq '*') { }
3 3 elsif ($_[0][3] eq 'div') { }
3 0 elsif ($_[0][3] eq 'mod') { }
964 0 20 unless defined(my $val = &eval($_[0][1], $_[1]))
966 4 16 if ($_[0][2] eq '<') { }
3 13 elsif ($_[0][2] eq '<=') { }
3 10 elsif ($_[0][2] eq '=') { }
3 7 elsif ($_[0][2] eq '!=') { }
3 4 elsif ($_[0][2] eq '>=') { }
4 0 elsif ($_[0][2] eq '>') { }
1003 0 2 unless defined(my $cond = &eval($_[0][1], $_[1]))
1004 1 1 if $cond
1027 0 2 unless defined(my $val = &eval($_[0][1], $_[1]))
1051 0 6 unless my $left = &eval($_[0][1], $_[1], 1)
1052 0 6 unless defined(my $right = &eval($_[0][2], $_[1]))
1054 0 6 if $_[1]{'snaps'}
1082 2 90 if $_[2] == 2
1084 17 73 unless (exists $_[0]{'stats'}{'memory_usage'}{$_[1]})
1088 12 78 $_[2] ? :