Skip to content

Commit 2980cdf

Browse files
committed
Added test for class HashTable
1 parent bad31e1 commit 2980cdf

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/test_hash_table.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import pytest
2+
3+
from reTest.hash_table import HashTable
4+
5+
def test_hash_table_functions():
6+
hash_table = HashTable()
7+
8+
hash_table.put('fiona', 4)
9+
hash_table.put('belle', 2)
10+
hash_table.put('aurora', 4)
11+
hash_table.put('ariel', 1)
12+
hash_table.put('cinderella', 3)
13+
14+
hash_table.remove('fiona')
15+
16+
assert hash_table.get('fiona') is None
17+
18+
assert hash_table.get('aurora') == 4
19+
20+
assert hash_table._hash('ariel') == 525 % 128
21+
22+
def test_empty():
23+
hash_table = HashTable()
24+
25+
assert hash_table.get('aurora') is None

0 commit comments

Comments
 (0)