File: 05-check_bad_param.t

package info (click to toggle)
libtest-number-delta-perl 1.06-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 232 kB
  • sloc: perl: 305; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 863 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use strict;
use Test::More tests => 6;

require_ok("Test::Number::Delta");

eval { Test::Number::Delta->import( within => 0.1, relative => 0.01 ) };
like(
    $@,
    "/Can't specify more than one of 'within' or 'relative'/",
    "Import dies with both parameters"
);

for my $p (qw/within relative/) {
    eval { Test::Number::Delta->import( $p => 0 ) };
    like(
        $@,
        "/'$p' parameter must be non-zero/",
        "Import dies if '$p' parameter is zero"
    );
}

eval { Test::Number::Delta::delta_within( 0.1, 0.3, 0, "foo" ) };
like(
    $@,
    "/Value of epsilon to delta_within must be non-zero/",
    "delta_within dies if epsilon is zero"
);
eval { Test::Number::Delta::delta_not_within( 0.1, 0.3, 0, "foo" ) };
like(
    $@,
    "/Value of epsilon to delta_not_within must be non-zero/",
    "delta_not_within dies if epsilon is zero"
);