1Test::Deep::Fuzzy(3pm)User Contributed Perl DocumentationTest::Deep::Fuzzy(3pm)
2
3
4
6 Test::Deep::Fuzzy - fuzzy number comparison with Test::Deep
7
9 use Test::Deep;
10 use Test::Deep::Fuzzy;
11
12 my $range = 0.001;
13
14 cmp_deeply({
15 number => 0.0078125,
16 }, {
17 number => is_fuzzy_num(0.008, $range),
18 }, 'number is collect');
19
21 Test::Deep::Fuzzy provides fuzzy number comparison with Test::Deep.
22
24 is_fuzzy_num EXPECTED, RANGE
25 Rounds the values before comparing the values. The RANGE is used for
26 "Math::Round::nearest()" to compare the values.
27
29 Math::Round Test::Deep Test::Number::Delta
30
32 Copyright (C) karupanerura.
33
34 This library is free software; you can redistribute it and/or modify it
35 under the same terms as Perl itself.
36
38 karupanerura <karupa@cpan.org>
39
40
41
42perl v5.32.0 2020-07-28 Test::Deep::Fuzzy(3pm)