OILS / demo / old / ovm2 / oheap2_test.py View on Github | oilshell.org

30 lines, 18 significant
1#!/usr/bin/env python2
2"""
3oheap2_test.py: Tests for oheap2.py
4"""
5from __future__ import print_function
6
7import unittest
8
9from ovm2 import oheap2 # module under test
10
11
12class Oheap2Test(unittest.TestCase):
13
14 def testAlign4(self):
15 self.assertEqual(0, oheap2.Align4(0))
16 self.assertEqual(4, oheap2.Align4(1))
17 self.assertEqual(4, oheap2.Align4(3))
18 self.assertEqual(4, oheap2.Align4(4))
19 self.assertEqual(8, oheap2.Align4(5))
20
21 def testAlign16(self):
22 self.assertEqual(0, oheap2.Align16(0))
23 self.assertEqual(16, oheap2.Align16(1))
24 self.assertEqual(16, oheap2.Align16(15))
25 self.assertEqual(16, oheap2.Align16(16))
26 self.assertEqual(32, oheap2.Align16(17))
27
28
29if __name__ == '__main__':
30 unittest.main()