]> git.seodisparate.com - UDPConnection/commitdiff
Minor fixes to UnitTest, Defines header
authorStephen Seo <seo.disparate@gmail.com>
Tue, 29 Jan 2019 05:50:12 +0000 (14:50 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Tue, 29 Jan 2019 05:50:12 +0000 (14:50 +0900)
CMakeLists.txt
src/UDPC_Defines.c [deleted file]
src/UDPC_Defines.h
src/test/UDPC_UnitTest.c
src/test/UDPC_UnitTest.h

index 9b9a66b002ece44b63db8fc7e4afbc0b241da0bd..e15e0b988806f8f2060e071b28c999e9b201b5ad 100644 (file)
@@ -4,7 +4,6 @@ project(UDPConnection)
 set(UDPConnection_SOURCES
     src/UDPConnection.c
     src/UDPC_Deque.c
-    src/UDPC_Defines.c
 )
 
 set(CMAKE_C_FLAGS "-Wall -Wno-missing-braces")
diff --git a/src/UDPC_Defines.c b/src/UDPC_Defines.c
deleted file mode 100644 (file)
index e6c82cb..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "UDPC_Defines.h"
-
-static const char *UDPC_ERR_SOCKETFAIL_STR = "Failed to create socket";
-static const char *UDPC_ERR_SOCKETBINDF_STR = "Failed to bind socket";
-static const char *UDPC_ERR_SOCKETNONBF_STR = "Failed to set non-blocking on socket";
-static const char *UDPC_ERR_MTXFAIL_STR = "Failed to create mutex";
-static const char *UDPC_ERR_CVFAIL_STR = "Failed to create condition variable";
-static const char *UDPC_ERR_THREADFAIL_STR = "Failed to create thread";
index d2cfa7dc92ff387da664f597cd8fc19b53ea38ca..83c1b30f24498675941fe270271cfb669b9f4433 100644 (file)
 #define UDPC_ERR_CVFAIL 5 // failed to create condition variable
 #define UDPC_ERR_THREADFAIL 6 // failed to create thread
 
-static const char *UDPC_ERR_SOCKETFAIL_STR;
-static const char *UDPC_ERR_SOCKETBINDF_STR;
-static const char *UDPC_ERR_SOCKETNONBF_STR;
-static const char *UDPC_ERR_MTXFAIL_STR;
-static const char *UDPC_ERR_CVFAIL_STR;
-static const char *UDPC_ERR_THREADFAIL_STR;
+static const char *UDPC_ERR_SOCKETFAIL_STR = "Failed to create socket";
+static const char *UDPC_ERR_SOCKETBINDF_STR = "Failed to bind socket";
+static const char *UDPC_ERR_SOCKETNONBF_STR = "Failed to set non-blocking on socket";
+static const char *UDPC_ERR_MTXFAIL_STR = "Failed to create mutex";
+static const char *UDPC_ERR_CVFAIL_STR = "Failed to create condition variable";
+static const char *UDPC_ERR_THREADFAIL_STR = "Failed to create thread";
 
 #endif
index 2090dc63bdad312f6dad2aff218b65ea2c44619d..1e0d173313fafab2c279d5f0c278bda5ddac83e8 100644 (file)
@@ -172,6 +172,6 @@ int main()
     */
 
     UDPC_Deque_destroy(deque);
-    UNITTEST_REPORT()
+    UNITTEST_REPORT(DEQUE_TEST)
     return 0;
 }
index 83e40324fa2f330e9733e5974485107adbf63092..b98950c1df0c780342e23341a8817c5002c0174c 100644 (file)
     if(memcmp(x, y, size) == 0) { printf("%d: ASSERT_NEQ_MEM(%s, %s, %s) FAILED\n", \
             __LINE__, #x, #y, #size); ++UDPC_uts.failed; } ++UDPC_uts.total;
 
-#define UNITTEST_REPORT() printf("%d/%d tests failed\n", UDPC_uts.failed, UDPC_uts.total);
+#define UNITTEST_REPORT(x) { \
+    printf("%s: %d/%d tests failed\n", #x, UDPC_uts.failed, UDPC_uts.total); \
+    UDPC_uts.failed = 0; \
+    UDPC_uts.total = 0; }
 
 
 typedef struct