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

Commit

Permalink
Added unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Cascades authored and izmmisha committed Aug 16, 2019
1 parent ca27e39 commit 87f41b5
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,29 @@ def testDecompression(self):
self.assertNotEqual(os.path.getsize(srcFilePath), os.path.getsize(tmpFilePath))
self.assertEqual(os.path.getsize(srcFilePath), os.path.getsize(dstFilePath))

class TestToolsetVersion(unittest.TestCase):
def testCorrectMapping(self):
from clcache.__main__ import findToolsetVersion

for i in range(0, 5):
compVer, toolVer = ((i * 100) + 1400), ((i * 10) + 80)
self.assertEqual(findToolsetVersion(compVer), toolVer)
self.assertEqual(findToolsetVersion(1900), 140)
for compVer in range(1910, 1920):
self.assertEqual(findToolsetVersion(compVer), 141)
for compVer in range(1920, 1930):
self.assertEqual(findToolsetVersion(compVer), 142)

def testIncorrectMapping(self):
from clcache.__main__ import findToolsetVersion
from clcache.__main__ import LogicException

with self.assertRaises(LogicException):
findToolsetVersion(100)
with self.assertRaises(LogicException):
findToolsetVersion(1456)
with self.assertRaises(LogicException):
findToolsetVersion(1930)

if __name__ == '__main__':
unittest.TestCase.longMessage = True
Expand Down

0 comments on commit 87f41b5

Please sign in to comment.