Add test example
parent
6066e95f01
commit
d592dbb4f7
|
@ -180,3 +180,12 @@ endif()
|
|||
if (TN_WITH_SHARED)
|
||||
set(THROUGHNET_LIBRARIES_SHARED throughnet_shared CACHE STRING "ThroughNet shared library")
|
||||
endif()
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Test example
|
||||
# ============================================================================
|
||||
|
||||
add_executable(example src/test/example.cc)
|
||||
target_link_libraries(example throughnet)
|
||||
add_test(example example)
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define CHECK_ERR(err, msg) { \
|
||||
if (err != 0) { \
|
||||
fprintf(stderr, "%s error: %d\n", msg, err); \
|
||||
exit(1); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Test connect_peer1() with valid condition
|
||||
*/
|
||||
void connect_peer1()
|
||||
{
|
||||
int err = 0;
|
||||
CHECK_ERR(err, "nothing");
|
||||
}
|
||||
|
||||
|
||||
/* ===========================================================================
|
||||
* Usage: example
|
||||
*/
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
printf("===== Test started. =====\n");
|
||||
|
||||
connect_peer1();
|
||||
|
||||
printf("===== Test completed. =====\n");
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue