Skip to content

Commit 105c513

Browse files
committed
zap approx from t/{pthread,thread_def}.t - #34
1 parent c726e7a commit 105c513

File tree

2 files changed

+11
-17
lines changed

2 files changed

+11
-17
lines changed

t/pthread.t

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ use warnings;
33
use Test::More;
44
use PDL::LiteF;
55
use Benchmark qw(timethese :hireswallclock);
6+
use Test::PDL -atol => 0.01; # set eps
67

78
plan skip_all => 'No threads' if !PDL::Core::pthreads_enabled;
89

9-
approx( pdl(0), pdl(0), 0.01); # set eps
1010
set_autopthread_size(0);
1111

1212
for (
@@ -64,7 +64,7 @@ for (@T) {
6464

6565
$thr_check->();
6666

67-
ok all(approx $pa,$pb), "pa and pb match $label" or diag "diff at:", ($pa != $pb)->whichND."";
67+
is_pdl $pa,$pb, "pa and pb match $label";
6868
}
6969

7070
{
@@ -74,7 +74,7 @@ for (@T) {
7474
my $pc = inner $pa, $pb;
7575
$thr_off->($pa);
7676
my $cc = $pa->sumover;
77-
ok all(approx($pc,$cc)), "inner $label" or diag "pc=$pc\ncc=$cc";
77+
is_pdl $pc, $cc, "inner $label";
7878
}
7979

8080
{
@@ -85,7 +85,7 @@ for (@T) {
8585
$pa+=1;
8686
$thr_off->($pb);
8787
$pb+=1;
88-
ok all(approx $pa, $pb), "+= $label";
88+
is_pdl $pa, $pb, "+= $label";
8989
}
9090

9191
### Multi-dimensional incrementing case ###
@@ -122,11 +122,11 @@ for (@T) {
122122

123123
# Check for writeback to the parent PDL working (should have three ones in the array)
124124
my $lutExSum = $lutEx->sum;
125-
ok all(approx($lutExSum, pdl(3))), "writeback $label";
125+
is_pdl $lutExSum, pdl(3), "writeback $label";
126126

127127
# Check for inplace assignment working. $in should be all ones
128128
my $inSum = $in->sum;
129-
ok all(approx($inSum, pdl(2) )), "inplace $label";
129+
is_pdl $inSum, pdl(2), "inplace $label";
130130
}
131131

132132
{
@@ -158,11 +158,11 @@ for (@T) {
158158

159159
# Check for writeback to the parent PDL working (should have three ones in the array)
160160
my $lutExSum = $lutEx->sum;
161-
ok all(approx($lutExSum, pdl(5))), "writeback with different magic $label";
161+
is_pdl $lutExSum, pdl(5), "writeback with different magic $label";
162162

163163
# Check for inplace assignment working. $in should be all ones
164164
my $inSum = $in->sum;
165-
ok all(approx($inSum, pdl(2))), "inplace with different magic $label";
165+
is_pdl $inSum, pdl(2), "inplace with different magic $label";
166166
}
167167
}
168168

t/thread_def.t

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use Test::More;
22
use PDL::LiteF;
33
use Test::Exception;
4+
use Test::PDL;
45

56
use strict;
67
use warnings;
@@ -34,23 +35,16 @@ broadcast_define 'tprint(a(n);b(n)), NOtherPars => 1', over {
3435

3536
PDL::Core::set_debugging(1) if $debug;
3637
tline($pc,$pb);
37-
38-
note $pa;
39-
note $pb;
40-
41-
ok(all approx($pc,$pb));
38+
is_pdl $pc, $pb;
4239

4340
$pc = ones(5); # produce an error
4441
throws_ok {
4542
tline($pa,$pc);
4643
} qr/conflicting/;
4744

4845
$pa = ones(2,3,4)*sequence(4)->slice('*,*,:');
49-
note $pa;
5046
tassgn($pa,($pb=null));
51-
note "$pb\n";
52-
$pb->dump;
53-
ok(all approx($pb,6*sequence(4)));
47+
is_pdl $pb, 6*sequence(4);
5448

5549
# test if setting named dim with '=' raises error
5650
# correctly at runtime

0 commit comments

Comments
 (0)