Skip to content
This repository was archived by the owner on Feb 4, 2020. It is now read-only.

Commit 87f41b5

Browse files
Cascadesizmmisha
authored andcommitted
Added unit tests
1 parent ca27e39 commit 87f41b5

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/test_unit.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,6 +1166,29 @@ def testDecompression(self):
11661166
self.assertNotEqual(os.path.getsize(srcFilePath), os.path.getsize(tmpFilePath))
11671167
self.assertEqual(os.path.getsize(srcFilePath), os.path.getsize(dstFilePath))
11681168

1169+
class TestToolsetVersion(unittest.TestCase):
1170+
def testCorrectMapping(self):
1171+
from clcache.__main__ import findToolsetVersion
1172+
1173+
for i in range(0, 5):
1174+
compVer, toolVer = ((i * 100) + 1400), ((i * 10) + 80)
1175+
self.assertEqual(findToolsetVersion(compVer), toolVer)
1176+
self.assertEqual(findToolsetVersion(1900), 140)
1177+
for compVer in range(1910, 1920):
1178+
self.assertEqual(findToolsetVersion(compVer), 141)
1179+
for compVer in range(1920, 1930):
1180+
self.assertEqual(findToolsetVersion(compVer), 142)
1181+
1182+
def testIncorrectMapping(self):
1183+
from clcache.__main__ import findToolsetVersion
1184+
from clcache.__main__ import LogicException
1185+
1186+
with self.assertRaises(LogicException):
1187+
findToolsetVersion(100)
1188+
with self.assertRaises(LogicException):
1189+
findToolsetVersion(1456)
1190+
with self.assertRaises(LogicException):
1191+
findToolsetVersion(1930)
11691192

11701193
if __name__ == '__main__':
11711194
unittest.TestCase.longMessage = True

0 commit comments

Comments
 (0)