1Test::Tolerant(3)     User Contributed Perl Documentation    Test::Tolerant(3)
2
3
4

NAME

6       Test::Tolerant - test routines for testing numbers against tolerances
7

VERSION

9       version 1.710
10

SYNOPSIS

12         use Test::More;
13         use Test::Tolerant;
14
15         my $total = rand(6) + rand(6) + rand(6);
16         is_tol(10, [ qw( 3 to 18 ) ], "got an acceptable result from random dice");
17
18         done_testing;
19

PERL VERSION

21       This library should run on perls released even a long time ago.  It
22       should work on any version of perl released in the last five years.
23
24       Although it may work on older versions of perl, no guarantee is made
25       that the minimum required version will not be increased.  The version
26       may be increased for any reason, and there is no promise that patches
27       will be accepted to lower the minimum required perl.
28

FUNCTIONS

30   is_tol
31         is_tol($have, $want_spec, $comment);
32
33       "is_tol" is the only routine provided by Test::Tolerant, and is
34       exported by default.  It beahves like "is" from Test::More, asserting
35       that two values must be equal, but it will always use numeric equality,
36       and the second argument is not always used as the right hand side of
37       comparison directly, but it used to produce a Number::Tolerant to
38       compare to.
39
40       $have_spec can be:
41
42         * a Number::Tolerant object
43         * an arrayref of args to Number::Tolerant->new
44         * a string to be passed to Number::Tolerant->from_string
45           * a literal number falls under this group
46
47       If the value is outside of spec, you'll get a diagnostic message
48       something like this:
49
50         given value is outside acceptable tolerances
51             have: 3
52             want: 5 < x
53

AUTHOR

55       Ricardo Signes <cpan@semiotic.systems>
56
58       This software is copyright (c) 2004 by Ricardo Signes.
59
60       This is free software; you can redistribute it and/or modify it under
61       the same terms as the Perl 5 programming language system itself.
62
63
64
65perl v5.36.0                      2023-01-20                 Test::Tolerant(3)
Impressum