Mercurial > lcfOS
annotate test/testbitfun.py @ 384:94f5b719ad0b
Small refactor
author | Windel Bouwman |
---|---|
date | Sun, 27 Apr 2014 17:50:25 +0200 |
parents | 3bb7dcfe5529 |
children |
rev | line source |
---|---|
346 | 1 |
2 | |
3 import unittest | |
4 import sys | |
5 from ppci.bitfun import rotate_left, rotate_right | |
6 | |
7 | |
8 class BitRotationTestCase(unittest.TestCase): | |
9 def testRightRotation(self): | |
10 self.assertEqual(0xFF000000, rotate_right(0xFF, 8)) | |
11 self.assertEqual(0x0FF00000, rotate_right(0xFF, 12)) | |
12 | |
13 def testLeftRotation(self): | |
14 self.assertEqual(0x0000FF00, rotate_left(0xFF, 8)) | |
15 self.assertEqual(0x001FE000, rotate_left(0xFF, 13)) | |
16 | |
17 | |
18 if __name__ == '__main__': | |
19 unittest.main() | |
20 sys.exit() |