forked from vieter-v/libvieter
				
			chore: allow tests to access internal methods
							parent
							
								
									6823050c2f
								
							
						
					
					
						commit
						ef625ed14e
					
				
							
								
								
									
										10
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										10
									
								
								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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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); \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue