line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
############# |
2
|
|
|
|
|
|
|
# Created By: setitesuk |
3
|
|
|
|
|
|
|
# Created On: 2010-04-20 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Test::Structures::Data; |
6
|
1
|
|
|
1
|
|
38656
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
7
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
8
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
63
|
|
9
|
1
|
|
|
1
|
|
6
|
use English qw{-no_match_vars}; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
10
|
1
|
|
|
1
|
|
1322
|
use Readonly; Readonly::Scalar our $VERSION => 0.025; |
|
1
|
|
|
|
|
5488
|
|
|
1
|
|
|
|
|
79
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
8
|
use base qw{Exporter}; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
94
|
|
13
|
|
|
|
|
|
|
our @EXPORT = qw{is_value_found_in_hash_values}; ## no critic (Modules::ProhibitAutomaticExportation) |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
5
|
use Test::Builder; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
142
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $test = Test::Builder->new(); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 NAME |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Test::Structures::Data |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 VERSION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
$LastChangedRevision$ |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 SYNOPSIS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
use Test::More tests => 21; |
30
|
|
|
|
|
|
|
use Test::Structures::Data; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
is_value_found_in_hash_values( $value, $href, $optional_description ); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 DESCRIPTION |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
This module gives additional tests created by Test::Builder which will test data structures. Currently only one is available, |
37
|
|
|
|
|
|
|
however more are planned. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 is_value_found_in_hash_values |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
exported by default. This test checks to see if the value you provide is within the values of the hashref also provided as the second arguement. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
is_value_found_in_hash_values( $value, $href, $optional_description ); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub is_value_found_in_hash_values { |
50
|
1
|
|
|
1
|
1
|
257
|
my ( $value, $hash, $desc ) = @_; |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
3
|
my $result; |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
|
|
3
|
foreach my $key ( keys %{ $hash } ) { |
|
1
|
|
|
|
|
6
|
|
55
|
11
|
100
|
|
|
|
31
|
if ( $value eq $hash->{$key} ) { |
56
|
1
|
|
|
|
|
3
|
$result = 1; |
57
|
1
|
|
|
|
|
3
|
last; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
50
|
|
|
8
|
return $test->ok( $result, $desc ) || $test->diag( "$value not found in hash $hash" ); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
__END__ |