File: and_constant.t

package info (click to toggle)
libnumber-tolerant-perl 1.710-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 372 kB
  • sloc: perl: 757; makefile: 10
file content (27 lines) | stat: -rw-r--r-- 617 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
use Test::More tests => 9;

use strict;
use warnings;

BEGIN { use_ok("Number::Tolerant"); }

{
  my $range = Number::Tolerant->new(5 => to => 9);

  isa_ok($range, 'Number::Tolerant');

  is($range & 5.0,   5.0, ' ... $range & 5.0 == 5.0');
  is($range & 5.0,   5.0, ' ... 5.0 & $range == 5.0');
  is($range & 6.5,   6.5, ' ... $range & 6.5 == 6.5');
  is($range & 6.5,   6.5, ' ... 6.5 & $range == 6.5');

  ok(! eval { $range & 1.0 }, ' ... 6.5 & $range == exception');
}

{
  my $range = Number::Tolerant->new(-5 => to => 5);

  isa_ok($range, 'Number::Tolerant');

  is($range & 0, 0, ' ... $range & 0 == 0');
}