[svn:parrot] r48986 - in trunk/t: dynoplibs op pmc
plobsing at svn.parrot.org
plobsing at svn.parrot.org
Tue Sep 14 04:30:57 UTC 2010
Author: plobsing
Date: Tue Sep 14 04:30:56 2010
New Revision: 48986
URL: https://trac.parrot.org/parrot/changeset/48986
Log:
eliminate use of sysinfo in coretest. fixes corevm/coretest.
int min/max are now constructed explicitly assuming 2's compliment (already assumed in some tests)
sanity of .SYSINFO_PARROT_INT{MIN,MAX} now offloaded to dynops tests
Modified:
trunk/t/dynoplibs/sysinfo.t
trunk/t/op/integer.t
trunk/t/pmc/bigint.t
Modified: trunk/t/dynoplibs/sysinfo.t
==============================================================================
--- trunk/t/dynoplibs/sysinfo.t Tue Sep 14 00:00:40 2010 (r48985)
+++ trunk/t/dynoplibs/sysinfo.t Tue Sep 14 04:30:56 2010 (r48986)
@@ -11,7 +11,7 @@
use Test::More;
use Config;
-use Parrot::Test tests => 14;
+use Parrot::Test tests => 15;
use Parrot::Config;
@@ -183,6 +183,21 @@
CODE
}
+pir_output_is(<<'CODE', <<OUTPUT, 'INTVAL min and max coherence');
+# assumes 2's compliment integer math
+.sub 'main' :main
+ .include 'test_more.pir'
+ .local int min, max
+ max = sysinfo .SYSINFO_PARROT_INTMAX
+ neg max
+ min = sysinfo .SYSINFO_PARROT_INTMIN
+ inc min
+ is(max, min)
+.end
+CODE
+ok 1
+OUTPUT
+
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
Modified: trunk/t/op/integer.t
==============================================================================
--- trunk/t/op/integer.t Tue Sep 14 00:00:40 2010 (r48985)
+++ trunk/t/op/integer.t Tue Sep 14 04:30:56 2010 (r48986)
@@ -750,15 +750,29 @@
# minimum integer + 1. This should be true because we are assuming a
# two's-complement machine.
-.loadlib 'sys_ops'
-.include 'sysinfo.pasm'
-
+.include 'iglobals.pasm'
.sub test_negate_max_integer
- .local int max
- .local int min
- max = sysinfo .SYSINFO_PARROT_INTMAX
+ .local int max, min
+
+ $P0 = getinterp
+ $P1 = $P0[.IGLOBALS_CONFIG_HASH]
+ $I0 = $P1['intvalsize']
+
+ # XXX can't use sysinfo (from sys_ops) in coretest
+ # build up 2's compliment min and max integers manually
+ max = 0x7F
+ min = 0x80
+ dec $I0
+ loop:
+ unless $I0 goto end_loop
+ min <<= 8
+ max <<= 8
+ max |= 0xFF
+ dec $I0
+ goto loop
+ end_loop:
+
neg max
- min = sysinfo .SYSINFO_PARROT_INTMIN
inc min
is(max, min)
.end
Modified: trunk/t/pmc/bigint.t
==============================================================================
--- trunk/t/pmc/bigint.t Tue Sep 14 00:00:40 2010 (r48985)
+++ trunk/t/pmc/bigint.t Tue Sep 14 04:30:56 2010 (r48986)
@@ -506,16 +506,36 @@
ok($I1, 'negation')
.end
-.loadlib 'sys_ops'
-.include 'sysinfo.pasm'
+.sub 'get_int_minmax'
+ .local int min, max
+
+ $P0 = getinterp
+ $P1 = $P0[.IGLOBALS_CONFIG_HASH]
+ $I0 = $P1['intvalsize']
+
+ # XXX can't use sysinfo (from sys_ops) in coretest
+ # build up 2's compliment min and max integers manually
+ max = 0x7F
+ min = 0x80
+ dec $I0
+ loop:
+ unless $I0 goto end_loop
+ min <<= 8
+ max <<= 8
+ max |= 0xFF
+ dec $I0
+ goto loop
+ end_loop:
+
+ .return (min, max)
+.end
.sub negate_min_integer
.local int max
.local int min
.local pmc max_1
.local pmc neg_min
- max = sysinfo .SYSINFO_PARROT_INTMAX
- min = sysinfo .SYSINFO_PARROT_INTMIN
+ (min, max) = 'get_int_minmax'()
max_1 = box max
inc max_1
neg_min = box min
@@ -547,8 +567,7 @@
.local pmc max_1
.local pmc neg_min
.local pmc result
- max = sysinfo .SYSINFO_PARROT_INTMAX
- min = sysinfo .SYSINFO_PARROT_INTMIN
+ (min, max) = 'get_int_minmax'()
max_1 = box max
inc max_1
neg_min = box min
More information about the parrot-commits
mailing list