Add test for linkmap init/deinit; Fix bug in linkmap deinit;
This commit is contained in:
parent
da412f754c
commit
29cc81ccae
4 changed files with 19 additions and 2 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,7 +1,9 @@
|
|||
haggis
|
||||
config.mk
|
||||
test/output/
|
||||
test/
|
||||
test/*
|
||||
!test/*.c
|
||||
!test/Makefile
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "haggis_private.h"
|
||||
|
||||
#include <limits.h> // PATH_MAX
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> // calloc, free
|
||||
#include <string.h> // strndup
|
||||
|
||||
|
@ -113,7 +114,7 @@ void haggis_linkmap_deinit(haggis_linkmap *map) {
|
|||
int i;
|
||||
|
||||
for (i = 0; i < map->capacity; i++) {
|
||||
if (map->buckets[i].next == NULL) {
|
||||
if (map->buckets[i].next != NULL) {
|
||||
haggis_bucket_deinit(map->buckets[i].next);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ tests += store_file_sha256
|
|||
tests += load_file_sha256
|
||||
tests += fnv1a_hash_inode
|
||||
tests += fnv1a_hash_str
|
||||
tests += linkmap_init
|
||||
|
||||
total != echo $(tests) | wc -w | awk '{ print $$1 }'
|
||||
|
||||
|
|
13
test/linkmap_init.c
Normal file
13
test/linkmap_init.c
Normal file
|
@ -0,0 +1,13 @@
|
|||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "haggis.h"
|
||||
#include "haggis_private.h"
|
||||
|
||||
int main() {
|
||||
haggis_linkmap *map;
|
||||
|
||||
map = haggis_linkmap_init();
|
||||
assert(map != NULL);
|
||||
haggis_linkmap_deinit(map);
|
||||
}
|
Loading…
Add table
Reference in a new issue