Semantic/Test.pm

filter: Statementstmt 32.0% 16 / 50 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 14 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 50.0% 6 / 12 Podpod 100% 6 / 6 totaltotal 30.1% 28 / 93 CC 14 SCAR 39.2
CC
14
Cov
24%
run
110.0
PLAN
30.0
munge_args
2.0
CRAP 50.6
↑ Summary Semantic/RegexpAdapter.pm »
1 1 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Data::Semantic::Test;
6 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 $Data::Semantic::Test::VERSION = '1.101620';
8 }
9  
10 # ABSTRACT: Testing Data::Semantic objects
11 1 ▶use Test::More;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use parent 'Test::CompanionClasses::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 0 ▶sub PLAN {
Subroutine PLAN: not called CC=5 SCAR=34.0
Pod documented
15 0 my $self = shift;
16 0 my $plan = 0;
17 0 for my $test ($self->TESTDATA) {
18 0 ▶ my %normalize = %{ $test->{normalize} || {} };
Condition0%0/2
$test->{'normalize'} || {}
l!l
00
MC/DC0%0/1
$test->{'normalize'} || {}
$test->{'normalize'}
Truth table0%0/2
A
A= $test->{'normalize'}
Aresult
11
00
19 $plan +=
20 0 ▶ @{ $test->{valid} || [] } +
Condition0%0/2
$test->{'valid'} || []
l!l
00
MC/DC0%0/1
$test->{'valid'} || []
$test->{'valid'}
Truth table0%0/2
A
A= $test->{'valid'}
Aresult
11
00
21 0 ▶ @{ $test->{invalid} || [] } +
Condition0%0/2
$test->{'invalid'} || []
l!l
00
MC/DC0%0/1
$test->{'invalid'} || []
$test->{'invalid'}
Truth table0%0/2
A
A= $test->{'invalid'}
Aresult
11
00
22 keys %normalize;
23 }
24 0 $plan;
25 }
26  
27 0 ▶sub munge_args {
Subroutine munge_args: not called CC=1 SCAR=6.9
Pod documented
28 0 my ($self, %args) = @_;
29 0 %args;
30 }
31  
32 0 ▶sub test_is_valid {
Subroutine test_is_valid: not called CC=1 SCAR=6.9
Pod documented
33 0 my ($self, $obj, $value, $testname) = @_;
34 0 ok($obj->is_valid($value), $testname);
35 }
36  
37 0 ▶sub test_is_invalid {
Subroutine test_is_invalid: not called CC=1 SCAR=6.9
Pod documented
38 0 my ($self, $obj, $value, $testname) = @_;
39 0 ok(!$obj->is_valid($value), $testname);
40 }
41  
42 0 ▶sub test_normalize {
Subroutine test_normalize: not called CC=1 SCAR=6.9
Pod documented
43 0 my ($self, $obj, $value, $expect, $testname) = @_;
44 0 is($obj->normalize($value), $expect, $testname);
45 }
46  
47 0 ▶sub run {
Subroutine run: not called CC=10 SCAR=47.0
Pod documented
48 0 my $self = shift;
49 0 $self->SUPER::run(@_);
50 0 for my $test ($self->TESTDATA) {
51 0 ▶ my %args = $self->munge_args(%{ $test->{args} || {} });
Condition0%0/2
$test->{'args'} || {}
l!l
00
MC/DC0%0/1
$test->{'args'} || {}
$test->{'args'}
Truth table0%0/2
A
A= $test->{'args'}
Aresult
11
00
52  
53 # string representation for test name
54 0 my $args = join ',' => map { "$_=$args{$_}" }
55 sort keys %args;
56 0 ▶ $args = '(none)' unless length $args;
Branch: 1 branch
BranchTrueFalseTotal
unless length $args 0 0 0
57 0 my $obj = $self->make_real_object(%args);
58 $self->test_is_valid($obj, $_, "VALID $args: $_")
59 0 ▶ for @{ $test->{valid} || [] };
Condition0%0/2
$test->{'valid'} || []
l!l
00
MC/DC0%0/1
$test->{'valid'} || []
$test->{'valid'}
Truth table0%0/2
A
A= $test->{'valid'}
Aresult
11
00
60  
61 # If a value is not even well-formed, it most certainly is not valid,
62 # so add these tests as well.
63 $self->test_is_invalid($obj, $_, "INVALID $args: $_")
64 0 ▶ for @{ $test->{invalid} || [] };
Condition0%0/2
$test->{'invalid'} || []
l!l
00
MC/DC0%0/1
$test->{'invalid'} || []
$test->{'invalid'}
Truth table0%0/2
A
A= $test->{'invalid'}
Aresult
11
00
65 0 ▶ my %normalize = %{ $test->{normalize} || {} };
Condition0%0/2
$test->{'normalize'} || {}
l!l
00
MC/DC0%0/1
$test->{'normalize'} || {}
$test->{'normalize'}
Truth table0%0/2
A
A= $test->{'normalize'}
Aresult
11
00
66 0 ▶ while (my ($value, $expect) = each %normalize) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %normalize) 0 0 0
67 0 $self->test_normalize($obj, $value, $expect, "normalize($value)");
68 }
69 }
70 }
71 1 1;
72  
73  
74 __END__
↑ Summary Semantic/RegexpAdapter.pm »