summaryrefslogtreecommitdiff
path: root/src/test/HashChainsTest.java
blob: 57255fc46d9b754217108c3a1202694b5b80389e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

class HashChainsTest {
    @Test
    void test(){
        HashChains hc = new HashChains();
        hc.bucketCount = 5;
        assertEquals(4, hc.hashFunc("world"));
        assertEquals(4, hc.hashFunc("HellO"));
        assertEquals(2, hc.hashFunc("GooD"));
        assertEquals(2, hc.hashFunc("luck"));

        hc.bucketCount = 3;
        assertEquals(1, hc.hashFunc("add"));
        assertEquals(1, hc.hashFunc("help"));
        assertEquals(2, hc.hashFunc("del"));
    }
}