I don't think trying to bracket the hires time with lores
[p5sagit/p5-mst-13.2.git] / lib / integer.t
CommitLineData
88587957 1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6}
7
4d0ed6f7 8use integer;
9
10use Test::More tests => 11;
11use Config;
12
13my $x = 4.5;
14my $y = 5.6;
15my $z;
16
17$z = $x + $y;
18is($z, 9, "plus");
19
20$z = $x - $y;
21is($z, -1, "minus");
22
23$z = $x * $y;
24is($z, 20, "times");
25
26$z = $x / $y;
27is($z, 0, "divide");
28
29$z = $x / $y;
30is($z, 0, "modulo");
31
32is($x, 4.5, "scalar still floating point");
33
34isnt(sqrt($x), 2, "functions still floating point");
35
36isnt($x ** .5, 2, "power still floating point");
37
38is(++$x, 5.5, "++ still floating point");
39
40SKIP: {
41 my $ivsize = $Config{ivsize};
42 skip "ivsize == $ivsize", 2 unless $ivsize == 4 || $ivsize == 8;
43
44 if ($ivsize == 4) {
45 $z = 2**31 - 1;
46 is($z + 1, -2147483648, "left shift");
47 } elsif ($ivsize == 8) {
48 $z = 2**63 - 1;
49 is($z + 1, -9223372036854775808, "left shift");
50 }
51}
52
05f18d1e 53is(~0, -1, "signed instead of unsigned");