set(UDPConnection_SOURCES
src/UDPConnection.c
src/UDPC_Deque.c
- src/UDPC_Defines.c
)
set(CMAKE_C_FLAGS "-Wall -Wno-missing-braces")
+++ /dev/null
-#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";
#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
*/
UDPC_Deque_destroy(deque);
- UNITTEST_REPORT()
+ UNITTEST_REPORT(DEQUE_TEST)
return 0;
}
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