blib/lib/CXC/Gnuplot/V0/Axis.pm

filter: Statementstmt 75.4% 40 / 53 Branchbran 0.0% 0 / 26 Conditioncond 0.0% 0 / 15 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 66.6% 10 / 15 Podpod 100% 3 / 3 totaltotal 43.4% 53 / 122 CC 19 SCAR 42.3
CC
19
Cov
43%
__ANON__
132.0
to_hash
90.0
croak
2.0
CRAP 69.0
« blib/lib/CXC/Gnuplot/V0/AxisRange.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/Bound.pm »
1 package CXC::Gnuplot::V0::Axis;
2  
3 1 ▶use v5.38;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use experimental 'builtin', 'declared_refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Feature::Compat::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = 'v0.29.3';
8  
9 class CXC::Gnuplot::V0::Axis;
10  
11 1 ▶no namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶use Syntax::Operator::Elem 'elem_str';
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 ▶use builtin 'is_bool', 'true';
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶use CXC::Gnuplot::V0::AxisFormat;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 use CXC::Gnuplot::V0::Types
20 1 -lexical => 'is_PositiveNum',
21 1 ▶ 'NonEmptyStr', 'SetFormats', 'signature_for';
Subroutine BEGIN: called CC=1 SCAR=0.0
22 use CXC::Gnuplot::V0::Util
23 1 -lexical => 'assert_coerce_object',
24 'clone_object', 'pvalidate', 'to_hash_r', 'render_opts',
25 1 ▶ 'render_set';
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 my sub croak {
28 0 ▶ require Carp;
Subroutine croak: not called CC=1 SCAR=6.9
29 0 goto \&Carp::croak;
30 }
31  
32 #<<< no tidy
33 1 field $range :param :reader = undef;
34 1 field $label :param :reader = undef;
35 1 field $format :param :reader = undef;
36 1 field $logscale :param :reader = undef;
37 1 field $logscalebase :param :reader = undef;
38 1 field $data :param :reader = undef;
39 1 field $tics :param :reader = undef;
40 1 field $mtics :param :reader = undef;
41  
42 #>>>
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68 ADJUST {
69  
70 0 ▶ pvalidate( format => AxisFormat => \$format );
Subroutine __ANON__: not called CC=11 SCAR=48.8
71  
72 0 pvalidate( range => AxisRange => \$range );
73 0 pvalidate( label => AxisLabel => \$label );
74  
75 0 ▶ defined $tics
Branch: 1 branch
BranchTrueFalseTotal
defined $tics and not builtin::is_bool($tics) and pvalidate "tics", "AxisTics", \$tics 0 0 0
Condition0%0/3
defined $tics and not builtin::is_bool($tics)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $tics and not builtin::is_bool($tics)
defined $tics not builtin::is_bool($tics)
Truth table0%0/3
A and not(B)
A= defined $ticsB= not builtin::is_bool($tics)
ABresult
0X0
100
111
76 and !is_bool( $tics )
77 and pvalidate( tics => AxisTics => \$tics );
78  
79 0 ▶ defined $mtics
Branch: 1 branch
BranchTrueFalseTotal
defined $mtics and not builtin::is_bool($mtics) and pvalidate "mtics", "AxisMinorTics", \$mtics 0 0 0
Condition0%0/3
defined $mtics and not builtin::is_bool($mtics)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $mtics and not builtin::is_bool($mtics)
defined $mtics not builtin::is_bool($mtics)
Truth table0%0/3
A and not(B)
A= defined $mticsB= not builtin::is_bool($mtics)
ABresult
0X0
100
111
80 and !is_bool( $mtics )
81 and pvalidate( mtics => AxisMinorTics => \$mtics );
82  
83 #<<< no tidy
84 0 ▶ defined $data
Branch: 1 branch
BranchTrueFalseTotal
defined $data and not elem_str($data, "normal", "time") and croak "invalid value for \"data\" parameter" 0 0 0
Condition0%0/3
defined $data and not elem_str($data, "normal", "time")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $data and not elem_str($data, "normal", "time")
defined $data not elem_str($data, "normal", "time")
Truth table0%0/3
A and not(B)
A= defined $dataB= not elem_str($data, "normal", "time")
ABresult
0X0
100
111
85 and ! elem_str( $data, 'normal', 'time' )
86 and croak( q{invalid value for "data" parameter} );
87 #>>>
88  
89 0 ▶ defined $logscale
Branch: 1 branch
BranchTrueFalseTotal
defined $logscale and not builtin::is_bool($logscale) and croak "invalid value for \"logscale\" parameter; must be bool" 0 0 0
Condition0%0/3
defined $logscale and not builtin::is_bool($logscale)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $logscale and not builtin::is_bool($logscale)
defined $logscale not builtin::is_bool($logscale)
Truth table0%0/3
A and not(B)
A= defined $logscaleB= not builtin::is_bool($logscale)
ABresult
0X0
100
111
90 and !is_bool( $logscale )
91 and croak( q{invalid value for "logscale" parameter; must be bool} );
92  
93 0 ▶ defined $logscalebase
Branch: 1 branch
BranchTrueFalseTotal
defined $logscalebase and not is_PositiveNum $logscalebase and croak "invalid value for \"logscalebase\" parameter; must be positive float" 0 0 0
Condition0%0/3
defined $logscalebase and not is_PositiveNum $logscalebase
!ll&&!rl&&r
000
MC/DC0%0/2
defined $logscalebase and not is_PositiveNum $logscalebase
defined $logscalebase not is_PositiveNum $logscalebase
Truth table0%0/3
A and not(B)
A= defined $logscalebaseB= not is_PositiveNum $logscalebase
ABresult
0X0
100
111
94 and !is_PositiveNum( $logscalebase )
95 and croak( q{invalid value for "logscalebase" parameter; must be positive float} );
96  
97 }
98  
99  
100  
101  
102  
103 method to_hash {
104  
105 0 ▶ to_hash_r( {
Subroutine to_hash: not called CC=9 SCAR=45.0
Pod documented
Branch: 8 branches
BranchTrueFalseTotal
defined $range ? : 0 0 0
defined $label ? : 0 0 0
defined $format ? : 0 0 0
defined $logscale ? : 0 0 0
defined $logscalebase ? : 0 0 0
defined $data ? : 0 0 0
defined $tics ? : 0 0 0
defined $mtics ? : 0 0 0
106 ( defined $range ? ( range => $range ) : () ),
107 ( defined $label ? ( label => $label ) : () ),
108 ( defined $format ? ( format => $format ) : () ),
109 ( defined $logscale ? ( logscale => $logscale ) : () ),
110 ( defined $logscalebase ? ( logscalebase => $logscalebase ) : () ),
111 ( defined $data ? ( data => $data ) : () ),
112 ( defined $tics ? ( tics => $tics ) : () ),
113 ( defined $mtics ? ( mtics => $mtics ) : () ),
114 } );
115 }
116  
117  
118  
119  
120  
121 ▶sub assert_coerce( $class, $args ) {
Subroutine assert_coerce: not called CC=1 SCAR=6.9
Pod documented
122 0 assert_coerce_object( $class, $args );
123 }
124  
125  
126  
127  
128  
129 ▶method clone ( %args ) {
Subroutine clone: not called CC=1 SCAR=6.9
Pod documented
130 0 clone_object( $self, \%args );
131 }
132  
133  
134  
135  
136  
137  
138 1 signature_for set => (
139 method => 1,
140 head => [NonEmptyStr],
141 named => [
142 as => SetFormats,
143 { default => 'string' },
144 ],
145 );
146  
147 method set( $axis, $opt ) {
148  
149 ## no critic(NamingConventions::ProhibitAmbiguousNames)
150 my @set;
151  
152 push @set, $range->set( $axis, as => $opt->as )
153 if defined $range;
154  
155 push @set, render_opts( [ set => $axis . 'label' ], $label );
156  
157 push @set, render_opts( [ set => 'format', $axis ], $format );
158  
159 if ( defined $tics ) {
160 my $key = $axis . 'tics';
161 push @set, is_bool( $tics )
162 ? $tics
163 ? [ set => $key ]
164 : [ unset => $key ]
165 : render_opts( [ set => $key ], $tics );
166 }
167  
168 if ( defined $mtics ) {
169 my $key = 'm' . $axis . 'tics';
170 push @set, is_bool( $mtics )
171 ? $mtics
172 ? [ set => $key ]
173 : [ unset => $key ]
174 : render_opts( [ set => $key ], $mtics );
175 }
176  
177 push @set, [ set => $axis . 'data', ( $data eq 'normal' ? () : $data ) ]
178 if defined $data;
179  
180 push @set, [ set => 'logscale', [ $axis, defined $logscalebase ? $logscalebase : () ] ]
181 if defined $logscale && $logscale;
182  
183 return render_set( \@set, $opt->as );
184 }
185  
186  
187 1 1;
188  
189 #
190 # This file is part of CXC-Gnuplot
191 #
192 # This software is Copyright (c) 2024 by Smithsonian Astrophysical Observatory.
193 #
194 # This is free software, licensed under:
195 #
196 # The GNU General Public License, Version 3, June 2007
197 #
198  
199 __END__
« blib/lib/CXC/Gnuplot/V0/AxisRange.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/Bound.pm »