Lolly 1.4.27
Loading...
Searching...
No Matches
Functions
hashfunc_test.cpp File Reference
#include "a_lolly_test.hpp"
#include "hashfunc.hpp"
Include dependency graph for hashfunc_test.cpp:

Go to the source code of this file.

Functions

 TEST_CASE ("hashfunc")
 

Function Documentation

◆ TEST_CASE()

TEST_CASE ( "hashfunc" )

Definition at line 4 of file hashfunc_test.cpp.

4 {
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