labels.py 918 B

1234567891011121314151617181920
  1. from __future__ import division, absolute_import, print_function, unicode_literals
  2. from awlsim_tstlib import *
  3. initTest(__file__)
  4. from awlsim.core.labels import * #+cimport
  5. class Test_AwlLabels(TestCase):
  6. def test_generateLabelName(self):
  7. self.assertRaises(ValueError, lambda: AwlLabel.generateLabelName(-1))
  8. self.assertEqual(AwlLabel.generateLabelName(0), "AAAA")
  9. self.assertEqual(AwlLabel.generateLabelName(26**1 - 1), "AAAZ")
  10. self.assertEqual(AwlLabel.generateLabelName(26**1), "AABA")
  11. self.assertEqual(AwlLabel.generateLabelName(26**2 - 1), "AAZZ")
  12. self.assertEqual(AwlLabel.generateLabelName(26**2), "ABAA")
  13. self.assertEqual(AwlLabel.generateLabelName(26**3 - 1), "AZZZ")
  14. self.assertEqual(AwlLabel.generateLabelName(26**3), "BAAA")
  15. self.assertEqual(AwlLabel.generateLabelName(26**4 - 1), "ZZZZ")
  16. self.assertRaises(ValueError, lambda: AwlLabel.generateLabelName(26**4))