File: 11-specify_negative_relative.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 (69 lines) | stat: -rw-r--r-- 1,889 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
use strict;

use Test::Builder::Tester tests  => 12;
use Test::Number::Delta relative => -1e-2;

#--------------------------------------------------------------------------#
# delta_ok
#--------------------------------------------------------------------------#

test_out("not ok 1 - foo");
test_fail(+2);
test_diag("0.001000 and 0.000980 are not equal to within 0.00001");
delta_ok( 1e-3, 9.8e-4, "foo" );
test_test("delta_ok fail works");

test_out("not ok 1 - foo");
test_fail(+2);
test_diag("-50.00 and -49.40 are not equal to within 0.5");
delta_ok( -50, -49.4, "foo" );
test_test("delta_ok fail works");

test_out("ok 1 - foo");
delta_ok( 10e-5, 9.91e-5, "foo" );
test_test("delta_ok works");

test_out("ok 1 - foo");
delta_ok( -9.91e-5, -10e-5, "foo" );
test_test("delta_ok works");

test_out("ok 1 - foo");
delta_ok( 1.01, 1.0099, "foo" );
test_test("delta_ok works");

test_out("ok 1 - foo");
delta_ok( -100, -99.1, "foo" );
test_test("delta_ok works");

#--------------------------------------------------------------------------#
# delta_not_ok
#--------------------------------------------------------------------------#

test_out("not ok 1 - foo");
test_fail(+2);
test_diag("Arguments are equal to within relative tolerance 0.01");
delta_not_ok( 1e-3, 9.91e-4, "foo" );
test_test("delta_not_ok fail works");

test_out("not ok 1 - foo");
test_fail(+2);
test_diag("Arguments are equal to within relative tolerance 0.01");
delta_not_ok( -50, -49.6, "foo" );
test_test("delta_no_ok fail works");

test_out("ok 1 - foo");
delta_not_ok( 10e-5, 9.89e-5, "foo" );
test_test("delta_not_ok works");

test_out("ok 1 - foo");
delta_not_ok( -9.89e-5, -10e-5, "foo" );
test_test("delta_not_ok works");

test_out("ok 1 - foo");
delta_not_ok( 1.01, 0.99, "foo" );
test_test("delta_not_ok works");

test_out("ok 1 - foo");
delta_not_ok( -100, -98.1, "foo" );
test_test("delta_not_ok works");