Lolly 1.4.28
Loading...
Searching...
No Matches
hashfunc_test.cpp
Go to the documentation of this file.
1#include "a_lolly_test.hpp"
2#include "hashfunc.hpp"
3
4TEST_CASE ("hashfunc") {
5 // Define the hash function for integers, where hash(x) = x % 7
6 int init= 0;
7 hashfunc<int, int> hashf ([] (int x) { return x % 7; }, init);
8
9 // Test the hash function for several input values
10 CHECK (hashf[0] == 0);
11 CHECK (hashf[1] == 1);
12 CHECK (hashf[2] == 2);
13 CHECK (hashf[3] == 3);
14 CHECK (hashf[4] == 4);
15 CHECK (hashf[5] == 5);
16 CHECK (hashf[6] == 6);
17 CHECK (hashf[7] == 0);
18 CHECK (hashf[8] == 1);
19 CHECK (hashf[9] == 2);
20}
The list class represents a linked list.
Definition list.hpp:48
TEST_CASE("test for operator+= and advance()")