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