Esempio n. 1
0
def test_hash_table_uses_horner_hash_function():
    """Test that hash table hashes keys with function provided."""
    from hash import horner_hash, HashTable
    t = HashTable(10, horner_hash)
    assert t._hash('two') == horner_hash('two')
Esempio n. 2
0
def test_hash_table_uses_additive_hash_function():
    """Test that hash table hashes keys with function provided."""
    from hash import additive_hash, HashTable
    t = HashTable(10, additive_hash)
    assert t._hash('one') == additive_hash('one')