make vec test split into .h and .c files

This commit is contained in:
r4 2022-05-29 21:53:25 +02:00
parent 368dde5c89
commit 0d999f5b39
4 changed files with 16 additions and 6 deletions

View File

@ -50,8 +50,10 @@ else \
fi
endef
TEST_HDR := generic/vec.h
TESTS := generic/map generic/smap generic/vec error fmt
_TEST_HDR := $(addprefix tests/,$(TEST_HDR))
_TESTS := $(addsuffix $(EXE_EXT),$(addprefix tests/,$(TESTS)))
.PHONY: test test_outputs test_leaks test_full test_debug
@ -77,7 +79,7 @@ else
@echo "Options are: $(TESTS)"
endif
tests/%: tests/%.c ds.a $(_HDR)
tests/%: tests/%.c ds.a $(_HDR) $(_TEST_HDR)
$(CC) -o $@ $< ds.a -I./include $(CFLAGS) $(LDFLAGS)
################################

View File

@ -54,6 +54,8 @@ FUNCDECL(bool, _del)(NAME m, KTYPE key);
FUNCDECL(Error, _rehash)(NAME *m, size_t new_minimum_cap);
FUNCDECL(bool, _it_next)(NAME m, ITEM_TYPE **restrict it);
VARDEF(const char *, test_string_lol) = NULL;
#ifdef GENERIC_IMPL
VARDEF(const char *, __val_fmt) = NULL;
VARDEF(const char *, __key_fmt) = NULL;

View File

@ -1,12 +1,9 @@
// Copyright 2022 Darwin Schuppan <darwin@nobrain.org>
// SPDX license identifier: MIT
#define GENERIC_IMPL_STATIC
#define GENERIC_IMPL
#define GENERIC_TYPE int
#define GENERIC_NAME IntVec
#define GENERIC_PREFIX int_vec
#include <ds/generic/vec.h>
#include "vec.h"
#include <assert.h>
#include <string.h>

9
tests/generic/vec.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef __TESTS_VEC_H__
#define __TESTS_VEC_H__
#define GENERIC_TYPE int
#define GENERIC_NAME IntVec
#define GENERIC_PREFIX int_vec
#include <ds/generic/vec.h>
#endif