line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
2
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Test::Deep::PDL; |
5
|
|
|
|
|
|
|
$Test::Deep::PDL::VERSION = '0.14'; |
6
|
|
|
|
|
|
|
# ABSTRACT: Test piddles inside data structures with Test::Deep |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
355
|
use Test::Deep::Cmp; |
|
1
|
|
|
|
|
561
|
|
|
1
|
|
|
|
|
4
|
|
10
|
1
|
|
|
1
|
|
68
|
use Test::PDL qw( eq_pdl_diag ); |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
4
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub init |
14
|
|
|
|
|
|
|
{ |
15
|
60
|
|
|
60
|
0
|
361
|
my $self = shift; |
16
|
60
|
|
|
|
|
83
|
my $expected = shift; |
17
|
60
|
50
|
|
|
|
75
|
die "Supplied value is not a piddle" unless eval { $expected->isa('PDL') }; |
|
60
|
|
|
|
|
205
|
|
18
|
60
|
|
|
|
|
168
|
$self->{expected} = $expected; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub descend |
22
|
|
|
|
|
|
|
{ |
23
|
51
|
|
|
51
|
0
|
105005
|
my $self = shift; |
24
|
51
|
|
|
|
|
96
|
my $got = shift; |
25
|
51
|
|
|
|
|
133
|
my( $ok, $diag ) = Test::PDL::eq_pdl_diag( $got, $self->{expected} ); |
26
|
51
|
|
|
|
|
119
|
$self->data->{diag} = $diag; |
27
|
51
|
|
|
|
|
489
|
return $ok; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub diag_message |
31
|
|
|
|
|
|
|
{ |
32
|
3
|
|
|
3
|
0
|
2297
|
my $self = shift; |
33
|
3
|
|
|
|
|
6
|
my $where = shift; |
34
|
3
|
|
|
|
|
8
|
return "Comparing $where as a piddle:\n" . $self->data->{diag}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub renderExp |
38
|
|
|
|
|
|
|
{ |
39
|
3
|
|
|
3
|
0
|
513
|
my $self = shift; |
40
|
3
|
|
|
|
|
7
|
return $self->renderGot( $self->{expected} ); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub renderGot |
44
|
|
|
|
|
|
|
{ |
45
|
6
|
|
|
6
|
0
|
43
|
my $self = shift; |
46
|
6
|
|
|
|
|
9
|
my $val = shift; |
47
|
6
|
|
|
|
|
8
|
my $fmt = '%-8T %-12D (%-5S) '; |
48
|
6
|
100
|
|
|
|
8
|
return eval { $val->isa('PDL') } ? ($val->info($fmt) . $val) : ("(" . Test::Deep::render_val($val) . ")"); |
|
6
|
|
|
|
|
39
|
|
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |