File Coverage

t/PerlySense-Document-Api-consists-supported.t
Criterion Covered Total %
statement 64 64 100.0
branch 1 2 50.0
condition n/a
subroutine 9 9 100.0
pod n/a
total 74 75 98.6


line stmt bran cond sub pod time code
1             #!/usr/bin/perl -w
2 1     1   100887 use strict;
  1         2  
  1         73  
3              
4 1     1   506 use Test::More tests => 18;
  1         39354  
  1         11  
5 1     1   1601 use Test::Exception;
  1         4503  
  1         5  
6              
7 1     1   932 use Data::Dumper;
  1         5763  
  1         52  
8              
9 1     1   356 use lib "../lib";
  1         554  
  1         3  
10              
11 1     1   72195 use_ok("Devel::PerlySense::Document::Api");
  1         396  
  1         3  
  1         1  
  1         6  
12 1     1   275 use_ok("Devel::PerlySense::Document");
  1         74  
  1         1  
  1         1  
  1         5  
13 1     1   192 use_ok("Devel::PerlySense");
  1         249  
  1         1  
  1         1  
  1         6  
14              
15              
16 1 50   1   1913 BEGIN { -d "t" and chdir("t"); }
17              
18 1         188 my $dirData = "data/project-lib";
19 1         3 my $fileOrigin = "$dirData/Game/Event/Timed.pm";
20 1         2 my $nameModule = "Game::Event::Timed";
21              
22 1         2 my $oLocation;
23 1         1 my $method;
24              
25              
26 1         7 print "\n* Class\n";
27              
28 1         5 ok(my $oDocument = Devel::PerlySense::Document->new(oPerlySense => Devel::PerlySense->new()), "new ok");
29 1         192 ok($oDocument->parse(file => $fileOrigin), "Parsed file ok");
30              
31 1         281 ok($oDocument->determineLikelyApi(nameModule => $nameModule), "determineLikelyApi ok");
32              
33 1         217 ok(my $oApi = $oDocument->rhPackageApiLikely->{$nameModule}, "Got package API ok");
34              
35              
36              
37              
38 1         188 my $raMethod;
39              
40              
41 1         2 $raMethod = [qw/ timeNextTick timeInterval checkTick /];
42 1         4 is($oApi->percentSupportedOf($raMethod), 100, " percentSupportedOf for all present");
43              
44 1         191 $raMethod = [qw/ missing_method /];
45 1         5 is($oApi->percentSupportedOf($raMethod), 0, " percentSupportedOf for none present");
46              
47 1         188 $raMethod = [qw/ /];
48 1         3 is($oApi->percentSupportedOf($raMethod), 0, " percentSupportedOf for none given (and none present)");
49              
50 1         192 $raMethod = [qw/ timeNextTick timeInterval checkTick missing_method /];
51 1         3 is($oApi->percentSupportedOf($raMethod), 75, " percentSupportedOf for one missing present");
52              
53              
54              
55              
56              
57 1         188 $raMethod = [qw/ missing_method /];
58 1         5 is($oApi->percentConsistsOf($raMethod), 0, " percentConsistsOf for one missing method");
59              
60 1         187 $raMethod = [qw/ /];
61 1         4 is($oApi->percentConsistsOf($raMethod), 0, " percentConsistsOf for no methods");
62              
63 1         188 $raMethod = [qw/ missing_method /];
64 1         3 is($oApi->percentConsistsOf($raMethod), 0, " percentConsistsOf for one missing method");
65              
66 1         188 $raMethod = [qw/ timeNextTick timeInterval new checkTick /];
67 1         3 is($oApi->percentConsistsOf($raMethod), 100, " percentConsistsOf for all methods");
68              
69 1         198 $raMethod = [qw/ timeNextTick timeInterval new checkTick missing_method /];
70 1         4 is($oApi->percentConsistsOf($raMethod), 100, " percentConsistsOf for all methods + one extra");
71              
72 1         188 $raMethod = [qw/ timeNextTick timeInterval new /];
73 1         4 is($oApi->percentConsistsOf($raMethod), 75, " percentConsistsOf for all methods but one");
74              
75              
76 1         189 $raMethod = [qw/ timeNextTick timeInterval new missing_method /];
77 1         4 is($oApi->percentConsistsOf($raMethod), 75, " percentConsistsOf for all methods but one + one extra");
78              
79              
80            
81              
82              
83             __END__