33 lines
No EOL
990 B
C
33 lines
No EOL
990 B
C
#include <assert.h>
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <sys/stat.h>
|
|
|
|
#include "haggis.h"
|
|
#include "mq.h"
|
|
|
|
int main() {
|
|
haggis_linkmap *map;
|
|
haggis_node *node;
|
|
haggis_mq mq;
|
|
char *path = "create_dev_node.c";
|
|
uint8_t sum[] = {68, 185, 245, 201, 121, 238, 78, 31, 195, 186, 250,
|
|
107, 142, 200, 227, 7, 39, 206, 11, 209, 184, 117,
|
|
249, 66, 109, 238, 49, 224, 89, 73, 162, 186};
|
|
int i;
|
|
|
|
map = haggis_linkmap_init();
|
|
assert(map != NULL);
|
|
assert(haggis_mq_init(&mq) == 0);
|
|
node = haggis_create_node(path, sha256, map, &mq);
|
|
assert(node->filetype.tag == normal);
|
|
for (i = 0; i < 32; i++) {
|
|
assert(sum[i] == node->filetype.f_type.file.cksum.sum.sha256[i]);
|
|
}
|
|
assert(node->filetype.f_type.file.len.val == 800);
|
|
assert(memcmp(path, node->name.name, 17) == 0);
|
|
haggis_node_deinit(node);
|
|
haggis_linkmap_deinit(map);
|
|
return 0;
|
|
} |