Assert::Refute::T::Numeric - Numeric tests for Assert::Refute suite.
Somewhere in your unit-test:
use Test::More; use Assert::Refute::T::Numeric; # must come *after* Test::More is_between 4 * atan2( 1, 1 ), 3.1415, 3.1416, "Pi number as expected"; within_delta sqrt(sqrt(sqrt(10)))**8, 10, 1e-9, "floating point round-trip"; within_relative 2**20, 1_000_000, 0.1, "10% precision for 1 mbyte"; done_testing;
Same for production code:
use Assert::Refute; use Assert::Refute::T::Numeric; my $rotate = My::Rotation::Matrix->new( ... ); try_refute { within_delta $rotate->determinant, 1, 1e-6, "Rotation keeps distance"; }; my $total = calculate_price(); try_refute { is_between $total, 1, 100, "Price within reasonable limits"; };
Note that $x comes first and not between boundaries.
Test that $x differs from $expected value by no more than $delta.
Test that $x differs from $expected value by no more than $expected * $delta.
Test::Number::Delta.
Copyright 2017-2018 Konstantin S. Uvarin. <khedin at cpan.org>
<khedin at cpan.org>
This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:
http://www.perlfoundation.org/artistic_license_2_0
To install Assert::Refute::T::Numeric, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Assert::Refute::T::Numeric
CPAN shell
perl -MCPAN -e shell install Assert::Refute::T::Numeric
For more information on module installation, please visit the detailed CPAN module installation guide.