Utils/Test.pm

filter: Statementstmt 80.0% 16 / 20 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 100% 1 / 1 totaltotal 75.8% 22 / 29 SCAR 7.3
CC
2
Cov
73%
sum_ok
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.1
↑ Summary Utils.pm »
1 package Acme::SGABRIEL::Utils::Test;
2  
3 2 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Test::More;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Test::Builder;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 =head1 NAME
10  
11 Acme::SGABRIEL::Utils::Test
12  
13 =head1 VERSION
14  
15 Version 0.01
16 This is following the book "Intermediate Perl"
17 I was told to do this, so I am doing it.
18 This is not meant for actual use. (which is why it is under "Acme")
19  
20 =cut
21  
22 2 our $VERSION = '0.01';
23  
24  
25 =head1 SYNOPSIS
26  
27 Tests the Util::sum function or other value-based functions
28  
29 use Acme::SGABRIEL::Utils::Test qw( sum_ok );
30 use Acme::SGABRIEL::Utils qw( sum );
31 ...
32 sum_ok( sum(2,2,0), 4, "sum(2,2,0) gives us a value of (4)" )
33 ...
34  
35 =head1 EXPORT
36  
37 sum_ok (default)
38  
39 =head1 SUBROUTINES/METHODS
40  
41 =head2 sum_ok( $expected, $actual, $description )
42  
43 $expected The expression or value that generates the expected value
44 $actual Place the sum() call here, it will return the actual value
45 $description (optional) describes the test
46  
47 =cut
48  
49 sub sum_ok {
50 0 ▶ my ($expected, $actual, $description) = (@_);
Subroutine sum_ok: not called CC=2 SCAR=17.9
Pod documented
51 0 ▶ $description = "ensure expected ($expected) equals actual ($actual)"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $description 0 0 0
52 unless defined $description;
53 0 my $tester = Test::Builder->new();
54 0 return $tester->ok( $expected == $actual, $description );
55 }
56  
57  
58 =head1 AUTHOR
59  
60 Gabriel Sharp, C<< <osirisgothra at hotmail.com> >>
61  
62 =head1 BUGS
63  
64 Please report any bugs or feature requests to C<bug-acme::sgabriel::utils at rt.cpan.org>, or through
65 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Acme::SGABRIEL::Utils>. I will be notified, and then you'll
66 automatically be notified of progress on your bug as I make changes.
67  
68  
69  
70  
71 =head1 SUPPORT
72  
73 You can find documentation for this module with the perldoc command.
74  
75 perldoc Acme::SGABRIEL::Utils::Test
76  
77  
78 You can also look for information at:
79  
80 =over 4
81  
82 =item * RT: CPAN's request tracker (report bugs here)
83  
84 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Acme::SGABRIEL::Utils>
85  
86 =item * AnnoCPAN: Annotated CPAN documentation
87  
88 L<http://annocpan.org/dist/Acme::SGABRIEL::Utils>
89  
90 =item * CPAN Ratings
91  
92 L<http://cpanratings.perl.org/d/Acme::SGABRIEL::Utils>
93  
94 =item * Search CPAN
95  
96 L<http://search.cpan.org/dist/Acme::SGABRIEL::Utils/>
97  
98 =back
99  
100  
101  
102 =head1 LICENSE AND COPYRIGHT
103  
104 Copyright 2014 Gabriel Sharp.
105  
106 This program is free software; you can redistribute it and/or modify it
107 under the terms of the the Artistic License (2.0). You may obtain a
108 copy of the full license at:
109  
110 L<http://www.perlfoundation.org/artistic_license_2_0>
111  
112 Any use, modification, and distribution of the Standard or Modified
113 Versions is governed by this Artistic License. By using, modifying or
114 distributing the Package, you accept this license. Do not use, modify,
115 or distribute the Package, if you do not accept this license.
116  
117 If your Modified Version has been derived from a Modified Version made
118 by someone other than you, you are nevertheless required to ensure that
119 your Modified Version complies with the requirements of this license.
120  
121 This license does not grant you the right to use any trademark, service
122 mark, tradename, or logo of the Copyright Holder.
123  
124 This license includes the non-exclusive, worldwide, free-of-charge
125 patent license to make, have made, use, offer to sell, sell, import and
126 otherwise transfer the Package with respect to any patent claims
127 licensable by the Copyright Holder that are necessarily infringed by the
128 Package. If you institute patent litigation (including a cross-claim or
129 counterclaim) against any party alleging that the Package constitutes
130 direct or contributory patent infringement, then this Artistic License
131 to you shall terminate on the date that such litigation is filed.
132  
133 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
134 AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
135 THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
136 PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
137 YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
138 CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
139 CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
140 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
141  
142  
143 =cut
144  
145 2 1; # End of Acme::SGABRIEL::Utils::Test
↑ Summary Utils.pm »