| 1 | package | ||||||||||||||||||||||||||||
| 2 | ContentOfRandomFileTestOptions; | ||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use base qw/RandomFileMethodAllTests/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use File::Random; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | sub _no_cvs_subdir_check($); | ||||||||||||||||||||||||||||
| 11 | sub _guess_filename(@); | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | # Replace random_file with calling content_of_random_file | ||||||||||||||||||||||||||||
| 14 | # Analyze the content and return the file name because of the analysis | ||||||||||||||||||||||||||||
| 15 | sub random_file { | ||||||||||||||||||||||||||||
| 16 | 18060 | ▶ | my ($self, %args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
random_file: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 17 | my @content = $self->content_of_random_file( | ||||||||||||||||||||||||||||
| 18 | %args, | ||||||||||||||||||||||||||||
| 19 | (exists($args{-check}) and (ref($args{-check}) !~ /CODE|Regexp/)) | ||||||||||||||||||||||||||||
| 20 | ? () # -check option without a sensful value, should surely fail | ||||||||||||||||||||||||||||
| 21 | : (-check => _no_cvs_subdir_check $args{-check}) | ||||||||||||||||||||||||||||
| 22 | 18060 | ▶ | ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
exists $args{"-check"} and not ref($args{"-check"}) =~ /CODE|Regexp/
MC/DC100%2/2
exists $args{"-check"} and not ref($args{"-check"}) =~ /CODE|Regexp/
exists $args{"-check"}
not ref($args{"-check"}) =~ /CODE|Regexp/
Truth table100%3/3
A and not(B)
A= exists $args{"-check"}B= not ref($args{"-check"}) =~ /CODE|Regexp/
| |||||||||||||||||||||||||||||
| 23 | 18024 | return _guess_filename @content; | |||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | sub _no_cvs_subdir_check($) { | ||||||||||||||||||||||||||||
| 27 | 84000 | ▶ | my $check = shift() || sub {"no checking done - always true"}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.1
Subroutine
_no_cvs_subdir_check: called CC=2 SCAR=7.0
Condition66%2/3
shift() || sub {
'no checking done - always true';
}
MC/DC0%0/2
shift() || sub {
'no checking done - always true';
}
shift()
sub {
'no checking done - always true';
}
Truth table66%2/3
A || B
A= shift()B= sub {
'no checking done - always true';
}
| |||||||||||||||||||||||||||||
| 28 | return sub { | ||||||||||||||||||||||||||||
| 29 | 135000 | ▶ | return 0 if /CVS/; # filename seems to be in a CVS subdir | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.1
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | 135000 | ▶ | ref($check) eq 'Regexp' ? return /$check/ : return $check->(@_) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | 18042 | }; | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | # In the fileX files there's only one line "Content: fileX" | ||||||||||||||||||||||||||||
| 35 | # In the [xyz].dat files there are some lines, the 4th line contains the fname | ||||||||||||||||||||||||||||
| 36 | sub _guess_filename(@) { | ||||||||||||||||||||||||||||
| 37 | 18024 | ▶ | $_[0] and $_[0] =~ /^Content: (.*)$/ and return $1; | ||||||||||||||||||||||||||
|
Subroutine
_guess_filename: called CC=5 SCAR=16.1
Branch: 1 branch
Condition100%3/3
$_[0] and $_[0] =~ /^Content: (.*)$/
MC/DC100%2/2
$_[0] and $_[0] =~ /^Content: (.*)$/
$_[0]
$_[0] =~ /^Content: (.*)$/
Truth table100%3/3
A and B
A= $_[0]B= $_[0] =~ /^Content: (.*)$/
| |||||||||||||||||||||||||||||
| 38 | 5184 | ▶ | $_[3] and chomp($_[3]),$_[3] =~ /^(\w\.dat)$/ and return $1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$_[3] and chomp $_[3], $_[3] =~ /^(\w\.dat)$/
MC/DC50%1/2
$_[3] and chomp $_[3], $_[3] =~ /^(\w\.dat)$/
$_[3]
chomp $_[3], $_[3] =~ /^(\w\.dat)$/
Truth table66%2/3
A and B
A= $_[3]B= chomp $_[3], $_[3] =~ /^(\w\.dat)$/
| |||||||||||||||||||||||||||||
| 39 | 2274 | return undef; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 1 | 1; | |||||||||||||||||||||||||||