seahag/test/hmap_insert.c

27 lines
511 B
C
Raw Normal View History

2023-08-14 19:09:18 -04:00
#include "haggis.h"
#include "haggis_private.h"
#include <assert.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
int main() {
hmap *map;
struct stat st;
char *data;
union {
ino_t val;
u8 bytes[sizeof(ino_t)];
} nod;
map = hmap_init(sizeof(ino_t));
assert(map != NULL);
data = "Makefile";
stat(data, &st);
nod.val = st.st_ino;
hmap_insert(map, &nod.bytes[0], data);
assert(map->len == 1);
hmap_deinit(map);
return 0;
}