[svn:parrot] r48755 - trunk/t/op

Paul at osuosl.org Paul at osuosl.org
Wed Sep 1 21:36:30 UTC 2010


Author: Paul C. Anagnostopoulos
Date: Wed Sep  1 21:36:30 2010
New Revision: 48755
URL: https://trac.parrot.org/parrot/changeset/48755

Log:
Integer neg and absolute now promote to BigInt (2)

Modified:
   trunk/t/op/integer.t

Modified: trunk/t/op/integer.t
==============================================================================
--- trunk/t/op/integer.t	Wed Sep  1 21:34:19 2010	(r48754)
+++ trunk/t/op/integer.t	Wed Sep  1 21:36:30 2010	(r48755)
@@ -16,7 +16,7 @@
 
 =cut
 
-.const int TESTS = 152
+.const int TESTS = 153
 
 .sub 'test' :main
     .include 'test_more.pir'
@@ -48,6 +48,7 @@
     test_sub_i_i()
     test_set_n()
     test_neg()
+    test_negate_max_integer()
     test_mul_i_i()
     test_null()
     test_div_i_i_by_zero()
@@ -745,6 +746,23 @@
     is($I0, -3, 'neg_i')
 .end
 
+# Test to ensure that the negative of the maximum integer is equal to the
+# minimum integer + 1. This should be true because we are assuming a
+# two's-complement machine.
+
+.loadlib 'sys_ops'
+.include 'sysinfo.pasm'
+
+.sub test_negate_max_integer
+    .local int max
+    .local int min
+    max = sysinfo .SYSINFO_PARROT_INTMAX
+    neg max
+    min = sysinfo .SYSINFO_PARROT_INTMIN
+    inc min
+    is(max, min)
+.end
+
 .sub 'test_mul_i_i'
     $I0 = 3
     $I1 = 4


More information about the parrot-commits mailing list