-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathtest_runes.py
29 lines (23 loc) · 1.27 KB
/
test_runes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import unittest
from runes import RuneProtocol # Replace with your actual module and class
class TestYourClass(unittest.TestCase):
def setUp(self):
self.obj = RuneProtocol() # Replace with actual object creation logic if needed
def test_symbol_to_int_valid(self):
self.assertEqual(self.obj.symbol_to_int('A'), 1) # 'A' is 0 in base-26
self.assertEqual(self.obj.symbol_to_int('Z'), 26) # 'Z' is 25 in base-26
self.assertEqual(self.obj.symbol_to_int('BA'), 27) # 'BA' is 26 in base-26
#self.assertEqual(self.obj.int_to_symbol(703), 'BBB')
#self.assertEqual(self.obj.int_to_symbol(18278), 'ZZA') # You may want to check the actual correspondence and replace 'ZZZ' if it's not correct.
"""def test_symbol_to_int_invalid(self):
with self.assertRaises(ValueError):
self.obj.symbol_to_int('1') # Test with a digit
with self.assertRaises(ValueError):
self.obj.symbol_to_int('a') # Test with a lowercase letter
with self.assertRaises(ValueError):
self.obj.symbol_to_int('!') # Test with a special character
with self.assertRaises(ValueError):
self.obj.symbol_to_int('') # Test with an empty string
"""
if __name__ == '__main__':
unittest.main()