1
# Copyright (C) 2008 Canonical Limited.
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License version 2 as published
5
# by the Free Software Foundation.
7
# This program is distributed in the hope that it will be useful,
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
# GNU General Public License for more details.
12
# You should have received a copy of the GNU General Public License
13
# along with this program; if not, write to the Free Software
14
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
"""Tests for the pyrex extension of groupcompress"""
19
from bzrlib import tests
22
class _CompiledGroupCompress(tests.Feature):
26
import bzrlib.plugins.groupcompress._groupcompress_c
32
def feature_name(self):
33
return 'bzrlib.plugins.groupcompress._groupcompress_c'
35
CompiledGroupCompress = _CompiledGroupCompress()
38
class TestCompiledEquivalenceTable(tests.TestCase):
39
"""Direct tests for the compiled Equivalence Table."""
41
_tests_need_features = [CompiledGroupCompress]
44
super(TestCompiledEquivalenceTable, self).setUp()
45
from bzrlib.plugins.groupcompress import _groupcompress_c
46
self._gc_module = _groupcompress_c
48
def test_minimum_hash_size(self):
49
eq = self._gc_module.EquivalenceTable([])
50
self.assertEqual(1024, eq._py_compute_minimum_hash_size(1000))
51
self.assertEqual(1024, eq._py_compute_minimum_hash_size(1024))