diff options
author | Stefan Zabka <zabkaste@hu-berlin.de> | 2020-06-18 15:04:54 +0200 |
---|---|---|
committer | Stefan Zabka <zabkaste@hu-berlin.de> | 2020-06-18 15:05:14 +0200 |
commit | 021afcb8e4aa4fbc7905f527089c415108c86c75 (patch) | |
tree | 3fd53ab9a1ccdb8b807bb973a4e19da077b871ea /04_exercise/slotmap/slomap_test.c | |
parent | 190c347866ebd0c703407285646c6ce3e94f19a4 (diff) | |
download | betriebssysteme-021afcb8e4aa4fbc7905f527089c415108c86c75.tar.gz betriebssysteme-021afcb8e4aa4fbc7905f527089c415108c86c75.zip |
Switched to slotmap
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; +} |