[pypy-svn] r72704 - in pypy/branch/fix-64/pypy/rlib: . test

arigo at codespeak.net arigo at codespeak.net
Wed Mar 24 14:03:34 CET 2010


Author: arigo
Date: Wed Mar 24 14:03:33 2010
New Revision: 72704

Modified:
   pypy/branch/fix-64/pypy/rlib/rbigint.py
   pypy/branch/fix-64/pypy/rlib/test/test_rbigint.py
Log:
Bah, rbigint(5).ge(rbigint(5)) => False.
What is not tested is broken.


Modified: pypy/branch/fix-64/pypy/rlib/rbigint.py
==============================================================================
--- pypy/branch/fix-64/pypy/rlib/rbigint.py	(original)
+++ pypy/branch/fix-64/pypy/rlib/rbigint.py	Wed Mar 24 14:03:33 2010
@@ -272,13 +272,13 @@
         return False
 
     def le(self, other):
-        return self.lt(other) or self.eq(other)
+        return not other.lt(self)
 
     def gt(self, other):
-        return other.le(self)
+        return other.lt(self)
 
     def ge(self, other):
-        return other.lt(self)
+        return not self.lt(other)
 
     def hash(self):
         return _hash(self)

Modified: pypy/branch/fix-64/pypy/rlib/test/test_rbigint.py
==============================================================================
--- pypy/branch/fix-64/pypy/rlib/test/test_rbigint.py	(original)
+++ pypy/branch/fix-64/pypy/rlib/test/test_rbigint.py	Wed Mar 24 14:03:33 2010
@@ -193,10 +193,13 @@
                 f2 = rbigint.fromlong(y)
                 assert (x < y) ==  f1.lt(f2)
 
-    def test_ge(self):
-        f1 = rbigint.fromlong(13)
-        f2 = rbigint.fromlong(13)
-        assert f1.ge(f2)
+    def test_order(self):
+        f6 = rbigint.fromint(6)
+        f7 = rbigint.fromint(7)
+        assert (f6.lt(f6), f6.lt(f7), f7.lt(f6)) == (0,1,0)
+        assert (f6.le(f6), f6.le(f7), f7.le(f6)) == (1,1,0)
+        assert (f6.gt(f6), f6.gt(f7), f7.gt(f6)) == (0,0,1)
+        assert (f6.ge(f6), f6.ge(f7), f7.ge(f6)) == (1,0,1)
 
     def test_int_conversion(self):
         f1 = rbigint.fromlong(12332)



More information about the Pypy-commit mailing list