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.708
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

FUNCTIONS

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

AUTHOR

46       Ricardo Signes <rjbs@cpan.org>
47
49       This software is copyright (c) 2004 by Ricardo Signes.
50
51       This is free software; you can redistribute it and/or modify it under
52       the same terms as the Perl 5 programming language system itself.
53
54
55
56perl v5.32.0                      2020-07-28                 Test::Tolerant(3)
Impressum