diff test/testbitfun.py @ 346:3bb7dcfe5529

expanded arm target
author Windel Bouwman
date Fri, 07 Mar 2014 17:05:32 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/testbitfun.py	Fri Mar 07 17:05:32 2014 +0100
@@ -0,0 +1,20 @@
+
+
+import unittest
+import sys
+from ppci.bitfun import rotate_left, rotate_right
+
+
+class BitRotationTestCase(unittest.TestCase):
+    def testRightRotation(self):
+        self.assertEqual(0xFF000000, rotate_right(0xFF, 8))
+        self.assertEqual(0x0FF00000, rotate_right(0xFF, 12))
+
+    def testLeftRotation(self):
+        self.assertEqual(0x0000FF00, rotate_left(0xFF, 8))
+        self.assertEqual(0x001FE000, rotate_left(0xFF, 13))
+
+
+if __name__ == '__main__':
+    unittest.main()
+    sys.exit()