Пример #1
0
    def test_behavior(self):
        """Test basic behavior."""
        h = Hash(1423, 197)
        h.insert(55, 'fifty five')
        self.assertEqual((55, 'fifty five'), h.search('fifty five'))
        self.assertEqual((55, 'fifty five'), h.table[808])
        self.assertEqual('A', h.state[808])

        h.insert(1234, 'one two three four')
        self.assertEqual((1234, 'one two three four'),
                         h.search('one two three four'))
Пример #2
0
from Hash import Hash

s = Hash(10)
print(s.list)

print(s.hashFunct('pork'))
s.insert('Steve', 24601)
print(s.list)