diff options
Diffstat (limited to '04_exercise/slotmap/slomap_test.c')
-rw-r--r-- | 04_exercise/slotmap/slomap_test.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/04_exercise/slotmap/slomap_test.c b/04_exercise/slotmap/slomap_test.c new file mode 100644 index 0000000..930bfa8 --- /dev/null +++ b/04_exercise/slotmap/slomap_test.c @@ -0,0 +1,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; +} |