def test__x_divrem(self):
     x = 12345678901234567890L
     for i in range(100):
         y = long(randint(0, 1 << 30))
         y <<= 30
         y += randint(0, 1 << 30)
         f1 = rbigint.fromlong(x)
         f2 = rbigint.fromlong(y)
         div, rem = lobj._x_divrem(f1, f2)
         assert div.tolong(), rem.tolong() == divmod(x, y)
示例#2
0
 def test__x_divrem(self):
     x = 12345678901234567890L
     for i in range(100):
         y = long(randint(0, 1 << 30))
         y <<= 30
         y += randint(0, 1 << 30)
         f1 = rbigint.fromlong(x)
         f2 = rbigint.fromlong(y)
         div, rem = lobj._x_divrem(f1, f2)
         assert div.tolong(), rem.tolong() == divmod(x, y)
 def test__divrem(self):
     x = 12345678901234567890L
     for i in range(100):
         y = long(randint(0, 1 << 30))
         y <<= 30
         y += randint(0, 1 << 30)
         for sx, sy in (1, 1), (1, -1), (-1, -1), (-1, 1):
             sx *= x
             sy *= y
             f1 = rbigint.fromlong(sx)
             f2 = rbigint.fromlong(sy)
             div, rem = lobj._x_divrem(f1, f2)
             assert div.tolong(), rem.tolong() == divmod(sx, sy)
示例#4
0
 def test__divrem(self):
     x = 12345678901234567890L
     for i in range(100):
         y = long(randint(0, 1 << 30))
         y <<= 30
         y += randint(0, 1 << 30)
         for sx, sy in (1, 1), (1, -1), (-1, -1), (-1, 1):
             sx *= x
             sy *= y
             f1 = rbigint.fromlong(sx)
             f2 = rbigint.fromlong(sy)
             div, rem = lobj._x_divrem(f1, f2)
             assert div.tolong(), rem.tolong() == divmod(sx, sy)