diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-09-07 20:26:29 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-09-07 20:26:29 +0000 |
commit | e08cd3330d09f5c8e94f2357768232793be75356 (patch) | |
tree | 74bda6f69313aa6254187bb270db1bc8b3046dba /lib/integer.t | |
parent | c656a1024ae46e091ca1cc45aa5a08639040f66c (diff) | |
download | perl-e08cd3330d09f5c8e94f2357768232793be75356.tar.gz |
Clean up 1_compile.t; move tests to more consistent
places (t/ subdirectories); add integer.t (much of
the pragma is tested elsewhere but there is no one
centralized place)
p4raw-id: //depot/perl@11940
Diffstat (limited to 'lib/integer.t')
-rw-r--r-- | lib/integer.t | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/integer.t b/lib/integer.t new file mode 100644 index 0000000000..4184747c3e --- /dev/null +++ b/lib/integer.t @@ -0,0 +1,46 @@ +use integer; + +use Test::More tests => 11; +use Config; + +my $x = 4.5; +my $y = 5.6; +my $z; + +$z = $x + $y; +is($z, 9, "plus"); + +$z = $x - $y; +is($z, -1, "minus"); + +$z = $x * $y; +is($z, 20, "times"); + +$z = $x / $y; +is($z, 0, "divide"); + +$z = $x / $y; +is($z, 0, "modulo"); + +is($x, 4.5, "scalar still floating point"); + +isnt(sqrt($x), 2, "functions still floating point"); + +isnt($x ** .5, 2, "power still floating point"); + +is(++$x, 5.5, "++ still floating point"); + +SKIP: { + my $ivsize = $Config{ivsize}; + skip "ivsize == $ivsize", 2 unless $ivsize == 4 || $ivsize == 8; + + if ($ivsize == 4) { + $z = 2**31 - 1; + is($z + 1, -2147483648, "left shift"); + } elsif ($ivsize == 8) { + $z = 2**63 - 1; + is($z + 1, -9223372036854775808, "left shift"); + } +} + +is(~0, -1, "unsigned"); |