| 1 | package | ||
| 2 | TestConstants; | ||
| 3 | |||
| 4 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 1 | require Exporter; | |
| 8 | 1 | our @ISA = qw/Exporter/; | |
| 9 | 1 | our @EXPORT = qw/SAMPLE_SIZE | |
| 10 | HOME_DIR SIMPLE_DIR EMPTY_DIR REC_DIR | ||
| 11 | SIMPLE_FILES SIMPLE_FILES_WITH_NR SIMPLE_FILES_WITH_DOT | ||
| 12 | REC_FILES REC_TOP_FILES REC_ODD_FILES | ||
| 13 | SIMPLE_CONTENTS | ||
| 14 | REC_CONTENTS | ||
| 15 | no_slash with_slash/; | ||
| 16 | |||
| 17 | 1 | our @EXPORT_OK = @EXPORT; | |
| 18 | 1 | our %EXPORT_TAGS = (); | |
| 19 | 1 | our $VERSION = '0.01'; | |
| 20 | |||
| 21 | 1 | ▶ | use Test::More; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | 1 | ▶ | use Test::Exception; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 23 | |||
| 24 | 1 | ▶ | use Set::Scalar; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 25 | 1 | ▶ | use Data::Dumper; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 26 | |||
| 27 | 1 | ▶ | use Cwd; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 28 | |||
| 29 | sub files { | ||
| 30 | 5 | ▶ | return map {"file$_"} @_; |
|
Subroutine
files: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 31 | } | ||
| 32 | |||
| 33 | 1 | ▶ | use constant HOME_DIR => cwd() . '/test'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 34 | 1 | ▶ | use constant SIMPLE_DIR => cwd() . '/test/dir'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 35 | 1 | ▶ | use constant EMPTY_DIR => SIMPLE_DIR . '/empty'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 36 | 1 | ▶ | use constant REC_DIR => SIMPLE_DIR . '/rec'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 37 | |||
| 38 | 1 | ▶ | use constant SIMPLE_FILES_WITH_NR => files(1 .. 5); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 39 | 1 | ▶ | use constant SIMPLE_FILES_WITH_DOT => qw/x.dat y.dat z.dat/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 40 | 1 | use constant SIMPLE_FILES => SIMPLE_FILES_WITH_NR, | |
| 41 | 1 | ▶ | SIMPLE_FILES_WITH_DOT; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 42 | |||
| 43 | 1 | ▶ | use constant REC_TOP_FILES => files(1 .. 3); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 44 | use constant REC_FILES => REC_TOP_FILES, | ||
| 45 | 3 | map( {"sub1/$_"} files(4 .. 6) ), | |
| 46 | 3 | map( {"sub1/subsub/$_"} files(7 .. 9) ), | |
| 47 | 1 | ▶ | map( {"sub2/$_"} files(10 .. 12) ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 48 | 1 | ▶ | use constant REC_ODD_FILES => grep m/[13579]$/, REC_FILES; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 49 | |||
| 50 | 1 | ▶ | use constant REC_CONTENTS => map {"Content: $_"} REC_FILES; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 51 | 5 | use constant SIMPLE_CONTENTS => ( map({"Content: $_"} SIMPLE_FILES_WITH_NR), | |
| 52 | 1 | map({"line 0\nline 1\nline 2\n$_\nline 4"} | |
| 53 | 1 | ▶ | SIMPLE_FILES_WITH_DOT) ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 54 | |||
| 55 | 1 | ▶ | use constant SAMPLE_SIZE => 250; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 56 | |||
| 57 | sub no_slash { | ||
| 58 | 4 | ▶ | my $path = shift; |
|
Subroutine
no_slash: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 59 | 4 | $path =~ s:[/\\]*$::; | |
| 60 | 4 | return $path; | |
| 61 | } | ||
| 62 | |||
| 63 | sub with_slash { | ||
| 64 | 2 | ▶ | no_slash(shift()) . '/'; |
|
Subroutine
with_slash: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 65 | } | ||
| 66 | |||
| 67 | 1 | 1; | |