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