Mercurial > lcfOS
annotate test/testbitfun.py @ 398:c0d9837acde8
x86 target refactor
author | Windel Bouwman |
---|---|
date | Thu, 29 May 2014 12:13:37 +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() |