summaryrefslogtreecommitdiffstats
path: root/04_exercise/slotmap/slomap_test.c
blob: 930bfa83153741690e37c63e61c366f6b54541b3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//
// Created by stefan on 18.06.20.
//
#include <assert.h>
#include <slotmap.h>
#include <stdbool.h>

bool find1(void const * ptr) {
    return * (int const *) ptr == 1;
}
int main() {
    smEntry slab [10];
    int data [6] = {0, 1, 2,3,4,5};
    smHeader header = smInit((smEntry *)&slab, 10);
    smInsert(&header, &data[1]);
    smEntry * entry = smFindEntry(&header, &find1);
    assert(*(int *)entry->value == 1);
    return 0;
}