lib/JMAP/Validation/Generators/ContactInformation.pm

filter: Statementstmt 100% 25 / 25 Branchbran n/a Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 91.4% 32 / 35 CC 5 SCAR 11.0
CC
5
Cov
96%
generate
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« blib/lib/JMAP/Validation/Generators/ContactGroup.pm ↑ Summary blib/lib/JMAP/Validation/Checks/Attachment.pm »
1 package JMAP::Validation::Generators::ContactInformation;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use JMAP::Validation::Generators::String;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use JSON::PP;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use JSON::Typist;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 my %types = (
11 emails => [qw{
12 personal
13 work
14 other
15 }],
16 phones => [qw{
17 home
18 work
19 mobile
20 fax
21 pager
22 other
23 }],
24 online => [qw{
25 uri
26 username
27 other
28 }],
29 );
30  
31 3 ▶sub generate {
Subroutine generate: called CC=5 SCAR=16.1
Pod undocumented
32 3 my ($type) = @_;
33  
34 3 my @ContactInformation;
35  
36 3 ▶ foreach my $type_value (@{$types{$type} || []}) {
Condition50%1/2
$types{$type} || []
l!l
30
MC/DC0%0/1
$types{$type} || []
$types{$type}
Truth table50%1/2
A
A= $types{$type}
Aresult
11
00
37 12 foreach my $label (JMAP::Validation::Generators::String->generate(), undef) {
38 24 foreach my $isDefault (JSON::PP::true, JSON::PP::false) {
39 48 push @ContactInformation, {
40 type => JSON::Typist::String->new($type_value),
41 label => $label,
42 value => JMAP::Validation::Generators::String->generate(),
43 isDefault => $isDefault,
44 }
45 }
46 }
47 }
48  
49 3 return @ContactInformation;
50 }
51  
52 1 1;
« blib/lib/JMAP/Validation/Generators/ContactGroup.pm ↑ Summary blib/lib/JMAP/Validation/Checks/Attachment.pm »