def on_btn_n_muld_released(self): try: n1 = self.get_n_n(1) k = self.get_n_k() result = natural.MUL_ND_N(n1, k) self.add_history_record('%d * %d = %d' % ( common.N_to_num(n1), k, common.N_to_num(result), )) except Exception as e: self.on_exception(e)
def test_one(self): number = [1, [1]] digit = 5 expect = [1, [5]] result = natural.MUL_ND_N(number, digit) self.assertEqual(result, expect)
def test_zero(self): number = [1, [0]] digit = 4 expect = number result = natural.MUL_ND_N(number, digit) self.assertEqual(result, expect)
def test_complex(self): number = [6, [9, 9, 9, 9, 9, 9]] digit = 9 expect = [7, [1, 9, 9, 9, 9, 9, 8]] result = natural.MUL_ND_N(number, digit) self.assertEqual(result, expect)
def test_simple(self): number = [3, [1, 2, 3]] digit = 3 expect = [3, [3, 6, 9]] result = natural.MUL_ND_N(number, digit) self.assertEqual(result, expect)