Files
zttf/tests/utils_test.py
david reid 1388af6b76 After reviewing the binary search parameters again, change things round
a little to make it more useful and more consistent.
Add an additional test case.
2015-03-21 23:20:03 +00:00

25 lines
639 B
Python

import unittest
from zttf.utils import fixed_version, binary_search_parameters
class TestUtils(unittest.TestCase):
def test_fixed_version(self):
cases = [
(0x00005000, 0.5),
(0x00010000, 1.0),
(0x00035000, 3.5),
(0x00105000, 10.5)
]
for case in cases:
self.assertEqual(fixed_version(case[0]), case[1])
def test_binary_parameters(self):
cases = {
39: (32, 5),
10: (8, 3),
19: (16, 4)
}
for n, result in cases.items():
self.assertEqual(binary_search_parameters(n), result)