aboutsummaryrefslogtreecommitdiffstats
path: root/tests/tc000_base/labels.py
blob: 15978d7ab2643625592231e40d906a6ef3229119 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from __future__ import division, absolute_import, print_function, unicode_literals
from awlsim_tstlib import *
initTest(__file__)

from awlsim.core.labels import * #+cimport


class Test_AwlLabels(TestCase):
	def test_generateLabelName(self):
		self.assertRaises(ValueError, lambda: AwlLabel.generateLabelName(-1))
		self.assertEqual(AwlLabel.generateLabelName(0),         "AAAA")
		self.assertEqual(AwlLabel.generateLabelName(26**1 - 1), "AAAZ")
		self.assertEqual(AwlLabel.generateLabelName(26**1),     "AABA")
		self.assertEqual(AwlLabel.generateLabelName(26**2 - 1), "AAZZ")
		self.assertEqual(AwlLabel.generateLabelName(26**2),     "ABAA")
		self.assertEqual(AwlLabel.generateLabelName(26**3 - 1), "AZZZ")
		self.assertEqual(AwlLabel.generateLabelName(26**3),     "BAAA")
		self.assertEqual(AwlLabel.generateLabelName(26**4 - 1), "ZZZZ")
		self.assertRaises(ValueError, lambda: AwlLabel.generateLabelName(26**4))
bues.ch cgit interface