Пример #1
0
 def test_base_one(self):
     self.assertEqual(decimal_to_base_m(5, 1), [1, 1, 1, 1, 1])
     self.assertEqual(base_m_to_decimal(11111, 1), 5)
     self.assertEqual(base_m_to_decimal([1, 1, 1, 1, 1], 1), 5)
Пример #2
0
 def test_base_25(self):
     self.assertEqual(125, base_m_to_decimal(decimal_to_base_m(125, 25),
                                             25))
     self.assertEqual(
         183513434438,
         base_m_to_decimal(decimal_to_base_m(183513434438, 94), 94))
Пример #3
0
 def test_base_three(self):
     self.assertEqual(decimal_to_base_m(125, 3), [1, 1, 1, 2, 2])
     self.assertEqual(base_m_to_decimal(11122, 3), 125)
     self.assertEqual(base_m_to_decimal([1, 1, 1, 2, 2], 3), 125)
Пример #4
0
 def test_base_nine(self):
     self.assertEqual(decimal_to_base_m(125, 9), [1, 4, 8])
     self.assertEqual(base_m_to_decimal(148, 9), 125)
     self.assertEqual(base_m_to_decimal([1, 4, 8], 9), 125)
Пример #5
0
 def test_base_two(self):
     self.assertEqual(decimal_to_base_m(5, 2), [1, 0, 1])
     self.assertEqual(base_m_to_decimal(101, 2), 5)
     self.assertEqual(base_m_to_decimal([1, 0, 1], 2), 5)