lib/Test/FitNesse/Slim/ConverterRegistry.pm

filter: Statementstmt 96.7% 449 / 464 Branchbran 78.5% 209 / 266 Conditioncond 64.2% 115 / 179 MC/DCmcdc 40.8% 40 / 98 Subroutinesub 96.7% 90 / 93 Podpod 100% 12 / 12 totaltotal 82.2% 915 / 1112 CC 206 SCAR 22.8
CC
206
Cov
85%
element_to_string
52.0
from_string
20.3
_days_in_month
17.1
CRAP 9.8
« lib/Test/FitNesse/Slim/Server.pm ↑ Summary lib/Test/FitNesse/Slim/List.pm »
1 package Test::FitNesse::Slim::ConverterRegistry;
2  
3 83 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 83 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 83 ▶use overload ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6 83 ▶use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 83 ▶use Test::FitNesse::Slim::MapResult;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 177 ▶sub _java_is_blank {
Subroutine _java_is_blank: called CC=2 SCAR=7.1
10 177 my ($value) = @_;
11 177 ▶ return 1 unless defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 177 177
12 177 return $value =~ /\A[\x{0009}-\x{000D}\x{001C}-\x{0020}\x{1680}\x{2000}-\x{2006}\x{2008}-\x{200A}\x{2028}\x{2029}\x{205F}\x{3000}]*\z/;
13 }
14  
15 178 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
16 178 my ($class) = @_;
17 178 my $self = bless {}, $class;
18 178 $self->reset;
19 178 return $self;
20 }
21  
22 178 ▶sub reset {
Subroutine reset: called CC=1 SCAR=0.0
Pod documented
23 178 my ($self) = @_;
24 $self->{converters} = {
25 178 'java.lang.String' => bless({}, 'Test::FitNesse::Slim::ConverterRegistry::String'),
26 'java.lang.Boolean' => bless({}, 'Test::FitNesse::Slim::ConverterRegistry::Boolean'),
27 'boolean' => bless({}, 'Test::FitNesse::Slim::ConverterRegistry::PrimitiveBoolean'),
28 'java.lang.Integer' => bless({}, 'Test::FitNesse::Slim::ConverterRegistry::Integer'),
29 int => bless({}, 'Test::FitNesse::Slim::ConverterRegistry::PrimitiveInteger'),
30 'java.lang.Long' => bless({}, 'Test::FitNesse::Slim::ConverterRegistry::Long'),
31 long => bless({}, 'Test::FitNesse::Slim::ConverterRegistry::PrimitiveLong'),
32 'java.lang.Double' => bless({}, 'Test::FitNesse::Slim::ConverterRegistry::Double'),
33 double => bless({}, 'Test::FitNesse::Slim::ConverterRegistry::PrimitiveDouble'),
34 'java.lang.Character' => bless({}, 'Test::FitNesse::Slim::ConverterRegistry::Character'),
35 char => bless({}, 'Test::FitNesse::Slim::ConverterRegistry::PrimitiveCharacter'),
36 'java.util.Date' => bless({}, 'Test::FitNesse::Slim::ConverterRegistry::Date'),
37 'void' => bless({}, 'Test::FitNesse::Slim::ConverterRegistry::Void'),
38 'java.util.List' => Test::FitNesse::Slim::ConverterRegistry::List->new($self),
39 'java.util.Collection' => Test::FitNesse::Slim::ConverterRegistry::List->new($self),
40 };
41 178 return $self;
42 }
43  
44 3 ▶sub add_converter {
Subroutine add_converter: called CC=5 SCAR=17.8
Pod documented
45 3 my ($self, $type, $converter) = @_;
46 3 ▶ die "converter must implement from_string and to_string\n"
Branch: 1 branch
BranchTrueFalseTotal
unless ref $converter and $converter->can("from_string") and $converter->can("to_string") 0 3 3
Condition33%2/6
ref $converter and $converter->can("from_string") and $converter->can("to_string")
!ll&&!rl&&r
003
ref $converter and $converter->can("from_string")
!ll&&!rl&&r
003
MC/DC0%0/3
ref $converter and $converter->can("from_string") and $converter->can("to_string")
ref $converter $converter->can("from_string") $converter->can("to_string")
Truth table25%1/4
A and B and C
A= ref $converterB= $converter->can("from_string")C= $converter->can("to_string")
ABCresult
0XX0
10X0
1100
1111
47 unless ref($converter)
48 && $converter->can('from_string')
49 && $converter->can('to_string');
50 3 $self->{converters}{$type} = $converter;
51 3 ▶ $converter->set_registry($self) if $converter->can('set_registry');
Branch: 1 branch
BranchTrueFalseTotal
if $converter->can("set_registry") 1 2 3
52 3 return;
53 }
54  
55 0 ▶sub remove_converter {
Subroutine remove_converter: not called CC=1 SCAR=6.9
Pod documented
56 0 my ($self, $type) = @_;
57 0 return delete $self->{converters}{$type};
58 }
59  
60 448 ▶sub validate_arity {
Subroutine validate_arity: called CC=6 SCAR=17.9
Pod documented
61 448 my ($self, $signature, $method, $actual, $kind, $class) = @_;
62 448 ▶ return unless $signature && exists $signature->{parameters};
Branch: 1 branch
BranchTrueFalseTotal
unless $signature and exists $signature->{"parameters"} 370 78 448
Condition100%3/3
$signature and exists $signature->{"parameters"}
!ll&&!rl&&r
3462478
MC/DC100%2/2
$signature and exists $signature->{"parameters"}
$signature exists $signature->{"parameters"}
Truth table100%3/3
A and B
A= $signatureB= exists $signature->{"parameters"}
ABresult
0X0
100
111
63  
64 78 my $parameters = $signature->{parameters};
65 78 ▶ die "invalid parameter signature for $method\n"
Branch: 1 branch
BranchTrueFalseTotal
unless ref $parameters eq "ARRAY" 0 78 78
66 unless ref($parameters) eq 'ARRAY';
67 78 my $expected = @$parameters;
68 78 ▶ return if $actual == $expected;
Branch: 1 branch
BranchTrueFalseTotal
if $actual == $expected 67 11 78
69  
70 11 ▶ if ($kind eq 'constructor') {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "constructor") 4 7 11
71 4 die "message:<<NO_CONSTRUCTOR $class\[$actual\]. Expected $expected arguments.>>\n"
72 . "Tried to invoke: $method\n";
73 }
74  
75 7 die "message:<<NO_METHOD_IN_CLASS No Method $method\[$actual\] in class $class. "
76 . "Expected $expected arguments.>>\nTried to invoke: $method\n";
77 }
78  
79 43 ▶sub validate_enum_types {
Subroutine validate_enum_types: called CC=15 SCAR=28.1
Pod documented
80 43 my ($self, $types) = @_;
81 43 ▶ return {} unless defined $types;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $types 0 43 43
82 43 ▶ die "enum declarations must be a hash reference\n" unless ref($types) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $types eq "HASH" 1 42 43
83  
84 42 my %aliases = map { $_ => 1 } qw(
85 String Boolean Character Date Double Integer Long List Collection
86 ArrayList LinkedList java.util.ArrayList java.util.LinkedList
87 );
88 42 my %copy;
89 42 for my $type (sort keys %$types) {
90 64 ▶ die "invalid enum type name\n"
Branch: 1 branch
BranchTrueFalseTotal
unless length $type and not $type =~ /\s/ and not $type =~ /[\[\]<>]/ 1 63 64
Condition66%4/6
length $type and not $type =~ /\s/ and not $type =~ /[\[\]<>]/
!ll&&!rl&&r
1063
length $type and not $type =~ /\s/
!ll&&!rl&&r
1063
MC/DC33%1/3
length $type and not $type =~ /\s/ and not $type =~ /[\[\]<>]/
length $type not $type =~ /\s/ not $type =~ /[\[\]<>]/
Truth table50%2/4
A and not(B) and not(C)
A= length $typeB= not $type =~ /\s/C= not $type =~ /[\[\]<>]/
ABCresult
0XX0
10X0
1100
1111
91 unless length($type) && $type !~ /\s/ && $type !~ /[\[\]<>]/;
92 die "enum type $type collides with a registered converter\n"
93 63 ▶ if exists $self->{converters}{$type} || $aliases{$type};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"converters"}{$type} or $aliases{$type} 2 61 63
Condition66%2/3
exists $self->{"converters"}{$type} or $aliases{$type}
l!l&&r!l&&!r
0261
MC/DC50%1/2
exists $self->{"converters"}{$type} or $aliases{$type}
exists $self->{"converters"}{$type} $aliases{$type}
Truth table66%2/3
A or B
A= exists $self->{"converters"}{$type}B= $aliases{$type}
ABresult
1X1
011
000
94 61 my $values = $types->{$type};
95 61 ▶ die "enum constants for $type must be an array reference\n"
Branch: 1 branch
BranchTrueFalseTotal
unless ref $values eq "ARRAY" 1 60 61
96 unless ref($values) eq 'ARRAY';
97 60 my %seen;
98 60 for my $value (@$values) {
99 177 ▶ die "invalid enum constant for $type\n"
Branch: 1 branch
BranchTrueFalseTotal
if not defined $value or ref $value or not length $value 0 177 177
Condition33%2/6
not defined $value or ref $value or not length $value
l!l&&r!l&&!r
00177
not defined $value or ref $value
l!l&&r!l&&!r
00177
MC/DC0%0/3
not defined $value or ref $value or not length $value
not defined $value ref $value not length $value
Truth table25%1/4
not(A) or B or not(C)
A= not defined $valueB= ref $valueC= not length $value
ABCresult
1XX1
01X1
0011
0000
100 if !defined($value) || ref($value) || !length($value);
101 177 ▶ die "duplicate enum constant $value for $type\n" if $seen{$value}++;
Branch: 1 branch
BranchTrueFalseTotal
if $seen{$value}++ 1 176 177
102 }
103 59 $copy{$type} = [@$values];
104 }
105 37 return \%copy;
106 }
107  
108 335 ▶sub get_converter {
Subroutine get_converter: called CC=14 SCAR=26.6
Pod documented
109 335 my ($self, $type, $enum_types) = @_;
110 335 ▶ return unless defined $type;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $type 0 335 335
111 335 ▶ return $self->{converters}{$type} if exists $self->{converters}{$type};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"converters"}{$type} 148 187 335
112 187 $type =~ s/\s+//g;
113 187 ▶ return $self->{converters}{'java.util.List'}
Branch: 1 branch
BranchTrueFalseTotal
if $type =~ /\Ajava\.util\.(?:ArrayList|LinkedList|Collection)\z/ 8 179 187
114 if $type =~ /\Ajava\.util\.(?:ArrayList|LinkedList|Collection)\z/;
115 179 ▶ return $self->{converters}{'java.lang.String'} if $type eq 'String';
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "String" 20 159 179
116 159 ▶ return $self->{converters}{'java.util.List'} if $type eq 'List';
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "List" 0 159 159
117 159 my %aliases = (
118 Boolean => 'java.lang.Boolean',
119 Character => 'java.lang.Character',
120 Date => 'java.util.Date',
121 Double => 'java.lang.Double',
122 Integer => 'java.lang.Integer',
123 Long => 'java.lang.Long',
124 );
125 159 ▶ return $self->{converters}{$aliases{$type}} if exists $aliases{$type};
Branch: 1 branch
BranchTrueFalseTotal
if exists $aliases{$type} 32 127 159
126  
127 return Test::FitNesse::Slim::ConverterRegistry::Enum->new($type, $enum_types->{$type})
128 127 ▶ if $enum_types && exists $enum_types->{$type};
Branch: 1 branch
BranchTrueFalseTotal
if $enum_types and exists $enum_types->{$type} 59 68 127
Condition100%3/3
$enum_types and exists $enum_types->{$type}
!ll&&!rl&&r
145459
MC/DC100%2/2
$enum_types and exists $enum_types->{$type}
$enum_types exists $enum_types->{$type}
Truth table100%3/3
A and B
A= $enum_typesB= exists $enum_types->{$type}
ABresult
0X0
100
111
129  
130 68 ▶ if ($type =~ /\A(.+)\[\]\z/ && $1 !~ /[\[\]<>]/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type =~ /\A(.+)\[\]\z/ and not $1 =~ /[\[\]<>]/) 26 42 68
Condition66%2/3
$type =~ /\A(.+)\[\]\z/ and not $1 =~ /[\[\]<>]/
!ll&&!rl&&r
42026
MC/DC50%1/2
$type =~ /\A(.+)\[\]\z/ and not $1 =~ /[\[\]<>]/
$type =~ /\A(.+)\[\]\z/ not $1 =~ /[\[\]<>]/
Truth table66%2/3
A and not(B)
A= $type =~ /\A(.+)\[\]\z/B= not $1 =~ /[\[\]<>]/
ABresult
0X0
100
111
131 26 ▶ my $component = $self->get_converter($1, $enum_types) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $component = $self->get_converter($1, $enum_types) or return 26 0 26
132 26 return Test::FitNesse::Slim::ConverterRegistry::TypedSequence->new(
133 $self, $component
134 );
135 }
136 42 ▶ if ($type =~ /\A(?:java\.util\.)?(?:List|Collection)<([^<>]+)>\z/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type =~ /\A(?:java\.util\.)?(?:List|Collection)<([^<>]+)>\z/) 33 9 42
137 33 ▶ my $component = $self->get_converter($1, $enum_types) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $component = $self->get_converter($1, $enum_types) or return 33 0 33
138 33 return Test::FitNesse::Slim::ConverterRegistry::TypedSequence->new(
139 $self, $component
140 );
141 }
142 9 return;
143 }
144  
145 4 ▶sub converter_for_runtime_value {
Subroutine converter_for_runtime_value: called CC=3 SCAR=11.3
Pod documented
146 4 my ($self, $value) = @_;
147 4 ▶ return unless ref $value;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $value 0 4 4
148 4 my $class = ref $value;
149 4 ▶ return $self->get_converter($class) if $class ne 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if $class ne "ARRAY" 0 4 4
150 4 return $self->get_converter('java.util.ArrayList');
151 }
152  
153 15 ▶sub element_to_string {
Subroutine element_to_string: called CC=11 SCAR=39.5
Pod documented
154 15 my ($self, $value) = @_;
155 15 ▶ return 'null' unless defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 1 14 15
156 14 ▶ return "$value" unless ref $value;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $value 13 1 14
157  
158 1 my $converter = $self->converter_for_runtime_value($value);
159 1 ▶ return $converter->to_string($value) if $converter;
Branch: 1 branch
BranchTrueFalseTotal
if $converter 1 0 1
160 0 ▶ return Test::FitNesse::Slim::MapResult->convert($value) if ref($value) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if ref $value eq "HASH" 0 0 0
161 0 ▶ return $value->to_string if blessed($value) && $value->can('to_string');
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($value) and $value->can("to_string") 0 0 0
Condition0%0/3
builtin::blessed($value) and $value->can("to_string")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($value) and $value->can("to_string")
builtin::blessed($value) $value->can("to_string")
Truth table0%0/3
A and B
A= builtin::blessed($value)B= $value->can("to_string")
ABresult
0X0
100
111
162 0 ▶ return $value->toString if blessed($value) && $value->can('toString');
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($value) and $value->can("toString") 0 0 0
Condition0%0/3
builtin::blessed($value) and $value->can("toString")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($value) and $value->can("toString")
builtin::blessed($value) $value->can("toString")
Truth table0%0/3
A and B
A= builtin::blessed($value)B= $value->can("toString")
ABresult
0X0
100
111
163 0 ▶ return "$value" if blessed($value) && overload::Method($value, '""');
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($value) and overload::Method($value, "\"\"") 0 0 0
Condition0%0/3
builtin::blessed($value) and overload::Method($value, "\"\"")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($value) and overload::Method($value, "\"\"")
builtin::blessed($value) overload::Method($value, "\"\"")
Truth table0%0/3
A and B
A= builtin::blessed($value)B= overload::Method($value, "\"\"")
ABresult
0X0
100
111
164  
165 0 die 'Cannot convert reference value of type ' . ref($value);
166 }
167  
168 97 ▶sub convert_arguments {
Subroutine convert_arguments: called CC=8 SCAR=20.8
Pod documented
169 97 my ($self, $signature, $method, @args) = @_;
170 97 ▶ my $types = $signature->{parameters} || [];
Condition100%2/2
$signature->{'parameters'} || []
l!l
7324
MC/DC100%1/1
$signature->{'parameters'} || []
$signature->{'parameters'}
Truth table100%2/2
A
A= $signature->{'parameters'}
Aresult
11
00
171 97 my $enum_types = $signature->{enum_types};
172 97 for my $index (0 .. $#args) {
173 81 ▶ next if !defined $args[$index] || ref $args[$index];
Branch: 1 branch
BranchTrueFalseTotal
if not defined $args[$index] or ref $args[$index] 10 71 81
Condition100%3/3
not defined $args[$index] or ref $args[$index]
l!l&&r!l&&!r
3771
MC/DC100%2/2
not defined $args[$index] or ref $args[$index]
not defined $args[$index] ref $args[$index]
Truth table100%3/3
not(A) or B
A= not defined $args[$index]B= ref $args[$index]
ABresult
1X1
011
000
174 71 my $type = $types->[$index];
175 71 ▶ next unless defined $type;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $type 2 69 71
176 69 my $converter = $self->get_converter($type, $enum_types);
177 69 ▶ die "message:<<NO_CONVERTER_FOR_ARGUMENT_NUMBER $type.>>\nTried to invoke: $method\n"
Branch: 1 branch
BranchTrueFalseTotal
unless $converter 1 68 69
178 unless $converter;
179 68 my $converted = eval { $converter->from_string($args[$index]) };
180 68 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 12 56 68
181 12 my $error = $@;
182 12 chomp $error;
183 12 $error =~ s/\Amessage:<<//;
184 12 $error =~ s/>>\z//;
185 12 die "message:<<$error>>\nTried to invoke: $method\n";
186 }
187 56 $args[$index] = $converted;
188 }
189 84 return @args;
190 }
191  
192 80 ▶sub convert_result {
Subroutine convert_result: called CC=7 SCAR=20.6
Pod documented
193 80 my ($self, $signature, $value) = @_;
194 80 ▶ return ($value, 0) unless $signature && defined $signature->{return};
Branch: 1 branch
BranchTrueFalseTotal
unless $signature and defined $signature->{"return"} 0 80 80
Condition33%1/3
$signature and defined $signature->{"return"}
!ll&&!rl&&r
0080
MC/DC0%0/2
$signature and defined $signature->{"return"}
$signature defined $signature->{"return"}
Truth table33%1/3
A and B
A= $signatureB= defined $signature->{"return"}
ABresult
0X0
100
111
195  
196 80 my $type = $signature->{return};
197 80 ▶ return ($value, 0)
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "java.util.List" and ref $value eq "ARRAY" 1 79 80
Condition66%2/3
$type eq "java.util.List" and ref $value eq "ARRAY"
!ll&&!rl&&r
7901
MC/DC50%1/2
$type eq "java.util.List" and ref $value eq "ARRAY"
$type eq "java.util.List" ref $value eq "ARRAY"
Truth table66%2/3
A and B
A= $type eq "java.util.List"B= ref $value eq "ARRAY"
ABresult
0X0
100
111
198 if $type eq 'java.util.List' && ref($value) eq 'ARRAY';
199  
200 79 my $converter = $self->get_converter($type, $signature->{enum_types});
201 79 ▶ $converter ||= $self->converter_for_runtime_value($value);
Condition66%2/3
$converter ||= $self->converter_for_runtime_value($value)
l!l&&r!l&&!r
7630
MC/DC0%0/2
$converter ||= $self->converter_for_runtime_value($value)
$converter $self->converter_for_runtime_value($value)
Truth table66%2/3
A ||= B
A= $converterB= $self->converter_for_runtime_value($value)
ABresult
1X1
011
000
202 79 ▶ return ($value, 0) unless $converter;
Branch: 1 branch
BranchTrueFalseTotal
unless $converter 0 79 79
203 79 return ($converter->to_string($value), 1);
204 }
205  
206 73 ▶sub is_typed_sequence {
Subroutine is_typed_sequence: called CC=2 SCAR=6.9
Pod documented
207 73 my ($self, $type, $enum_types) = @_;
208 73 my $converter = $self->get_converter($type, $enum_types);
209 73 ▶ return $converter && $converter->isa('Test::FitNesse::Slim::ConverterRegistry::TypedSequence');
Condition100%3/3
$converter && $converter->isa('Test::FitNesse::Slim::ConverterRegistry::TypedSequence')
!ll&&!rl&&r
25615
MC/DC100%2/2
$converter && $converter->isa('Test::FitNesse::Slim::ConverterRegistry::TypedSequence')
$converter $converter->isa('Test::FitNesse::Slim::ConverterRegistry::TypedSequence')
Truth table100%3/3
A && B
A= $converterB= $converter->isa('Test::FitNesse::Slim::ConverterRegistry::TypedSequence')
ABresult
0X0
100
111
210 }
211  
212 package Test::FitNesse::Slim::ConverterRegistry::Enum;
213 83 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
214 83 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
215 83 ▶use Unicode::UCD qw(charinfo);
Subroutine BEGIN: called CC=1 SCAR=0.0
216  
217 83 my %CASE_MAP;
218  
219 59 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
220 59 my ($class, $type, $values) = @_;
221 59 return bless { type => $type, values => $values }, $class;
222 }
223  
224 128 ▶sub _simple_case {
Subroutine _simple_case: called CC=5 SCAR=16.2
225 128 my ($codepoint, $field) = @_;
226 128 ▶ return $codepoint if $codepoint > 0xFFFF;
Branch: 1 branch
BranchTrueFalseTotal
if $codepoint > 65535 0 128 128
227 return $CASE_MAP{$field}{$codepoint}
228 128 ▶ if exists $CASE_MAP{$field}{$codepoint};
Branch: 1 branch
BranchTrueFalseTotal
if exists $CASE_MAP{$field}{$codepoint} 82 46 128
229 46 my $info = charinfo($codepoint);
230 my $mapped = $info && $info->{$field}
231 46 ▶ ? hex($info->{$field})
Branch: 1 branch
BranchTrueFalseTotal
$info && $info->{$field} ? : 23 23 46
Condition66%2/3
$info and $info->{$field}
!ll&&!rl&&r
02323
MC/DC50%1/2
$info and $info->{$field}
$info $info->{$field}
Truth table66%2/3
A and B
A= $infoB= $info->{$field}
ABresult
0X0
100
111
232 : $codepoint;
233 46 return $CASE_MAP{$field}{$codepoint} = $mapped;
234 }
235  
236 66 ▶sub _equals_ignore_case {
Subroutine _equals_ignore_case: called CC=6 SCAR=17.9
237 66 my ($left, $right) = @_;
238 66 my @left = split //, $left;
239 66 my @right = split //, $right;
240 66 ▶ return 0 unless @left == @right;
Branch: 1 branch
BranchTrueFalseTotal
unless @left == @right 45 21 66
241 21 for my $index (0 .. $#left) {
242 69 my ($a, $b) = (ord($left[$index]), ord($right[$index]));
243 69 ▶ next if $a == $b;
Branch: 1 branch
BranchTrueFalseTotal
if $a == $b 10 59 69
244 59 my ($upper_a, $upper_b) =
245 (_simple_case($a, 'upper'), _simple_case($b, 'upper'));
246 59 ▶ next if $upper_a == $upper_b;
Branch: 1 branch
BranchTrueFalseTotal
if $upper_a == $upper_b 54 5 59
247 5 ▶ return 0 unless _simple_case($upper_a, 'lower')
Branch: 1 branch
BranchTrueFalseTotal
unless _simple_case($upper_a, "lower") == _simple_case($upper_b, "lower") 4 1 5
248 == _simple_case($upper_b, 'lower');
249 }
250 17 return 1;
251 }
252  
253 9 ▶sub _error {
Subroutine _error: called CC=3 SCAR=11.4
254 9 my ($self, $value) = @_;
255 9 ▶ $value = 'reference value' if ref $value;
Branch: 1 branch
BranchTrueFalseTotal
if ref $value 0 9 9
256 9 ▶ $value = '' unless defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 9 9
257 9 die "message:<<Can't convert $value to enum value of type $self->{type}.>>\n";
258 }
259  
260 41 ▶sub from_string {
Subroutine from_string: called CC=7 SCAR=19.5
261 41 my ($self, $value) = @_;
262 41 ▶ return undef if Test::FitNesse::Slim::ConverterRegistry::_java_is_blank($value);
Branch: 1 branch
BranchTrueFalseTotal
if Test::FitNesse::Slim::ConverterRegistry::_java_is_blank($value) 3 38 41
263 38 ▶ $self->_error($value) if ref $value;
Branch: 1 branch
BranchTrueFalseTotal
if ref $value 0 38 38
264  
265 38 for my $constant (@{$self->{values}}) {
266 108 ▶ return $constant if $constant eq $value;
Branch: 1 branch
BranchTrueFalseTotal
if $constant eq $value 16 92 108
267 }
268 22 for my $constant (@{$self->{values}}) {
269 54 ▶ return $constant if _equals_ignore_case($constant, $value);
Branch: 1 branch
BranchTrueFalseTotal
if _equals_ignore_case($constant, $value) 15 39 54
270 }
271 7 $self->_error($value);
272 }
273  
274 28 ▶sub to_string {
Subroutine to_string: called CC=7 SCAR=19.5
275 28 my ($self, $value) = @_;
276 28 ▶ return undef unless defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 3 25 28
277 25 ▶ $self->_error($value) if ref $value;
Branch: 1 branch
BranchTrueFalseTotal
if ref $value 0 25 25
278 25 for my $constant (@{$self->{values}}) {
279 66 ▶ return $constant if $constant eq $value;
Branch: 1 branch
BranchTrueFalseTotal
if $constant eq $value 21 45 66
280 }
281 4 for my $constant (@{$self->{values}}) {
282 12 ▶ return $constant if _equals_ignore_case($constant, $value);
Branch: 1 branch
BranchTrueFalseTotal
if _equals_ignore_case($constant, $value) 2 10 12
283 }
284 2 $self->_error($value);
285 }
286  
287 package Test::FitNesse::Slim::ConverterRegistry::TypedSequence;
288 83 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
289 83 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
290  
291 59 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
292 59 my ($class, $registry, $component_converter) = @_;
293 59 return bless {
294 registry => $registry,
295 component_converter => $component_converter,
296 }, $class;
297 }
298  
299 29 ▶sub from_string {
Subroutine from_string: called CC=3 SCAR=11.0
300 29 my ($self, $arg) = @_;
301 29 ▶ return undef if Test::FitNesse::Slim::ConverterRegistry::_java_is_blank($arg);
Branch: 1 branch
BranchTrueFalseTotal
if Test::FitNesse::Slim::ConverterRegistry::_java_is_blank($arg) 2 27 29
302  
303 27 $arg =~ s/\A\[//;
304 27 $arg =~ s/\]\z//;
305 27 ▶ my @items = $arg =~ /\A\s*\z/ ? () : split /,/, $arg;
Branch: 1 branch
BranchTrueFalseTotal
$arg =~ /\A\s*\z/ ? : 2 25 27
306 27 my $converter = $self->{component_converter};
307 return [ map {
308 27 s/\A[\x00-\x20]+|[\x00-\x20]+\z//g;
309 63 $converter->from_string($_);
310 } @items ];
311 }
312  
313 20 ▶sub to_string {
Subroutine to_string: called CC=7 SCAR=19.9
314 20 my ($self, $sequence) = @_;
315 20 ▶ return undef unless defined $sequence;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $sequence 1 19 20
316 19 ▶ die 'typed array or collection result must be an array reference'
Branch: 1 branch
BranchTrueFalseTotal
unless ref $sequence eq "ARRAY" 0 19 19
317 unless ref($sequence) eq 'ARRAY';
318  
319 19 my $component = $self->{component_converter};
320 19 my @items;
321 19 for my $value (@$sequence) {
322 45 ▶ if (!defined $value) {
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $value) { } 1 44 45
elsif (ref $value) { } 0 44 44
323 1 push @items, 'null';
324 }
325 elsif (ref $value) {
326 0 push @items, $self->{registry}->element_to_string($value);
327 }
328 else {
329 44 my $string = $component->to_string($value);
330 44 ▶ push @items, defined($string) ? $string : 'null';
Branch: 1 branch
BranchTrueFalseTotal
defined $string ? : 44 0 44
331 }
332 }
333 19 return '[' . join(', ', @items) . ']';
334 }
335  
336 package Test::FitNesse::Slim::ConverterRegistry::String;
337 83 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
338 83 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
339 10 ▶sub from_string { $_[1] }
Subroutine from_string: called CC=1 SCAR=0.0
340 13 ▶sub to_string { $_[1] }
Subroutine to_string: called CC=1 SCAR=0.0
341  
342 package Test::FitNesse::Slim::ConverterRegistry::Boolean;
343 83 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
344 83 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
345 10 ▶sub from_string {
Subroutine from_string: called CC=4 SCAR=13.9
346 10 ▶ return undef unless defined $_[1];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[1] 0 10 10
347 10 ▶ return undef if $_[1] =~ /\A\s*\z/;
Branch: 1 branch
BranchTrueFalseTotal
if $_[1] =~ /\A\s*\z/ 2 8 10
348 8 ▶ return $_[1] =~ /\A(?:true|yes)\z/i ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$_[1] =~ /\A(?:true|yes)\z/i ? : 6 2 8
349 }
350 10 ▶sub to_string {
Subroutine to_string: called CC=3 SCAR=11.0
351 10 ▶ return undef unless defined $_[1];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[1] 1 9 10
352 9 ▶ return $_[1] ? 'true' : 'false';
Branch: 1 branch
BranchTrueFalseTotal
$_[1] ? : 6 3 9
353 }
354  
355 package Test::FitNesse::Slim::ConverterRegistry::PrimitiveBoolean;
356 83 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
357 83 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
358 83 our @ISA = ('Test::FitNesse::Slim::ConverterRegistry::Boolean');
359 2 ▶sub from_string {
Subroutine from_string: called CC=2 SCAR=6.9
360 2 my ($self, $value) = @_;
361 2 ▶ return $self->SUPER::from_string($value) // 0;
Condition100%2/2
$self->SUPER::from_string($value) // 0
l!l
11
MC/DC100%1/1
$self->SUPER::from_string($value) // 0
$self->SUPER::from_string($value)
Truth table100%2/2
A
A= $self->SUPER::from_string($value)
Aresult
11
00
362 }
363 10 ▶sub to_string {
Subroutine to_string: called CC=3 SCAR=11.1
364 10 ▶ return undef unless defined $_[1];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[1] 0 10 10
365 10 ▶ return $_[1] ? 'true' : 'false';
Branch: 1 branch
BranchTrueFalseTotal
$_[1] ? : 9 1 10
366 }
367  
368 package Test::FitNesse::Slim::ConverterRegistry::Integer;
369 83 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
370 83 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
371 40 ▶sub from_string {
Subroutine from_string: called CC=8 SCAR=20.8
372 40 my ($self, $value) = @_;
373 40 ▶ return undef unless defined $value && $value !~ /\A\s*\z/;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value and not $value =~ /\A\s*\z/ 4 36 40
Condition66%2/3
defined $value and not $value =~ /\A\s*\z/
!ll&&!rl&&r
0436
MC/DC50%1/2
defined $value and not $value =~ /\A\s*\z/
defined $value not $value =~ /\A\s*\z/
Truth table66%2/3
A and not(B)
A= defined $valueB= not $value =~ /\A\s*\z/
ABresult
0X0
100
111
374 36 ▶ die "message:<<Can't convert $value to integer.>>" unless $value =~ /\A[+-]?[0-9]+\z/;
Branch: 1 branch
BranchTrueFalseTotal
unless $value =~ /\A[+-]?[0-9]+\z/ 5 31 36
375 31 my $digits = $value;
376 31 $digits =~ s/\A[+-]//;
377 31 $digits =~ s/\A0+(?=.)//;
378 31 my $negative = $value =~ /\A-/;
379 31 ▶ my $limit = $negative ? '2147483648' : '2147483647';
Branch: 1 branch
BranchTrueFalseTotal
$negative ? : 2 29 31
380 31 ▶ die "message:<<Can't convert $value to integer.>>"
Branch: 1 branch
BranchTrueFalseTotal
if length $digits > length $limit or length $digits == length $limit and $digits gt $limit 1 30 31
Condition83%5/6
length $digits > length $limit or length $digits == length $limit and $digits gt $limit
l!l&&r!l&&!r
0130
length $digits == length $limit and $digits gt $limit
!ll&&!rl&&r
2821
MC/DC66%2/3
length $digits > length $limit or length $digits == length $limit and $digits gt $limit
length $digits > length $limit length $digits == length $limit $digits gt $limit
Truth table75%3/4
A or B and C
A= length $digits > length $limitB= length $digits == length $limitC= $digits gt $limit
ABCresult
1XX1
0111
00X0
0100
381 if length($digits) > length($limit)
382 || (length($digits) == length($limit) && $digits gt $limit);
383 30 return 0 + $value;
384 }
385 18 ▶sub to_string { defined $_[1] ? "$_[1]" : undef }
Subroutine to_string: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
defined $_[1] ? : 18 0 18
386  
387 package Test::FitNesse::Slim::ConverterRegistry::PrimitiveInteger;
388 83 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
389 83 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
390 83 our @ISA = ('Test::FitNesse::Slim::ConverterRegistry::Integer');
391 10 ▶sub from_string { $_[0]->SUPER::from_string($_[1]) // 0 }
Subroutine from_string: called CC=2 SCAR=6.9
Condition100%2/2
$_[0]->SUPER::from_string($_[1]) // 0
l!l
62
MC/DC100%1/1
$_[0]->SUPER::from_string($_[1]) // 0
$_[0]->SUPER::from_string($_[1])
Truth table100%2/2
A
A= $_[0]->SUPER::from_string($_[1])
Aresult
11
00
392  
393 package Test::FitNesse::Slim::ConverterRegistry::Long;
394 83 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
395 83 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
396 4 ▶sub from_string {
Subroutine from_string: called CC=8 SCAR=21.3
397 4 my ($self, $value) = @_;
398 4 ▶ return undef unless defined $value && $value !~ /\A\s*\z/;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value and not $value =~ /\A\s*\z/ 0 4 4
Condition33%1/3
defined $value and not $value =~ /\A\s*\z/
!ll&&!rl&&r
004
MC/DC0%0/2
defined $value and not $value =~ /\A\s*\z/
defined $value not $value =~ /\A\s*\z/
Truth table33%1/3
A and not(B)
A= defined $valueB= not $value =~ /\A\s*\z/
ABresult
0X0
100
111
399 4 ▶ die "message:<<Can't convert $value to long.>>" unless $value =~ /\A[+-]?[0-9]+\z/;
Branch: 1 branch
BranchTrueFalseTotal
unless $value =~ /\A[+-]?[0-9]+\z/ 0 4 4
400 4 my $digits = $value;
401 4 $digits =~ s/\A[+-]//;
402 4 $digits =~ s/\A0+(?=.)//;
403 4 my $negative = $value =~ /\A-/;
404 4 ▶ my $limit = $negative ? '9223372036854775808' : '9223372036854775807';
Branch: 1 branch
BranchTrueFalseTotal
$negative ? : 2 2 4
405 4 ▶ die "message:<<Can't convert $value to long.>>"
Branch: 1 branch
BranchTrueFalseTotal
if length $digits > length $limit or length $digits == length $limit and $digits gt $limit 1 3 4
Condition83%5/6
length $digits > length $limit or length $digits == length $limit and $digits gt $limit
l!l&&r!l&&!r
013
length $digits == length $limit and $digits gt $limit
!ll&&!rl&&r
121
MC/DC66%2/3
length $digits > length $limit or length $digits == length $limit and $digits gt $limit
length $digits > length $limit length $digits == length $limit $digits gt $limit
Truth table75%3/4
A or B and C
A= length $digits > length $limitB= length $digits == length $limitC= $digits gt $limit
ABCresult
1XX1
0111
00X0
0100
406 if length($digits) > length($limit)
407 || (length($digits) == length($limit) && $digits gt $limit);
408 3 return 0 + $value;
409 }
410 0 ▶sub to_string { defined $_[1] ? "$_[1]" : undef }
Subroutine to_string: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
defined $_[1] ? : 0 0 0
411  
412 package Test::FitNesse::Slim::ConverterRegistry::PrimitiveLong;
413 83 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
414 83 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
415 83 our @ISA = ('Test::FitNesse::Slim::ConverterRegistry::Long');
416 2 ▶sub from_string { $_[0]->SUPER::from_string($_[1]) // 0 }
Subroutine from_string: called CC=2 SCAR=7.6
Condition50%1/2
$_[0]->SUPER::from_string($_[1]) // 0
l!l
10
MC/DC0%0/1
$_[0]->SUPER::from_string($_[1]) // 0
$_[0]->SUPER::from_string($_[1])
Truth table50%1/2
A
A= $_[0]->SUPER::from_string($_[1])
Aresult
11
00
417  
418 package Test::FitNesse::Slim::ConverterRegistry::Double;
419 83 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
420 83 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
421 83 ▶use POSIX ();
Subroutine BEGIN: called CC=1 SCAR=0.0
422 83 ▶use Scalar::Util qw(looks_like_number);
Subroutine BEGIN: called CC=1 SCAR=0.0
423  
424 64 ▶sub _valid_literal {
Subroutine _valid_literal: called CC=2 SCAR=6.9
425 64 my ($value) = @_;
426 64 ▶ return $value =~ /\A[+-]?(?:NaN|Infinity)\z/
Condition100%3/3
$value =~ /\A[+-]?(?:NaN|Infinity)\z/ || $value =~ /\A[+-]?(?:(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][+-]?[0-9]+)?|0[xX](?:[0-9a-fA-F]+(?:\.[0-9a-fA-F]*)?|\.[0-9a-fA-F]+)[pP][+-]?[0-9]+)[fFdD]?\z/
l!l&&r!l&&!r
9478
MC/DC100%2/2
$value =~ /\A[+-]?(?:NaN|Infinity)\z/ || $value =~ /\A[+-]?(?:(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][+-]?[0-9]+)?|0[xX](?:[0-9a-fA-F]+(?:\.[0-9a-fA-F]*)?|\.[0-9a-fA-F]+)[pP][+-]?[0-9]+)[fFdD]?\z/
$value =~ /\A[+-]?(?:NaN|Infinity)\z/ $value =~ /\A[+-]?(?:(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][+-]?[0-9]+)?|0[xX](?:[0-9a-fA-F]+(?:\.[0-9a-fA-F]*)?|\.[0-9a-fA-F]+)[pP][+-]?[0-9]+)[fFdD]?\z/
Truth table100%3/3
A || B
A= $value =~ /\A[+-]?(?:NaN|Infinity)\z/B= $value =~ /\A[+-]?(?:(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][+-]?[0-9]+)?|0[xX](?:[0-9a-fA-F]+(?:\.[0-9a-fA-F]*)?|\.[0-9a-fA-F]+)[pP][+-]?[0-9]+)[fFdD]?\z/
ABresult
1X1
011
000
427 || $value =~ /\A[+-]?(?:(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][+-]?[0-9]+)?|0[xX](?:[0-9a-fA-F]+(?:\.[0-9a-fA-F]*)?|\.[0-9a-fA-F]+)[pP][+-]?[0-9]+)[fFdD]?\z/;
428 }
429  
430 56 ▶sub _parse_literal {
Subroutine _parse_literal: called CC=7 SCAR=19.9
431 56 my ($value) = @_;
432 56 ▶ return POSIX::nan(0) if $value =~ /\A[+-]?NaN\z/;
Branch: 1 branch
BranchTrueFalseTotal
if $value =~ /\A[+-]?NaN\z/ 4 52 56
433 52 ▶ return ($value =~ /\A-/ ? -1 : 1) * POSIX::HUGE_VAL()
Branch: 2 branches
BranchTrueFalseTotal
if $value =~ /\A[+-]?Infinity\z/ 5 47 52
$value =~ /\A-/ ? : 3 2 5
434 if $value =~ /\A[+-]?Infinity\z/;
435  
436 47 $value =~ s/[fFdD]\z//;
437 47 my $locale = POSIX::setlocale(POSIX::LC_NUMERIC(), 'C');
438 47 my ($number, $remainder) = POSIX::strtod($value);
439 47 ▶ POSIX::setlocale(POSIX::LC_NUMERIC(), $locale) if defined $locale;
Branch: 1 branch
BranchTrueFalseTotal
if defined $locale 47 0 47
440 47 ▶ die unless defined($remainder) && $remainder == 0;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $remainder and $remainder == 0 0 47 47
Condition33%1/3
defined $remainder and $remainder == 0
!ll&&!rl&&r
0047
MC/DC0%0/2
defined $remainder and $remainder == 0
defined $remainder $remainder == 0
Truth table33%1/3
A and B
A= defined $remainderB= $remainder == 0
ABresult
0X0
100
111
441 47 return $number;
442 }
443  
444 70 ▶sub from_string {
Subroutine from_string: called CC=4 SCAR=13.9
445 70 my ($self, $value) = @_;
446 70 ▶ return undef if Test::FitNesse::Slim::ConverterRegistry::_java_is_blank($value);
Branch: 1 branch
BranchTrueFalseTotal
if Test::FitNesse::Slim::ConverterRegistry::_java_is_blank($value) 6 64 70
447 64 my $original = $value;
448 64 $value =~ s/\A[\x00-\x20]+|[\x00-\x20]+\z//g;
449 64 ▶ die "message:<<Can't convert $original to double.>>"
Branch: 1 branch
BranchTrueFalseTotal
unless _valid_literal($value) 8 56 64
450 unless _valid_literal($value);
451 56 my $number = eval { _parse_literal($value) };
452 56 ▶ die "message:<<Can't convert $original to double.>>" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 56 56
453 56 return $number;
454 }
455  
456 59 ▶sub to_string {
Subroutine to_string: called CC=9 SCAR=22.1
457 59 my ($self, $value) = @_;
458 59 ▶ return undef unless defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 2 57 59
459 57 ▶ die 'message:<<Double result must be a numeric scalar.>>' if ref $value;
Branch: 1 branch
BranchTrueFalseTotal
if ref $value 0 57 57
460 57 ▶ if (looks_like_number($value)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&looks_like_number($value)) 57 0 57
461 57 ▶ return 'NaN' if POSIX::isnan($value);
Branch: 1 branch
BranchTrueFalseTotal
if POSIX::isnan($value) 4 53 57
462 53 ▶ return POSIX::signbit($value) ? '-Infinity' : 'Infinity'
Branch: 2 branches
BranchTrueFalseTotal
if POSIX::isinf($value) 8 45 53
POSIX::signbit($value) ? : 3 5 8
463 if POSIX::isinf($value);
464 45 ▶ return POSIX::signbit($value) ? '-0.0' : '0.0' if $value == 0;
Branch: 2 branches
BranchTrueFalseTotal
if $value == 0 8 37 45
POSIX::signbit($value) ? : 6 2 8
465 37 return _format_finite($value);
466 }
467 0 return $self->to_string($self->from_string($value));
468 }
469  
470 37 ▶sub _format_finite {
Subroutine _format_finite: called CC=15 SCAR=27.3
471 37 my ($number) = @_;
472 37 my $negative = POSIX::signbit($number);
473 37 my $absolute = abs($number);
474 37 ▶ my $scientific = $absolute >= 10_000_000 || $absolute < 0.001;
Condition100%3/3
$absolute >= 10000000 || $absolute < 0.001
l!l&&r!l&&!r
6724
MC/DC100%2/2
$absolute >= 10000000 || $absolute < 0.001
$absolute >= 10000000 $absolute < 0.001
Truth table100%3/3
A || B
A= $absolute >= 10000000B= $absolute < 0.001
ABresult
1X1
011
000
475 37 ▶ my $first_digits = $scientific ? 2 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$scientific ? : 13 24 37
476 37 my ($digits, $exponent);
477  
478 37 my $locale = POSIX::setlocale(POSIX::LC_NUMERIC(), 'C');
479 37 for my $significant_digits ($first_digits .. 17) {
480 106 my $candidate = sprintf('%.*e', $significant_digits - 1, $absolute);
481 106 my ($back, $remaining) = POSIX::strtod($candidate);
482 106 ▶ next unless defined($remaining) && $remaining == 0;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $remaining and $remaining == 0 0 106 106
Condition33%1/3
defined $remaining and $remaining == 0
!ll&&!rl&&r
00106
MC/DC0%0/2
defined $remaining and $remaining == 0
defined $remaining $remaining == 0
Truth table33%1/3
A and B
A= defined $remainingB= $remaining == 0
ABresult
0X0
100
111
483 106 ▶ next unless pack('d', $back) eq pack('d', $absolute);
Branch: 1 branch
BranchTrueFalseTotal
unless pack("d", $back) eq pack("d", $absolute) 69 37 106
484 37 my ($leading_digit, $fraction, $decimal_exponent) =
485 $candidate =~ /\A([0-9])(?:\.([0-9]+))?e([+-]?[0-9]+)\z/i;
486 37 ▶ $digits = $leading_digit . ($fraction // '');
Condition100%2/2
$fraction // ""
l!l
2215
MC/DC100%1/1
$fraction // ""
$fraction
Truth table100%2/2
A
A= $fraction
Aresult
11
00
487 37 $exponent = 0 + $decimal_exponent;
488 37 last;
489 }
490 37 ▶ POSIX::setlocale(POSIX::LC_NUMERIC(), $locale) if defined $locale;
Branch: 1 branch
BranchTrueFalseTotal
if defined $locale 37 0 37
491  
492 37 ▶ die 'Could not format finite Double as a round-trippable decimal'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $digits 0 37 37
493 unless defined $digits;
494 37 my $formatted;
495 37 ▶ if ($scientific) {
Branch: 2 branches
BranchTrueFalseTotal
if ($scientific) { } 13 24 37
elsif ($exponent >= 0) { } 14 10 24
496 13 my $fraction = substr($digits, 1);
497 13 ▶ $fraction = '0' unless length $fraction;
Branch: 1 branch
BranchTrueFalseTotal
unless length $fraction 0 13 13
498 13 $formatted = substr($digits, 0, 1) . '.' . $fraction . 'E' . $exponent;
499 }
500 elsif ($exponent >= 0) {
501 14 my $point = $exponent + 1;
502 14 ▶ if ($point >= length $digits) {
Branch: 1 branch
BranchTrueFalseTotal
if ($point >= length $digits) { } 10 4 14
503 10 $formatted = $digits . ('0' x ($point - length $digits)) . '.0';
504 }
505 else {
506 4 $formatted = substr($digits, 0, $point) . '.' . substr($digits, $point);
507 }
508 }
509 else {
510 10 $formatted = '0.' . ('0' x (-$exponent - 1)) . $digits;
511 }
512 37 ▶ return ($negative ? '-' : '') . $formatted;
Branch: 1 branch
BranchTrueFalseTotal
$negative ? : 2 35 37
513 }
514  
515 package Test::FitNesse::Slim::ConverterRegistry::PrimitiveDouble;
516 83 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
517 83 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
518 83 our @ISA = ('Test::FitNesse::Slim::ConverterRegistry::Double');
519 6 ▶sub from_string { $_[0]->SUPER::from_string($_[1]) // 0 }
Subroutine from_string: called CC=2 SCAR=6.9
Condition100%2/2
$_[0]->SUPER::from_string($_[1]) // 0
l!l
33
MC/DC100%1/1
$_[0]->SUPER::from_string($_[1]) // 0
$_[0]->SUPER::from_string($_[1])
Truth table100%2/2
A
A= $_[0]->SUPER::from_string($_[1])
Aresult
11
00
520  
521 package Test::FitNesse::Slim::ConverterRegistry::Character;
522 83 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
523 83 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
524 83 ▶use Encode qw(decode FB_CROAK);
Subroutine BEGIN: called CC=1 SCAR=0.0
525 16 ▶sub from_string {
Subroutine from_string: called CC=4 SCAR=13.9
526 16 my ($self, $value) = @_;
527 16 ▶ return undef if Test::FitNesse::Slim::ConverterRegistry::_java_is_blank($value);
Branch: 1 branch
BranchTrueFalseTotal
if Test::FitNesse::Slim::ConverterRegistry::_java_is_blank($value) 5 11 16
528 11 ▶ my $text = utf8::is_utf8($value) ? $value : decode('UTF-8', $value, FB_CROAK);
Branch: 1 branch
BranchTrueFalseTotal
utf8::is_utf8($value) ? : 7 4 11
529 11 my $codepoint = ord substr($text, 0, 1);
530 11 ▶ return $codepoint if $codepoint <= 0xFFFF;
Branch: 1 branch
BranchTrueFalseTotal
if $codepoint <= 65535 8 3 11
531 3 return 0xD800 + (($codepoint - 0x10000) >> 10);
532 }
533 7 ▶sub to_string {
Subroutine to_string: called CC=7 SCAR=20.5
534 7 my ($self, $value) = @_;
535 7 ▶ return undef unless defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 7 7
536 7 ▶ die 'message:<<Character result must be a UTF-16 code unit.>>'
Branch: 1 branch
BranchTrueFalseTotal
unless not ref $value and $value =~ /\A[0-9]+\z/ and $value <= 65535 1 6 7
Condition50%3/6
not ref $value and $value =~ /\A[0-9]+\z/ and $value <= 65535
!ll&&!rl&&r
016
not ref $value and $value =~ /\A[0-9]+\z/
!ll&&!rl&&r
007
MC/DC33%1/3
not ref $value and $value =~ /\A[0-9]+\z/ and $value <= 65535
not ref $value $value =~ /\A[0-9]+\z/ $value <= 65535
Truth table50%2/4
not(A) and B and C
A= not ref $valueB= $value =~ /\A[0-9]+\z/C= $value <= 65535
ABCresult
0XX0
10X0
1100
1111
537 unless !ref($value) && $value =~ /\A[0-9]+\z/ && $value <= 0xFFFF;
538 6 ▶ return '?' if $value >= 0xD800 && $value <= 0xDFFF;
Branch: 1 branch
BranchTrueFalseTotal
if $value >= 55296 and $value <= 57343 3 3 6
Condition66%2/3
$value >= 55296 and $value <= 57343
!ll&&!rl&&r
303
MC/DC50%1/2
$value >= 55296 and $value <= 57343
$value >= 55296 $value <= 57343
Truth table66%2/3
A and B
A= $value >= 55296B= $value <= 57343
ABresult
0X0
100
111
539 3 return chr($value);
540 }
541  
542 package Test::FitNesse::Slim::ConverterRegistry::PrimitiveCharacter;
543 83 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
544 83 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
545 83 our @ISA = ('Test::FitNesse::Slim::ConverterRegistry::Character');
546 6 ▶sub from_string { $_[0]->SUPER::from_string($_[1]) // 0 }
Subroutine from_string: called CC=2 SCAR=6.9
Condition100%2/2
$_[0]->SUPER::from_string($_[1]) // 0
l!l
51
MC/DC100%1/1
$_[0]->SUPER::from_string($_[1]) // 0
$_[0]->SUPER::from_string($_[1])
Truth table100%2/2
A
A= $_[0]->SUPER::from_string($_[1])
Aresult
11
00
547  
548 package Test::FitNesse::Slim::ConverterRegistry::Date;
549 83 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
550 83 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
551 83 ▶use Time::Local qw(timelocal);
Subroutine BEGIN: called CC=1 SCAR=0.0
552  
553 83 my @MONTHS = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
554 83 my %MONTH_INDEX = map { lc($MONTHS[$_]) => $_ } 0 .. $#MONTHS;
555 my %FULL_MONTH_INDEX = map {
556 83 lc((qw(January February March April May June July August September October November December))[$_]) => $_
557 } 0 .. 11;
558  
559 21 ▶sub _days_in_month {
Subroutine _days_in_month: called CC=15 SCAR=28.4
560 21 my ($month, $year) = @_;
561 21 ▶ return 31 if $month == 0 || $month == 2 || $month == 4 || $month == 6
Branch: 1 branch
BranchTrueFalseTotal
if $month == 0 or $month == 2 or $month == 4 or $month == 6 or $month == 7 or $month == 9 or $month == 11 8 13 21
Condition77%14/18
$month == 0 or $month == 2 or $month == 4 or $month == 6 or $month == 7 or $month == 9 or $month == 11
l!l&&r!l&&!r
7113
$month == 0 or $month == 2 or $month == 4 or $month == 6 or $month == 7 or $month == 9
l!l&&r!l&&!r
7014
$month == 0 or $month == 2 or $month == 4 or $month == 6 or $month == 7
l!l&&r!l&&!r
7014
$month == 0 or $month == 2 or $month == 4 or $month == 6
l!l&&r!l&&!r
7014
$month == 0 or $month == 2 or $month == 4
l!l&&r!l&&!r
6114
$month == 0 or $month == 2
l!l&&r!l&&!r
6015
MC/DC42%3/7
$month == 0 or $month == 2 or $month == 4 or $month == 6 or $month == 7 or $month == 9 or $month == 11
$month == 0 $month == 2 $month == 4 $month == 6 $month == 7 $month == 9 $month == 11
Truth table50%4/8
A or B or C or D or E or F or G
A= $month == 0B= $month == 2C= $month == 4D= $month == 6E= $month == 7F= $month == 9G= $month == 11
ABCDEFGresult
1XXXXXX1
01XXXXX1
001XXXX1
0001XXX1
00001XX1
000001X1
00000011
00000000
562 || $month == 7 || $month == 9 || $month == 11;
563 13 ▶ return 30 if $month == 3 || $month == 5 || $month == 8 || $month == 10;
Branch: 1 branch
BranchTrueFalseTotal
if $month == 3 or $month == 5 or $month == 8 or $month == 10 4 9 13
Condition77%7/9
$month == 3 or $month == 5 or $month == 8 or $month == 10
l!l&&r!l&&!r
409
$month == 3 or $month == 5 or $month == 8
l!l&&r!l&&!r
409
$month == 3 or $month == 5
l!l&&r!l&&!r
229
MC/DC50%2/4
$month == 3 or $month == 5 or $month == 8 or $month == 10
$month == 3 $month == 5 $month == 8 $month == 10
Truth table60%3/5
A or B or C or D
A= $month == 3B= $month == 5C= $month == 8D= $month == 10
ABCDresult
1XXX1
01XX1
001X1
00011
00000
564 9 ▶ return ($year % 4 == 0 && ($year % 100 != 0 || $year % 400 == 0)) ? 29 : 28;
Branch: 1 branch
BranchTrueFalseTotal
$year % 4 == 0 && ($year % 100 != 0 || $year % 400 == 0) ? : 8 1 9
Condition50%3/6
$year % 4 == 0 and $year % 100 != 0 || $year % 400 == 0
!ll&&!rl&&r
108
$year % 100 != 0 or $year % 400 == 0
l!l&&r!l&&!r
800
MC/DC33%1/3
$year % 4 == 0 and $year % 100 != 0 || $year % 400 == 0
$year % 4 == 0 $year % 100 != 0 $year % 400 == 0
Truth table50%2/4
A and B or C
A= $year % 4 == 0B= $year % 100 != 0C= $year % 400 == 0
ABCresult
0XX0
1000
11X1
1011
565 }
566  
567 21 ▶sub from_string {
Subroutine from_string: called CC=17 SCAR=30.1
568 21 my ($self, $value) = @_;
569 21 ▶ return undef if Test::FitNesse::Slim::ConverterRegistry::_java_is_blank($value);
Branch: 1 branch
BranchTrueFalseTotal
if Test::FitNesse::Slim::ConverterRegistry::_java_is_blank($value) 1 20 21
570 20 $value =~ s/\A[\x{0009}-\x{000D}\x{001C}-\x{0020}\x{1680}\x{2000}-\x{2006}\x{2008}-\x{200A}\x{2028}\x{2029}\x{205F}\x{3000}]+//;
571 20 my ($day, $month_name, $year) = $value =~ /\A([0-9]+)-([A-Za-z]+)-([0-9]+)/;
572 my $month = defined($month_name)
573 20 ▶ ? ($MONTH_INDEX{lc $month_name} // $FULL_MONTH_INDEX{lc $month_name})
Branch: 1 branch
BranchTrueFalseTotal
defined $month_name ? : 17 3 20
Condition100%3/3
$MONTH_INDEX{lc $month_name} // $FULL_MONTH_INDEX{lc $month_name}
l!l&&r!l&&!r
1511
MC/DC100%2/2
$MONTH_INDEX{lc $month_name} // $FULL_MONTH_INDEX{lc $month_name}
$MONTH_INDEX{lc $month_name} $FULL_MONTH_INDEX{lc $month_name}
Truth table100%3/3
A // B
A= $MONTH_INDEX{lc $month_name}B= $FULL_MONTH_INDEX{lc $month_name}
ABresult
1X1
011
000
574 : undef;
575 20 ▶ die "message:<<Can't convert $value to date.>>"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $day and defined $month and defined $year and $year >= 1583 and $year <= 9999 and $day <= 1000000 4 16 20
Condition73%11/15
defined $day and defined $month and defined $year and $year >= 1583 and $year <= 9999 and $day <= 1000000
!ll&&!rl&&r
4016
defined $day and defined $month and defined $year and $year >= 1583 and $year <= 9999
!ll&&!rl&&r
4016
defined $day and defined $month and defined $year and $year >= 1583
!ll&&!rl&&r
4016
defined $day and defined $month and defined $year
!ll&&!rl&&r
4016
defined $day and defined $month
!ll&&!rl&&r
3116
MC/DC33%2/6
defined $day and defined $month and defined $year and $year >= 1583 and $year <= 9999 and $day <= 1000000
defined $day defined $month defined $year $year >= 1583 $year <= 9999 $day <= 1000000
Truth table42%3/7
A and B and C and D and E and F
A= defined $dayB= defined $monthC= defined $yearD= $year >= 1583E= $year <= 9999F= $day <= 1000000
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
11110X0
1111100
1111111
576 unless defined($day) && defined($month) && defined($year)
577 && $year >= 1583 && $year <= 9999 && $day <= 1_000_000;
578  
579 # SimpleDateFormat is lenient: roll day zero and overflow into adjacent months.
580 16 ▶ while ($day < 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($day < 1) 1 16 17
581 1 $month--;
582 0 ▶ if ($month < 0) { $month = 11; $year-- }
Branch: 1 branch
BranchTrueFalseTotal
if ($month < 0) 0 1 1
583 1 $day += _days_in_month($month, $year);
584 }
585 16 ▶ while ($day > _days_in_month($month, $year)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($day > _days_in_month($month, $year)) 2 16 18
586 2 $day -= _days_in_month($month, $year);
587 2 $month++;
588 0 ▶ if ($month > 11) { $month = 0; $year++ }
Branch: 1 branch
BranchTrueFalseTotal
if ($month > 11) 0 2 2
589 }
590 16 ▶ die "message:<<Can't convert $value to date.>>" if $year < 1583 || $year > 9999;
Branch: 1 branch
BranchTrueFalseTotal
if $year < 1583 or $year > 9999 0 16 16
Condition33%1/3
$year < 1583 or $year > 9999
l!l&&r!l&&!r
0016
MC/DC0%0/2
$year < 1583 or $year > 9999
$year < 1583 $year > 9999
Truth table33%1/3
A or B
A= $year < 1583B= $year > 9999
ABresult
1X1
011
000
591  
592 16 my $seconds = eval { timelocal(0, 0, 0, $day, $month, $year) };
593 16 ▶ die "message:<<Can't convert $value to date.>>" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 16 16
594 16 return $seconds * 1000;
595 }
596  
597 10 ▶sub to_string {
Subroutine to_string: called CC=9 SCAR=26.3
598 10 my ($self, $milliseconds) = @_;
599 10 ▶ return undef unless defined $milliseconds;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $milliseconds 0 10 10
600 10 ▶ die 'message:<<Date result must be epoch milliseconds.>>'
Branch: 1 branch
BranchTrueFalseTotal
if ref $milliseconds or not $milliseconds =~ /\A-?[0-9]+\z/ 0 10 10
Condition33%1/3
ref $milliseconds or not $milliseconds =~ /\A-?[0-9]+\z/
l!l&&r!l&&!r
0010
MC/DC0%0/2
ref $milliseconds or not $milliseconds =~ /\A-?[0-9]+\z/
ref $milliseconds not $milliseconds =~ /\A-?[0-9]+\z/
Truth table33%1/3
A or not(B)
A= ref $millisecondsB= not $milliseconds =~ /\A-?[0-9]+\z/
ABresult
1X1
011
000
601 if ref($milliseconds) || $milliseconds !~ /\A-?[0-9]+\z/;
602 10 my $seconds = int($milliseconds / 1000);
603 10 ▶ $seconds-- if $milliseconds < 0 && $milliseconds % 1000;
Branch: 1 branch
BranchTrueFalseTotal
if $milliseconds < 0 and $milliseconds % 1000 0 10 10
Condition66%2/3
$milliseconds < 0 and $milliseconds % 1000
!ll&&!rl&&r
910
MC/DC0%0/2
$milliseconds < 0 and $milliseconds % 1000
$milliseconds < 0 $milliseconds % 1000
Truth table66%2/3
A and B
A= $milliseconds < 0B= $milliseconds % 1000
ABresult
0X0
100
111
604 10 my ($day, $month, $year) = (localtime($seconds))[3, 4, 5];
605 10 ▶ die 'message:<<Date result is outside the supported localtime range.>>'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $year and $year + 1900 >= 1583 and $year + 1900 <= 9999 0 10 10
Condition33%2/6
defined $year and $year + 1900 >= 1583 and $year + 1900 <= 9999
!ll&&!rl&&r
0010
defined $year and $year + 1900 >= 1583
!ll&&!rl&&r
0010
MC/DC0%0/3
defined $year and $year + 1900 >= 1583 and $year + 1900 <= 9999
defined $year $year + 1900 >= 1583 $year + 1900 <= 9999
Truth table25%1/4
A and B and C
A= defined $yearB= $year + 1900 >= 1583C= $year + 1900 <= 9999
ABCresult
0XX0
10X0
1100
1111
606 unless defined($year) && $year + 1900 >= 1583 && $year + 1900 <= 9999;
607 10 return sprintf('%02d-%s-%04d', $day, $MONTHS[$month], $year + 1900);
608 }
609  
610 package Test::FitNesse::Slim::ConverterRegistry::Void;
611 83 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
612 83 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
613 0 ▶sub from_string { undef }
Subroutine from_string: not called CC=1 SCAR=6.9
614 9 ▶sub to_string { '/__VOID__/' }
Subroutine to_string: called CC=1 SCAR=0.0
615  
616 package Test::FitNesse::Slim::ConverterRegistry::List;
617 83 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
618 83 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
619 356 ▶sub new { bless { registry => $_[1] }, $_[0] }
Subroutine new: called CC=1 SCAR=0.0
620 2 ▶sub from_string {
Subroutine from_string: called CC=4 SCAR=14.8
621 2 my ($self, $arg) = @_;
622 2 ▶ return undef unless defined $arg && $arg !~ /\A\s*\z/;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $arg and not $arg =~ /\A\s*\z/ 0 2 2
Condition33%1/3
defined $arg and not $arg =~ /\A\s*\z/
!ll&&!rl&&r
002
MC/DC0%0/2
defined $arg and not $arg =~ /\A\s*\z/
defined $arg not $arg =~ /\A\s*\z/
Truth table33%1/3
A and not(B)
A= defined $argB= not $arg =~ /\A\s*\z/
ABresult
0X0
100
111
623 2 $arg =~ s/^\[//;
624 2 $arg =~ s/\]$//;
625 2 ▶ return [] if $arg =~ /\A\s*\z/;
Branch: 1 branch
BranchTrueFalseTotal
if $arg =~ /\A\s*\z/ 0 2 2
626 2 return [map { s/^\s+|\s+$//gr } split /,/, $arg];
627 }
628 7 ▶sub to_string {
Subroutine to_string: called CC=2 SCAR=6.9
629 7 my ($self, $list) = @_;
630 7 ▶ return undef unless defined $list;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $list 1 6 7
631 6 return '[' . join(', ', map { $self->{registry}->element_to_string($_) } @$list) . ']';
632 }
633  
634 83 1;
635  
636 =head1 NAME
637  
638 Test::FitNesse::Slim::ConverterRegistry - Convert declared fixture argument and result types
639  
640 =head1 DESCRIPTION
641  
642 The converter registry supplies the scalar and sequence conversions used
643 by L<Test::FitNesse::Slim::StatementExecutor>. Each executor owns a registry, so
644 custom converter changes are scoped to that executor. Fixtures select
645 converters through C<slim_constructor_signature> and
646 C<slim_method_signature>; undeclared arguments are not coerced.
647  
648 Built-in scalar types include String, Boolean, Integer, Long, Double,
649 Character, Date, and void forms. One-dimensional typed arrays and generic
650 List/Collection declarations compose those scalar converters. Fixture
651 packages may declare enum domains through C<slim_enum_types>. Parsing and
652 result-formatting errors are thrown for the statement executor to serialize
653 as SLiM exceptions.
654  
655 =head1 METHODS
656  
657 =head2 new
658  
659 Create a registry initialized with the built-in converters.
660  
661 =head2 reset
662  
663 Restore the built-in converter set and remove custom registrations.
664  
665 =head2 add_converter
666  
667 $registry->add_converter($type_name, $converter);
668  
669 Register an object implementing C<from_string> and C<to_string> under a
670 type name. Invalid converter objects throw an error. Re-registering a name
671 replaces its current converter.
672  
673 =head2 remove_converter
674  
675 Remove a custom or built-in converter by name and return the removed
676 converter, or C<undef> if no converter was registered.
677  
678 =head2 get_converter
679  
680 Resolve a registered scalar, enum, array, or supported generic
681 List/Collection converter. Return C<undef> when the type is unsupported.
682  
683 =head2 validate_arity
684  
685 Check an explicitly declared C<parameters> array against the supplied
686 argument count. Missing parameter metadata imposes no arity constraint; an
687 explicit empty array requires zero arguments. Mismatches throw structured
688 constructor or method errors before fixture invocation.
689  
690 =head2 validate_enum_types
691  
692 Validate and copy a fixture's enum declaration hash. Type names cannot
693 shadow registered converters; each value must be a list of unique,
694 non-empty scalar names. Invalid declarations throw an error.
695  
696 =head2 convert_arguments
697  
698 Convert typed scalar arguments in place order and return the converted
699 values. Existing references and undeclared positions are preserved.
700 Conversion failures include the invocation context in their exception.
701  
702 =head2 convert_result
703  
704 Convert a declared result to its SLiM string representation and return the
705 formatted value with a flag indicating whether conversion occurred.
706  
707 =head2 converter_for_runtime_value
708  
709 Return the suitable registered converter for a Perl runtime value, or
710 C<undef> when no converter applies.
711  
712 =head2 element_to_string
713  
714 Format a nested sequence element. Scalars, supported arrays, maps, and
715 objects with explicit string methods are handled; unsupported references
716 throw an error instead of being stringified implicitly.
717  
718 =head2 is_typed_sequence
719  
720 Return true when a declared type resolves to the registry's typed
721 array/List/Collection converter.
722  
723 =head1 CONVERTER CONTRACT
724  
725 Custom converters implement C<from_string($value)> and
726 C<to_string($value)>. They may also implement C<set_registry($registry)> to
727 access the owning registry. This is an executor-scoped fixture extension,
728 not a wire-level SLiM type system.
729  
730 =cut
« lib/Test/FitNesse/Slim/Server.pm ↑ Summary lib/Test/FitNesse/Slim/List.pm »