From 021afcb8e4aa4fbc7905f527089c415108c86c75 Mon Sep 17 00:00:00 2001 From: Stefan Zabka Date: Thu, 18 Jun 2020 15:04:54 +0200 Subject: Switched to slotmap --- 04_exercise/slotmap/slomap_test.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 04_exercise/slotmap/slomap_test.c (limited to '04_exercise/slotmap/slomap_test.c') 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 +#include +#include + +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; +} -- cgit v1.2.3-54-g00ecf