| 1 | ###################################################################### | ||||||||||||||||||||
| 2 | # $Id: BaseCacheTester.pm,v 1.7 2002/04/07 17:04:46 dclinton Exp $ | ||||||||||||||||||||
| 3 | # Copyright (C) 2001-2003 DeWitt Clinton All Rights Reserved | ||||||||||||||||||||
| 4 | # | ||||||||||||||||||||
| 5 | # Software distributed under the License is distributed on an "AS | ||||||||||||||||||||
| 6 | # IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or | ||||||||||||||||||||
| 7 | # implied. See the License for the specific language governing | ||||||||||||||||||||
| 8 | # rights and limitations under the License. | ||||||||||||||||||||
| 9 | ###################################################################### | ||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | package Cache::BaseCacheTester; | ||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 4 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | sub new | ||||||||||||||||||||
| 19 | { | ||||||||||||||||||||
| 20 | 6 | ▶ | my ( $proto, $base_test_count ) = @_; | ||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.4
Pod
documented
| |||||||||||||||||||||
| 21 | 6 | ▶ | my $class = ref( $proto ) || $proto; | ||||||||||||||||||
|
Condition33%1/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 22 | 6 | my $self = {}; | |||||||||||||||||||
| 23 | 6 | bless ( $self, $class ); | |||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | 6 | ▶ | $base_test_count = defined $base_test_count ? $base_test_count : 0 ; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | 6 | $self->_set_test_count( $base_test_count ); | |||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | 6 | return $self; | |||||||||||||||||||
| 30 | } | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | sub ok | ||||||||||||||||||||
| 34 | { | ||||||||||||||||||||
| 35 | 158 | ▶ | my ( $self ) = @_; | ||||||||||||||||||
|
Subroutine
ok: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | 158 | my $test_count = $self->_get_test_count( ); | |||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 158 | print "ok $test_count\n"; | |||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | 158 | $self->_increment_test_count( ); | |||||||||||||||||||
| 42 | } | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | sub not_ok | ||||||||||||||||||||
| 46 | { | ||||||||||||||||||||
| 47 | 0 | ▶ | my ( $self, $message ) = @_; | ||||||||||||||||||
|
Subroutine
not_ok: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | 0 | my $test_count = $self->_get_test_count( ); | |||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | 0 | print "not ok $test_count # failed '$message'\n"; | |||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 0 | $self->_increment_test_count( ); | |||||||||||||||||||
| 54 | } | ||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | sub skip | ||||||||||||||||||||
| 58 | { | ||||||||||||||||||||
| 59 | 0 | ▶ | my ( $self, $message ) = @_; | ||||||||||||||||||
|
Subroutine
skip: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | 0 | my $test_count = $self->_get_test_count( ); | |||||||||||||||||||
| 62 | |||||||||||||||||||||
| 63 | 0 | print "ok $test_count # skipped $message \n"; | |||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | 0 | $self->_increment_test_count( ); | |||||||||||||||||||
| 66 | } | ||||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | sub _set_test_count | ||||||||||||||||||||
| 70 | { | ||||||||||||||||||||
| 71 | 6 | ▶ | my ( $self, $test_count ) = @_; | ||||||||||||||||||
|
Subroutine
_set_test_count: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 72 | |||||||||||||||||||||
| 73 | 6 | $self->{_Test_Count} = $test_count; | |||||||||||||||||||
| 74 | } | ||||||||||||||||||||
| 75 | |||||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | sub _get_test_count | ||||||||||||||||||||
| 78 | { | ||||||||||||||||||||
| 79 | 160 | ▶ | my ( $self ) = @_; | ||||||||||||||||||
|
Subroutine
_get_test_count: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 80 | |||||||||||||||||||||
| 81 | 160 | return $self->{_Test_Count}; | |||||||||||||||||||
| 82 | } | ||||||||||||||||||||
| 83 | |||||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | sub _increment_test_count | ||||||||||||||||||||
| 86 | { | ||||||||||||||||||||
| 87 | 158 | ▶ | my ( $self ) = @_; | ||||||||||||||||||
|
Subroutine
_increment_test_count: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 88 | |||||||||||||||||||||
| 89 | 158 | $self->{_Test_Count}++; | |||||||||||||||||||
| 90 | } | ||||||||||||||||||||
| 91 | |||||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | 4 | 1; | |||||||||||||||||||
| 94 | |||||||||||||||||||||
| 95 | |||||||||||||||||||||
| 96 | __END__ | ||||||||||||||||||||