File: 05-check_bad_param.t

package info (click to toggle)
libtest-number-delta-perl 1.03-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 164 kB
  • ctags: 12
  • sloc: perl: 124; makefile: 44
file content (25 lines) | stat: -rw-r--r-- 826 bytes parent folder | download | duplicates (2)
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
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"
);