diff --git a/Graphics/Limits/t/limits_range.t b/Graphics/Limits/t/limits_range.t index ab50e26ca..4fc1c90e8 100644 --- a/Graphics/Limits/t/limits_range.t +++ b/Graphics/Limits/t/limits_range.t @@ -1,6 +1,7 @@ use strict; use warnings; use Test::More; +use Test::PDL; use PDL; use PDL::Graphics::Limits; @@ -34,7 +35,7 @@ $x1 = pdl( 1, 2, 3, 4 ); $y1 = pdl( 0, 10, 3, 4 ); @range = limits( [ $x1, $y1 ], { Bounds => 'Zscale', Clean => 'None' } ); -ok( all(approx( pdl(@range), pdl ( 1, 4, -0.4, 8.9 ) )), 'Zscale, None' ) or diag explain \@range; +is_pdl pdl(@range), pdl(1, 4, -0.4, 8.9), 'Zscale, None'; @range = limits( [ 1, 2 ], [ 3, 4 ], { Bounds => 'MinMax', Clean => 'None' } ); is_deeply \@range, [ 1, 3, 2, 4 ], "scalars in the mix " or diag explain \@range; diff --git a/Graphics/Limits/t/limits_round.t b/Graphics/Limits/t/limits_round.t index eea8c6a3a..d5870885f 100644 --- a/Graphics/Limits/t/limits_round.t +++ b/Graphics/Limits/t/limits_round.t @@ -2,6 +2,7 @@ use strict; use warnings; use PDL::LiteF; use Test::More; +use Test::PDL; use PDL::Graphics::Limits; use Config; @@ -55,11 +56,10 @@ my @round_tests = for my $test ( @round_tests ) { - my $down = round_pow( down => $test->[0] ); - my $up = round_pow( up => $test->[0] ); - my $eps = abs($test->[0]) > 1 ? abs($test->[0])/1.0e-6 : 1.0e-6; - - ok( approx($test->[1],$down,$eps) && approx($test->[2],$up,$eps), 'round_pow('. $test->[0] .')' ); + my $down = pdl round_pow( down => $test->[0] ); + my $up = pdl round_pow( up => $test->[0] ); + is_pdl $down, pdl($test->[1]), "round_pow($test->[0])"; + is_pdl $up, pdl($test->[2]), "round_pow($test->[0])"; } done_testing; diff --git a/Graphics/Limits/t/limits_trans_err.t b/Graphics/Limits/t/limits_trans_err.t index 3a193849d..715c56652 100644 --- a/Graphics/Limits/t/limits_trans_err.t +++ b/Graphics/Limits/t/limits_trans_err.t @@ -1,6 +1,7 @@ use strict; use warnings; use Test::More; +use Test::PDL; use PDL; use PDL::Graphics::Limits; @@ -16,18 +17,18 @@ my $y2 = pdl( -1, 2, 4 ); my @udsets = ( [ [ $x1, $xn ], $y1], [ $x2, $y2 ] ); my $range = pdl limits( @udsets, { Bounds => 'MinMax', Clean => 'None', Trans => [ \&log10 ], } ); -ok all(approx($range, pdl([ log10(1-0.5), log10(4), -1, 10 ]))), 'x symmetric trans'; +is_pdl $range, pdl([ log10(1-0.5), log10(4), -1, 10 ]), 'x symmetric trans'; @udsets = ( [ [ $x1, $xn ], $y1], [ [ $x2, undef, $xp ], $y2 ] ); $range = pdl limits( @udsets, { Bounds => 'MinMax', Clean => 'None', Trans => [ \&log10 ], } ); -ok all(approx($range, pdl([ log10(1-0.5), log10(4+0.25), -1, 10 ]))), 'x asymmetric trans'; +is_pdl $range, pdl([ log10(1-0.5), log10(4+0.25), -1, 10 ]), 'x asymmetric trans'; $y1 = pdl( 0.5, 1, 5 ); $y2 = pdl( 0.5, 0.5, 0.5 ); @udsets = ( [ [ $y1, $y2 ] ] ); $range = pdl limits( @udsets, { Bounds => 'MinMax', Clean => 'None', Trans => [ \&log10 ], } ); -ok all(approx($range, pdl([ log10(0.5), log10(5+0.5) ]))), 'illegal errbar lower bounds'; +is_pdl $range, pdl([ log10(0.5), log10(5+0.5) ]), 'illegal errbar lower bounds'; done_testing; diff --git a/Graphics/Limits/t/limits_ulimits.t b/Graphics/Limits/t/limits_ulimits.t index 0fc48ac32..9e858a90f 100644 --- a/Graphics/Limits/t/limits_ulimits.t +++ b/Graphics/Limits/t/limits_ulimits.t @@ -1,6 +1,7 @@ use strict; use warnings; use Test::More; +use Test::PDL; use PDL; use PDL::Graphics::Limits; @@ -84,7 +85,7 @@ my @tests = ( foreach my $test ( @tests ) { my ( $msg, $limits, $exp ) = @$test; my $range = pdl limits( @udsets_arr, { %attr, Limits => $limits } ); - ok( all(approx $range, pdl $exp), "array: $msg" ); + is_pdl $range, pdl($exp), "array: $msg"; } @tests = ( @@ -133,7 +134,7 @@ foreach my $test ( @tests ) { foreach my $test ( @tests ) { my ( $msg, $limits, $exp ) = @$test; my $range = pdl limits( @udsets_hash, { %attr, Limits => $limits, VecKeys => [ qw/ x y / ] } ); - ok( all(approx $range, pdl $exp), "hash: $msg" ); + is_pdl $range, pdl($exp), "hash: $msg"; } ############################################################# @@ -189,7 +190,7 @@ foreach my $test ( @tests ) { foreach my $test ( @tests ) { my ( $msg, $limits, $exp ) = @$test; my $range = pdl limits( @udsets_arr, { %attr, Limits => $limits } ); - ok( all(approx $range, pdl $exp), "array: $msg" ) or diag "($range), [@$exp]\n"; + is_pdl $range, pdl($exp), "array: $msg"; } done_testing;