30 lines
No EOL
905 B
C
30 lines
No EOL
905 B
C
#include <assert.h>
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <sys/stat.h>
|
|
|
|
#include "haggis.h"
|
|
|
|
int main() {
|
|
haggis_linkmap *map;
|
|
haggis_node *node;
|
|
char *path = "create_dev_node.c";
|
|
uint8_t sum[] = {132, 8, 63, 14, 202, 37, 242, 15, 181, 74, 172, 232,
|
|
238, 155, 32, 1, 106, 239, 160, 50, 210, 162, 221, 22,
|
|
43, 109, 53, 24, 219, 186, 124, 216};
|
|
int i;
|
|
|
|
map = haggis_linkmap_init();
|
|
assert(map != NULL);
|
|
node = haggis_create_node(path, sha256, map);
|
|
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 == 719);
|
|
assert(memcmp(path, node->name.name, 17) == 0);
|
|
haggis_node_deinit(node);
|
|
haggis_linkmap_deinit(map);
|
|
return 0;
|
|
} |