File Coverage

blib/lib/RPerl/Test/Foo.pm
Criterion Covered Total %
statement 72 72 100.0
branch n/a
condition n/a
subroutine 24 24 100.0
pod n/a
total 96 96 100.0


line stmt bran cond sub pod time code
1             # [[[ HEADER ]]]
2 2     2   1173 use RPerl;
  2         10  
  2         14  
3             package RPerl::Test::Foo;
4             use strict;
5 2     2   198 use warnings;
  2         6  
  2         519  
6 2     2   13 our $VERSION = 0.004_000;
  2         7  
  2         354  
7              
8 2     2   15 # [[[ OO INHERITANCE ]]]
  2         8  
  2         224  
9             use parent qw(RPerl::CompileUnit::Module::Class);
10             use RPerl::CompileUnit::Module::Class;
11              
12             # [[[ CRITICS ]]]
13 2     2   15 ## no critic qw(ProhibitUselessNoCritic ProhibitMagicNumbers RequireCheckedSyscalls) # USER DEFAULT 1: allow numeric values & print operator
  2         7  
  2         105  
14 2     2   15 ## no critic qw(RequireInterpolationOfMetachars) # USER DEFAULT 2: allow single-quoted control characters & sigils
  2         7  
  2         25  
15             ## no critic qw(ProhibitConstantPragma ProhibitMagicNumbers) # USER DEFAULT 3: allow constants
16              
17 2     2   170 # DEV NOTE: below this line copied from RPerl::CompileUnit::Module::Class::Template
  2         5  
  2         536  
18 2     2   14 # [[[ CONSTANTS ]]]
  2         7  
  2         13  
19             use constant PI => my number $TYPED_PI = 3.141_59;
20             use constant PIE => my string $TYPED_PIE = 'pecan';
21 2     2   121  
  2         5  
  2         62  
22 2     2   11 # [[[ OO PROPERTIES ]]]
  2         4  
  2         11  
23             our hashref $properties = {
24             plugh => my integer $TYPED_plugh = 23,
25 2     2   107 xyzzy => my string $TYPED_xyzzy = 'twenty-three',
  2         5  
  2         338  
26 2     2   15 thud => my integer_arrayref $TYPED_thud = [ 2, 4, 6, 8 ],
  2         5  
  2         12  
27             yyz => my number_hashref $TYPED_yyz = { a => 3.1, b => 6.2, c => 9.3 }
28             };
29 2     2   112  
  2         5  
  2         54  
30 2     2   9 # [[[ SUBROUTINES & OO METHODS ]]]
  2         4  
  2         9  
31              
32             our void::method $quux = sub {
33 2     2   102 ( my object $self) = @ARG;
  2         5  
  2         56  
34 2     2   9 $self->{plugh} = $self->{plugh} + 2;
  2         4  
  2         11  
35             $self->{plugh} = $self->{plugh} - 3;
36             $self->{plugh} = $self->{plugh} * 4; # ensure integer outcome
37             $self->{plugh} = $self->{plugh} / 2; # ensure integer outcome
38             $self->{plugh} = $self->{plugh} % 5;
39             $self->{plugh} = -($self->{plugh});
40             $self->{plugh}++;
41 2     2   157 $self->{plugh}--;
  2         6  
  2         62  
42 2     2   11 };
  2         7  
  2         122  
43              
44             our integer::method $quince = sub {
45             my string $quince_def
46             = '...Cydonia vulgaris ... Cydonia, a city in Crete ... [1913 Webster]';
47 2     2   19 print $quince_def;
  2         11  
  2         11  
48 2     2   144 return (length $quince_def);
  2         10  
  2         202  
49 2     2   15 };
  2         4  
  2         159  
50 2     2   14  
  2         4  
  2         87  
51             our string_hashref::method $qorge = sub {
52             ( my object $self, my integer $qorge_input ) = @ARG;
53             return {
54             a => $self->{xyzzy} x $qorge_input,
55             b => 'howdy',
56             c => q{-23.42}
57             };
58             };
59 2     2   12  
  2         6  
  2         181  
60 2     2   14 our RPerl::Test::Foo_arrayref::method $qaft = sub {
  2         5  
  2         1180  
61             ( my object $self, my integer $foo, my number $bar, my string $bat, my string_hashref $baz ) = @ARG;
62             my RPerl::Test::Foo_arrayref $retval = [];
63             $retval->[0] = RPerl::Test::Foo->new();
64             $retval->[0]->{xyzzy} = 'larry';
65             $retval->[1] = RPerl::Test::Foo->new();
66             $retval->[1]->{xyzzy} = 'curly';
67             $retval->[2] = RPerl::Test::Foo->new();
68             $retval->[2]->{xyzzy} = 'moe';
69             return $retval;
70             };
71              
72             our void $tnurg = sub {
73             print 'PIE() = ' . PIE() . "\n";
74             };
75              
76             our number $tluarg = sub {
77             ( my integer $tluarg_input ) = @ARG;
78             $tluarg_input++;
79             $tluarg_input--;
80             $tluarg_input = $tluarg_input**2;
81             return $tluarg_input**PI();
82             };
83              
84             our number_arrayref $ylprag = sub {
85             ( my integer $ylprag_input, my number_arrayref $ylprag_array ) = @ARG;
86             my integer $ylprag_input_size = scalar @{$ylprag_array};
87             my integer $unylprag_size_typed = scalar @{my integer_arrayref $TYPED_unylprag = [4, 6, 8, 10]};
88             # my integer $unylprag_size_untyped = scalar @{[4, 6, 8, 10]}; missing type_inner, not supported in CPPOPS_CPPTYPES
89             my number_arrayref $ylprag_output = [
90             $ylprag_input * $ylprag_array->[0],
91             $ylprag_input * $ylprag_array->[1],
92             $ylprag_input * $ylprag_array->[2]
93             ];
94             return $ylprag_output;
95             };
96              
97             our string_hashref $ecrog = sub {
98             ( my integer $al, my number $be, my string $ga, my string_hashref $de)
99             = @ARG;
100             return {
101             alpha => integer_to_string($al),
102             beta => number_to_string($be),
103             gamma => $ga,
104             delta => %{$de}
105             };
106             };
107              
108             1; # end of class