-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #453 from PDLPorters/rehab_primitive-tests
Reorganize and modlarize tests in t/primitive.t
- Loading branch information
Showing
16 changed files
with
1,760 additions
and
1,191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#! perl | ||
|
||
use strict; | ||
use warnings; | ||
use Test2::V0 '!float'; | ||
use PDL::LiteF; | ||
|
||
use Exporter 'import'; | ||
our @EXPORT = qw( tapprox ); | ||
|
||
sub tapprox { | ||
my ( $x, $y ) = @_; | ||
$_ = pdl($_) for $x, $y; | ||
if ( ( my $dims_x = join( ',', $x->dims ) ) ne | ||
( my $dims_y = join( ',', $y->dims ) ) ) | ||
{ | ||
diag "APPROX: $x $y\n"; | ||
diag "UNEQDIM: |$dims_x| |$dims_y|\n"; | ||
return 0; | ||
} | ||
return 1 if $x->isempty and $y->isempty; | ||
my $d = max( abs( $x - $y ) ); | ||
if ( $d >= 0.01 ) { | ||
diag "got=$x expected=$y\n"; | ||
} | ||
$d < 0.01; | ||
} | ||
|
||
1; |
Oops, something went wrong.