alphabet_test.py 673 B

123456789101112131415
  1. import unittest
  2. from terroroftinytown.client.alphabet import int_to_str, str_to_int
  3. class Test(unittest.TestCase):
  4. def test_int_to_str(self):
  5. self.assertEqual('a', int_to_str(0, 'abcde'))
  6. self.assertEqual('1E0F3', int_to_str(123123, '0123456789ABCDEF'))
  7. self.assertEqual('w1R', int_to_str(123123, '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'))
  8. def test_str_to_int(self):
  9. self.assertEqual(0, str_to_int('a', 'abcde'))
  10. self.assertEqual(123123, str_to_int('1E0F3', '0123456789ABCDEF'))
  11. self.assertEqual(123123, str_to_int('w1R', '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'))