30 lines
No EOL
907 B
C
30 lines
No EOL
907 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[] = {244, 223, 223, 246, 142, 83, 37, 211, 255, 37, 242,
|
|
205, 42, 85, 31, 70, 231, 76, 202, 195, 160, 254, 206,
|
|
31, 9, 11, 16, 182, 166, 176, 237, 131};
|
|
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 == 526);
|
|
assert(memcmp(path, node->name.name, 17) == 0);
|
|
haggis_node_deinit(node);
|
|
haggis_linkmap_deinit(map);
|
|
return 0;
|
|
} |