File Coverage

perllib/Arch/Test/Cases.pm
Criterion Covered Total %
statement 12 47 25.5
branch n/a
condition n/a
subroutine 4 8 50.0
pod 3 4 75.0
total 19 59 32.2


line stmt bran cond sub pod time code
1             # Arch Perl library, Copyright (C) 2005 Enno Cramer
2             #
3             # This program is free software; you can redistribute it and/or modify
4             # it under the terms of the GNU General Public License as published by
5             # the Free Software Foundation; either version 2 of the License, or
6             # (at your option) any later version.
7             #
8             # This program is distributed in the hope that it will be useful,
9             # but WITHOUT ANY WARRANTY; without even the implied warranty of
10             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11             # GNU General Public License for more details.
12             #
13             # You should have received a copy of the GNU General Public License
14             # along with this program; if not, write to the Free Software
15             # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16              
17 1     1   17 use 5.005;
  1         2  
  1         32  
18 1     1   5 use strict;
  1         2  
  1         50  
19              
20             package Arch::Test::Cases;
21              
22 1     1   495 use Arch::Test::Framework;
  1         3  
  1         146  
23 1     1   9 use Arch::Test::Tree;
  1         2  
  1         5  
24              
25             sub generate_empty_tree ($$;$) {
26 0     0 1   my $fw = shift;
27              
28 0           return $fw->make_tree(@_);
29             }
30              
31             sub generate_trivial_tree ($$;$) {
32 0     0 0   my $tree = &generate_empty_tree(@_);
33              
34 0           foreach my $f (qw(README INSTALL COPYING)) {
35 0           $tree->add_file('.', $f);
36             }
37              
38 0           return $tree;
39             }
40              
41             sub generate_simple_tree ($$;$) {
42 0     0 1   my $tree = &generate_trivial_tree(@_);
43              
44 0           my $inc = $tree->add_dir('.', 'include');
45 0           my $src = $tree->add_dir('.', 'src');
46 0           my $bld = $tree->add_dir('.', 'build');
47              
48 0           foreach my $f (qw(io.h logic.h)) {
49 0           $tree->add_file($inc, $f);
50             }
51              
52 0           foreach my $f (qw(io.c logic.c main.c)) {
53 0           $tree->add_file($src, $f);
54             }
55              
56 0           $tree->add_file('.', 'Makefile');
57              
58 0           return $tree;
59             }
60              
61             sub generate_complex_tree ($$;$) {
62 0     0 1   my $tree = &generate_trivial_tree(@_);
63              
64 0           my $version = join('--', reverse split(/\//, $_[1]));
65              
66 0           my $inc = $tree->add_dir('.', 'include');
67 0           my $src = $tree->add_dir('.', 'src');
68 0           my $dat = $tree->add_dir('.', 'data');
69              
70             # text source files
71 0           foreach my $d (qw(base util io mem)) {
72 0           my $inc_sub = $tree->add_dir($inc, $d);
73 0           my $src_sub = $tree->add_dir($src, $d);
74              
75 0           for (1..10) {
76 0           $tree->add_file($inc_sub);
77 0           $tree->add_file($src_sub);
78             }
79             }
80              
81             # binary files
82 0           for (1..3) {
83 0           $tree->add_file($dat, undef, pack('CCCC', 1, 2, 3, 4));
84             }
85              
86             # symlink
87 0           $tree->add_link('.', 'LICENSE', 'COPYING');
88            
89             # clutter
90 0           $tree->add_dir('.', ',,undo-1');
91 0           $tree->add_file('.', "++log.$version~");
92 0           $tree->add_file('.', '+notes');
93 0           $tree->add_file('.', 'README~');
94            
95 0           return $tree;
96             }
97            
98              
99             1;
100              
101             __END__