diff --git a/Makefile b/Makefile index edca96b..30b6a31 100644 --- a/Makefile +++ b/Makefile @@ -56,11 +56,15 @@ build-test: $(BINS_TEST) $(BINS_TEST): %: %.c.o $(OBJS) $(CC) $^ -o $@ -# Each test includes the test directory, which contains the acutest header file +# Allow with the include directory, each test includes $(TEST_DIR) (which +# contains the acutest.h header file), and the src directory of the module it's +# testing. This allows tests to access internal methods, which aren't publicly +# exposed. $(BUILD_DIR)/$(TEST_DIR)/%.c.o: $(TEST_DIR)/%.c mkdir -p $(dir $@) - $(CC) $(CFLAGS) -I$(TEST_DIR) -c $< -o $@ - + $(CC) $(CFLAGS) -I$(TEST_DIR) \ + -I$(dir $(@:$(BUILD_DIR)/$(TEST_DIR)/%=$(SRC_DIR)/%)) \ + -c $< -o $@ # =====MAINTENANCE===== .PHONY: lint diff --git a/test/heap/test_heap.c b/test/heap/test_heap.c index 4079569..832404d 100644 --- a/test/heap/test_heap.c +++ b/test/heap/test_heap.c @@ -1,5 +1,6 @@ #include "acutest.h" #include "vieter_heap.h" +#include "vieter_heap_tree.h" #define TEST_SIZE(heap, size) \ TEST_CHECK(vieter_heap_size(heap) == size); \