| 1 | # Copyright (c) 2024-2026 Philipp Schafft <lion@cpan.org> | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | # licensed under Artistic License 2.0 (see LICENSE file) | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | # ABSTRACT: generic module for extracting information from filesystems | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | package File::Information::VerifyResult; | ||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 1 | ▶ | use v5.10; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 1 | ▶ | use parent 'File::Information::VerifyBase'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 1 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 1 | ▶ | use File::Information::VerifyTestResult; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 1 | our $VERSION = v0.17; | |||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | # ---------------- | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 0 | ▶ | sub _new { | ||||||||||||||||||
|
Subroutine
_new: not called CC=10 SCAR=47.0
| |||||||||||||||||||||
| 25 | 0 | my ($pkg, %opts) = @_; | |||||||||||||||||||
| 26 | 0 | my $self = $pkg->SUPER::_new(%opts); | |||||||||||||||||||
| 27 | 0 | my %tests; | |||||||||||||||||||
| 28 | my $failed; | ||||||||||||||||||||
| 29 | 0 | my %passed_by_class; | |||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | 0 | $self->{tests} = \%tests; | |||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | 0 | foreach my $name (File::Information::VerifyTestResult->_supported_tests) { | |||||||||||||||||||
| 34 | 0 | my $res = File::Information::VerifyTestResult->_new(test => $name, %opts{'instance', 'base', 'base_from', 'base_to', 'extractor', 'db', 'lifecycle_from', 'lifecycle_to'}); | |||||||||||||||||||
| 35 | 0 | ▶ | my $class = $res->can('_class') ? $res->_class : $res->isa(__PACKAGE__) ? File::Information::VerifyTestResult->CLASS_STRONG : File::Information::VerifyTestResult->CLASS_WEAK; | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 36 | 0 | $tests{$name} = $res; | |||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 0 | ▶ | $failed ||= $res->has_failed; | ||||||||||||||||||
|
Condition0%0/3
$failed ||= $res->has_failed
MC/DC0%0/2
$failed ||= $res->has_failed
$failed
$res->has_failed
Truth table0%0/3
A ||= B
A= $failedB= $res->has_failed
| |||||||||||||||||||||
| 39 | 0 | ▶ | $passed_by_class{$class} ||= $res->has_passed; | ||||||||||||||||||
|
Condition0%0/3
$passed_by_class{$class} ||= $res->has_passed
MC/DC0%0/2
$passed_by_class{$class} ||= $res->has_passed
$passed_by_class{$class}
$res->has_passed
Truth table0%0/3
A ||= B
A= $passed_by_class{$class}B= $res->has_passed
| |||||||||||||||||||||
| 40 | } | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 0 | ▶ | if ($failed) { | ||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||
| 43 | 0 | $self->{status} = $pkg->STATUS_FAILED; | |||||||||||||||||||
| 44 | ▶ | } elsif ($passed_by_class{File::Information::VerifyTestResult->CLASS_METADATA} && $passed_by_class{File::Information::VerifyTestResult->CLASS_STRONG}) { | |||||||||||||||||||
|
Condition0%0/3
$passed_by_class{"File::Information::VerifyTestResult"->CLASS_METADATA} and $passed_by_class{"File::Information::VerifyTestResult"->CLASS_STRONG}
MC/DC0%0/2
$passed_by_class{"File::Information::VerifyTestResult"->CLASS_METADATA} and $passed_by_class{"File::Information::VerifyTestResult"->CLASS_STRONG}
$passed_by_class{"File::Information::VerifyTestResult"->CLASS_METADATA}
$passed_by_class{"File::Information::VerifyTestResult"->CLASS_STRONG}
Truth table0%0/3
A and B
A= $passed_by_class{"File::Information::VerifyTestResult"->CLASS_METADATA}B= $passed_by_class{"File::Information::VerifyTestResult"->CLASS_STRONG}
| |||||||||||||||||||||
| 45 | 0 | $self->{status} = $pkg->STATUS_PASSED; | |||||||||||||||||||
| 46 | 0 | } elsif (scalar grep {$_} values %passed_by_class) { | |||||||||||||||||||
| 47 | 0 | $self->{status} = $pkg->STATUS_INSUFFICIENT_DATA; | |||||||||||||||||||
| 48 | } else { | ||||||||||||||||||||
| 49 | 0 | $self->{status} = $pkg->STATUS_NO_DATA; | |||||||||||||||||||
| 50 | } | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | 0 | return $self; | |||||||||||||||||||
| 53 | } | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | 1 | 1; | |||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | __END__ | ||||||||||||||||||||