from big_integer import BigInteger test_1 = BigInteger('101') test_1_1 = BigInteger('101') test_2 = BigInteger('102') test_3 = BigInteger('-103') print(test_3 < test_2) print(test_1 < test_1_1) print(test_1 <= test_1_1) print(test_2 > test_1) print(test_1 > test_1) print(BigInteger('102') >= BigInteger('102')) print(BigInteger('0') >= BigInteger('0')) print(BigInteger('111') == BigInteger('111')) print(BigInteger('-111') == BigInteger('111')) print(BigInteger('-111') != BigInteger('111')) print(BigInteger('5') + BigInteger('-20')) print(BigInteger('10000') + BigInteger('-1')) print(BigInteger('100') - BigInteger('1')) print(BigInteger('-100') - BigInteger('-1')) print(BigInteger('-123') * BigInteger('17')) print(BigInteger('-5') * BigInteger('5')) print(BigInteger('5') ** 2) print(BigInteger('3') ** 3) print(BigInteger('100') // BigInteger('95')) print(BigInteger('-100') // BigInteger('95'))
def test_big_integer_sub_full_border(self): a = BigInteger([8, 5, 0, 1]) b = BigInteger([9, 5]) c = a - b self.assertEqual(c, BigInteger([9, 9, 9]))
def test_big_integer_mul_empty_to_empty(self): a = BigInteger() b = BigInteger() c = a * b self.assertEqual(c, BigInteger())
def test_big_integer_sub_full_to_full(self): a = BigInteger([6, 7, 3]) b = BigInteger([5, 5]) c = a - b self.assertEqual(c, BigInteger([1, 2, 3]))
def test_big_integer_sub_full_to_empty(self): a = BigInteger([9, 9, 9]) b = BigInteger() c = a - b self.assertEqual(c, BigInteger([9, 9, 9]))
def test_big_integer_eq_true_empty_diff(self): a = BigInteger() b = BigInteger([]) self.assertEqual(a, b)
def test_big_integer_can_create(self): big_integer = BigInteger() self.assertTrue(isinstance(big_integer, BigInteger))
def test_big_integer_eq_false_empty(self): a = BigInteger() b = BigInteger([2, 1, 1, 4, 5]) self.assertNotEqual(a, b)
def test_big_integer_eq_false_diff_size(self): a = BigInteger([1, 1, 1]) b = BigInteger([2, 1, 1, 4, 5]) self.assertNotEqual(a, b)
def test_big_integer_eq_true(self): a = BigInteger([1, 1, 1]) b = BigInteger([1, 1, 1]) self.assertEqual(a, b)
def test_big_integer_can_create_full(self): big_integer = BigInteger([2, 1, 4]) self.assertTrue(isinstance(big_integer, BigInteger))
def test_big_integer_mul_full_to_full(self): a = BigInteger([8, 7, 1]) b = BigInteger([5, 5]) c = a * b self.assertEqual(c, BigInteger([0, 9, 7, 9]))