NAME

Test2::Tools::PDL - Test2 tools for verifying Perl Data Language piddles

VERSION

version 0.0002

SYNOPSIS

    use Test2::Tools::PDL;

    # Functions are exported by default.
    
    # Ensure something is a piddle.
    pdl_ok($x);

    # Compare two piddles.
    pdl_is($got, $expected, 'Same piddle.');

FUNCTIONS

pdl_ok($thing, $name)

Checks that the given $thing is a PDL object.

pdl_is($got, $exp, $name);

Checks that piddle $got is same as $exp.

Now this method is internally similar as is($got->unpdl, $exp->unpdl). It's possible to work with both numeric PDLs as well as non-numeric PDLs (like PDL::Char, PDL::SV).

DESCRIPTION

This module contains tools for verifying PDL piddles.

VARIABLES

This module can be configured by some module variables.

TOLERANCE

Defaultly it's same as $Test2::Compare::Float::DEFAULT_TOLERANCE, which is 1e-8. For piddle of float types piddles the tolerance is applied for comparison.

    $Test2::Tools::PDL::TOLERANCE = 0.01;

You can set this variable to 0 to force exact numeric comparison. For example,

    {
        local $Test2::Tools::PDL::TOLERANCE = 0;
        ...
    }

SEE ALSO

PDL, Test2::Suite, Test::PDL

AUTHOR

Stephan Loyd <sloyd@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by Stephan Loyd.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.