File: get_IV.t

package info (click to toggle)
libmath-mpfr-perl 4.45-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,716 kB
  • sloc: perl: 1,508; ansic: 517; makefile: 9
file content (23 lines) | stat: -rwxr-xr-x 595 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
use strict;
use warnings;

use Math::MPFR qw(:mpfr);

use Test::More;

my $iv = ~0;
my $f = Rmpfr_init2(64);

Rmpfr_set_IV($f, $iv, MPFR_RNDN);
cmp_ok($f, '==', ~0, "~0 assigned correctly in Rmpfr_set_IV()");
cmp_ok($f, '>', 0, "\$f > 0");
cmp_ok(Rmpfr_get_IV($f, MPFR_RNDN), '==', ~0, "Rmpfr_get_IV successfully retrieves ~0");

$iv = -1;
Rmpfr_set_IV($f, $iv, MPFR_RNDN);
cmp_ok($f, '==', -1, "-1 assigned correctly in Rmpfr_set_IV()");
cmp_ok($f, '<', 0, "\$f is now less than zero");
cmp_ok(Rmpfr_get_IV($f, MPFR_RNDN), '==', -1, "Rmpfr_get_IV successfully retrieves -1");


done_testing();