add common.h include to test.h - fixes #464 default tip

Thu, 31 Oct 2024 12:15:45 +0100

author
Mike Becker <universe@uap-core.de>
date
Thu, 31 Oct 2024 12:15:45 +0100
changeset 959
0e1bf3c199bf
parent 958
c9033d30a9f6

add common.h include to test.h - fixes #464

src/cx/common.h file | annotate | diff | comparison | revisions
src/cx/test.h file | annotate | diff | comparison | revisions
tests/Makefile file | annotate | diff | comparison | revisions
--- a/src/cx/common.h	Thu Oct 31 12:15:13 2024 +0100
+++ b/src/cx/common.h	Thu Oct 31 12:15:45 2024 +0100
@@ -95,7 +95,6 @@
 #include <stdbool.h>
 #include <stdint.h>
 
-#ifndef UCX_TEST_H
 /**
  * Function pointer compatible with fwrite-like functions.
  */
@@ -105,7 +104,6 @@
         size_t,
         void *
 );
-#endif // UCX_TEST_H
 
 /**
  * Function pointer compatible with fread-like functions.
--- a/src/cx/test.h	Thu Oct 31 12:15:13 2024 +0100
+++ b/src/cx/test.h	Thu Oct 31 12:15:45 2024 +0100
@@ -67,7 +67,8 @@
 #ifndef UCX_TEST_H
 #define	UCX_TEST_H
 
-#include <stdlib.h>
+#include "common.h"
+
 #include <stdio.h>
 #include <string.h>
 #include <setjmp.h>
@@ -91,18 +92,6 @@
 #pragma GCC diagnostic ignored "-Wclobbered"
 #endif
 
-#ifndef UCX_COMMON_H
-/**
- * Function pointer compatible with fwrite-like functions.
- */
-typedef size_t (*cx_write_func)(
-        const void *,
-        size_t,
-        size_t,
-        void *
-);
-#endif // UCX_COMMON_H
-
 /** Type for the CxTestSuite. */
 typedef struct CxTestSuite CxTestSuite;
 
--- a/tests/Makefile	Thu Oct 31 12:15:13 2024 +0100
+++ b/tests/Makefile	Thu Oct 31 12:15:45 2024 +0100
@@ -49,29 +49,29 @@
 FORCE:
 
 $(TEST_DIR)/test_allocator$(OBJ_EXT): test_allocator.c ../src/cx/test.h \
- ../src/cx/allocator.h ../src/cx/common.h
+ ../src/cx/common.h ../src/cx/allocator.h
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 
 $(TEST_DIR)/test_buffer$(OBJ_EXT): test_buffer.c ../src/cx/test.h \
- util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \
+ ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \
  ../src/cx/buffer.h ../src/cx/allocator.h
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 
 $(TEST_DIR)/test_compare$(OBJ_EXT): test_compare.c ../src/cx/test.h \
- ../src/cx/compare.h ../src/cx/common.h
+ ../src/cx/common.h ../src/cx/compare.h
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 
 $(TEST_DIR)/test_hash_key$(OBJ_EXT): test_hash_key.c ../src/cx/test.h \
- ../src/cx/hash_key.h ../src/cx/common.h ../src/cx/string.h \
+ ../src/cx/common.h ../src/cx/hash_key.h ../src/cx/string.h \
  ../src/cx/allocator.h
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 
 $(TEST_DIR)/test_hash_map$(OBJ_EXT): test_hash_map.c ../src/cx/test.h \
- util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \
+ ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \
  ../src/cx/hash_map.h ../src/cx/map.h ../src/cx/collection.h \
  ../src/cx/allocator.h ../src/cx/iterator.h ../src/cx/compare.h \
  ../src/cx/string.h ../src/cx/hash_key.h
@@ -79,18 +79,18 @@
 	$(CC) -o $@ $(CFLAGS) -c $<
 
 $(TEST_DIR)/test_iterator$(OBJ_EXT): test_iterator.c ../src/cx/test.h \
- ../src/cx/iterator.h ../src/cx/common.h
+ ../src/cx/common.h ../src/cx/iterator.h
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 
 $(TEST_DIR)/test_json$(OBJ_EXT): test_json.c ../src/cx/test.h \
- ../src/cx/json.h ../src/cx/common.h ../src/cx/string.h \
+ ../src/cx/common.h ../src/cx/json.h ../src/cx/string.h \
  ../src/cx/allocator.h
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 
 $(TEST_DIR)/test_list$(OBJ_EXT): test_list.c ../src/cx/test.h \
- util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \
+ ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \
  ../src/cx/compare.h ../src/cx/utils.h ../src/cx/array_list.h \
  ../src/cx/list.h ../src/cx/collection.h ../src/cx/allocator.h \
  ../src/cx/iterator.h ../src/cx/compare.h ../src/cx/linked_list.h
@@ -98,20 +98,20 @@
 	$(CC) -o $@ $(CFLAGS) -c $<
 
 $(TEST_DIR)/test_mempool$(OBJ_EXT): test_mempool.c ../src/cx/test.h \
- util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \
+ ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \
  ../src/cx/mempool.h ../src/cx/allocator.h
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 
 $(TEST_DIR)/test_printf$(OBJ_EXT): test_printf.c ../src/cx/test.h \
- util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \
+ ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \
  ../src/cx/printf.h ../src/cx/string.h ../src/cx/allocator.h \
  ../src/cx/buffer.h
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 
 $(TEST_DIR)/test_properties$(OBJ_EXT): test_properties.c ../src/cx/test.h \
- util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \
+ ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \
  ../src/cx/properties.h ../src/cx/string.h ../src/cx/allocator.h \
  ../src/cx/map.h ../src/cx/collection.h ../src/cx/iterator.h \
  ../src/cx/compare.h ../src/cx/hash_key.h ../src/cx/array_list.h \
@@ -120,7 +120,7 @@
 	$(CC) -o $@ $(CFLAGS) -c $<
 
 $(TEST_DIR)/test_string$(OBJ_EXT): test_string.c ../src/cx/test.h \
- util_allocator.h ../src/cx/allocator.h ../src/cx/common.h \
+ ../src/cx/common.h util_allocator.h ../src/cx/allocator.h \
  ../src/cx/string.h ../src/cx/allocator.h
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
@@ -133,12 +133,13 @@
 	$(CC) -o $@ $(CFLAGS) -c $<
 
 $(TEST_DIR)/test_utils$(OBJ_EXT): test_utils.c ../src/cx/test.h \
- ../src/cx/utils.h ../src/cx/common.h ../src/cx/buffer.h \
+ ../src/cx/common.h ../src/cx/utils.h ../src/cx/buffer.h \
  ../src/cx/allocator.h ../src/szmul.c
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 
-$(TEST_DIR)/ucxtest$(OBJ_EXT): ucxtest.c ../src/cx/test.h
+$(TEST_DIR)/ucxtest$(OBJ_EXT): ucxtest.c ../src/cx/common.h \
+ ../src/cx/test.h ../src/cx/common.h
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 

mercurial