RST/Case.pm

filter: Statementstmt 17.8% 10 / 56 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 20.0% 3 / 15 Podpod 72.7% 8 / 11 totaltotal 22.1% 21 / 95 CC 9 SCAR 23.0
CC
9
Cov
15%
suites
30.0
dependants
12.0
maturity
6.0
CRAP 10.0
« RST/DataProvider.pm ↑ Summary RST/Text.pm »
1 package ICANN::RST::Case;
2 # ABSTRACT: an object representing an RST test case.
3 1 ▶use List::Util qw(any);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use base qw(ICANN::RST::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 0 ▶sub summary { $_[0]->{'Summary'} }
Subroutine summary: not called CC=1 SCAR=6.9
Pod documented
8 0 ▶sub description { ICANN::RST::Text->new($_[0]->{'Description'}) }
Subroutine description: not called CC=1 SCAR=6.9
Pod documented
9 0 ▶sub maturity { $_[0]->{'Maturity'} || 'ALPHA' }
Subroutine maturity: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{"Maturity"} or "ALPHA" 0 0 0
10  
11 sub title {
12 0 ▶ my $self = shift;
Subroutine title: not called CC=2 SCAR=17.9
Pod undocumented
13  
14 0 ▶ if ($self->summary) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->summary) { } 0 0 0
15 0 return sprintf('%s - %s', $self->id, $self->summary);
16  
17 } else {
18 0 return $self->id;
19  
20 }
21 }
22  
23 sub inputs {
24 0 ▶ my $self = shift;
Subroutine inputs: not called CC=1 SCAR=6.9
Pod documented
25  
26 0 return sort { $a->id cmp $b->id } map { $self->spec->input($_) } @{$self->{'Input-Parameters'}};
27 }
28  
29 sub resources {
30 0 ▶ my $self = shift;
Subroutine resources: not called CC=1 SCAR=6.9
Pod documented
31  
32 0 return sort { $a->id cmp $b->id } map { $self->spec->resource($_) } @{$self->{'Resources'}};
33 }
34  
35 sub errors {
36 0 ▶ my $self = shift;
Subroutine errors: not called CC=1 SCAR=6.9
Pod documented
37  
38 0 return sort { $a->id cmp $b->id } map { $self->spec->error($_) } @{$self->{'Errors'}};
39 }
40  
41 sub providers {
42 0 ▶ my $self = shift;
Subroutine providers: not called CC=1 SCAR=6.9
Pod documented
43  
44 0 return sort { $a->id cmp $b->id } map { $self->spec->provider($_) } @{$self->{'Data-Providers'}};
45 }
46  
47 sub dependencies {
48 0 ▶ my $self = shift;
Subroutine dependencies: not called CC=1 SCAR=6.9
Pod documented
49  
50 0 return sort { $a->id cmp $b->id } map { $self->spec->case($_) } @{$self->{'Dependencies'}};
51 }
52  
53 sub dependants {
54 0 ▶ my $self = shift;
Subroutine dependants: not called CC=3 SCAR=24.8
Pod undocumented
55  
56 0 my @cases;
57  
58 0 foreach my $case ($self->spec->cases) {
59 0 ▶ push(@cases, $case) if (any { $_->id eq $self->id } $case->dependencies);
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if &any(sub { $_->id eq $self->id; } , $case->dependencies) 0 0 0
60 }
61  
62 0 return sort { $a->id cmp $b->id } @cases;
63 }
64  
65 sub suites {
66 0 ▶ my $self = shift;
Subroutine suites: not called CC=5 SCAR=34.0
Pod documented
67  
68 0 my %suites;
69  
70 0 foreach my $suite ($self->spec->suites) {
71 0 foreach my $case ($suite->cases) {
72 0 ▶ $suites{$suite->id} = $suite if ($case->id eq $self->id && !defined($suites{$suite->id}));
Branch: 1 branch
BranchTrueFalseTotal
if $case->id eq $self->id and not defined $suites{$suite->id} 0 0 0
Condition0%0/3
$case->id eq $self->id and not defined $suites{$suite->id}
!ll&&!rl&&r
000
MC/DC0%0/2
$case->id eq $self->id and not defined $suites{$suite->id}
$case->id eq $self->id not defined $suites{$suite->id}
Truth table0%0/3
A and not(B)
A= $case->id eq $self->idB= not defined $suites{$suite->id}
ABresult
0X0
100
111
73 }
74 }
75  
76 0 return sort { $a->order <=> $b->order } values(%suites);
77 }
78  
79 1 1;
80  
81 __END__
82  
83 =pod
84  
85 =encoding UTF-8
86  
87 =head1 NAME
88  
89 ICANN::RST::Case - an object representing an RST test case.
90  
91 =head1 VERSION
92  
93 version 0.03
94  
95 =head1 DESCRIPTION
96  
97 This class inherits from L<ICANN::RST::Base> (so it has the C<id()>,
98 C<order()> and C<spec()> methods).
99  
100 =head1 METHODS
101  
102 =head2 summary()
103  
104 Short textual description of the test case.
105  
106 =head2 description()
107  
108 A L<ICANN::RST::Text> object containing the long textual description of the test
109 case.
110  
111 =head2 inputs()
112  
113 A list of L<ICANN::RST::Input> objects required by this test case.
114  
115 =head2 resources
116  
117 A list of L<ICANN::RST::Resource> objects required by this test case.
118  
119 =head2 errors
120  
121 A list of L<ICANN::RST::Error> objects which may be produced by this test case.
122  
123 =head2 dependencies()
124  
125 A list of test cases that this test case depends on.
126  
127 =head2 dependents()
128  
129 A list of test cases that depend on this test case.
130  
131 =head2 suites()
132  
133 A list of all L<ICANN::RST::Suite> objects that use this test case.
134  
135 =head2 providers()
136  
137 A list of all L<ICANN::RST::DataProvider> objects used by this test case.
138  
139 =head1 AUTHOR
140  
141 Gavin Brown <gavin.brown@icann.org>
142  
143 =head1 COPYRIGHT AND LICENSE
144  
145 This software is copyright (c) 2025 by Internet Corporation for Assigned Names and Number (ICANN).
146  
147 This is free software; you can redistribute it and/or modify it under
148 the same terms as the Perl 5 programming language system itself.
149  
150 =cut
« RST/DataProvider.pm ↑ Summary RST/Text.pm »