Minor fixes to UnitTest, Defines header
This commit is contained in:
parent
32e2503bd0
commit
bfc704d429
5 changed files with 11 additions and 17 deletions
|
@ -4,7 +4,6 @@ project(UDPConnection)
|
||||||
set(UDPConnection_SOURCES
|
set(UDPConnection_SOURCES
|
||||||
src/UDPConnection.c
|
src/UDPConnection.c
|
||||||
src/UDPC_Deque.c
|
src/UDPC_Deque.c
|
||||||
src/UDPC_Defines.c
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "-Wall -Wno-missing-braces")
|
set(CMAKE_C_FLAGS "-Wall -Wno-missing-braces")
|
||||||
|
|
|
@ -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";
|
|
|
@ -24,11 +24,11 @@
|
||||||
#define UDPC_ERR_CVFAIL 5 // failed to create condition variable
|
#define UDPC_ERR_CVFAIL 5 // failed to create condition variable
|
||||||
#define UDPC_ERR_THREADFAIL 6 // failed to create thread
|
#define UDPC_ERR_THREADFAIL 6 // failed to create thread
|
||||||
|
|
||||||
static const char *UDPC_ERR_SOCKETFAIL_STR;
|
static const char *UDPC_ERR_SOCKETFAIL_STR = "Failed to create socket";
|
||||||
static const char *UDPC_ERR_SOCKETBINDF_STR;
|
static const char *UDPC_ERR_SOCKETBINDF_STR = "Failed to bind socket";
|
||||||
static const char *UDPC_ERR_SOCKETNONBF_STR;
|
static const char *UDPC_ERR_SOCKETNONBF_STR = "Failed to set non-blocking on socket";
|
||||||
static const char *UDPC_ERR_MTXFAIL_STR;
|
static const char *UDPC_ERR_MTXFAIL_STR = "Failed to create mutex";
|
||||||
static const char *UDPC_ERR_CVFAIL_STR;
|
static const char *UDPC_ERR_CVFAIL_STR = "Failed to create condition variable";
|
||||||
static const char *UDPC_ERR_THREADFAIL_STR;
|
static const char *UDPC_ERR_THREADFAIL_STR = "Failed to create thread";
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -172,6 +172,6 @@ int main()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
UDPC_Deque_destroy(deque);
|
UDPC_Deque_destroy(deque);
|
||||||
UNITTEST_REPORT()
|
UNITTEST_REPORT(DEQUE_TEST)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,10 @@
|
||||||
if(memcmp(x, y, size) == 0) { printf("%d: ASSERT_NEQ_MEM(%s, %s, %s) FAILED\n", \
|
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;
|
__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
|
typedef struct
|
||||||
|
|
Loading…
Reference in a new issue