diff options
Diffstat (limited to 'Source/charon/tests/socket_test.c')
-rw-r--r-- | Source/charon/tests/socket_test.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Source/charon/tests/socket_test.c b/Source/charon/tests/socket_test.c index a8ced751d..ea61e5f3c 100644 --- a/Source/charon/tests/socket_test.c +++ b/Source/charon/tests/socket_test.c @@ -1,8 +1,8 @@ /** * @file thread_pool_test.c - * + * * @brief Tests to test the Socket (type socket_t) - * + * */ /* @@ -31,31 +31,31 @@ * Description in header file */ void test_socket(tester_t *tester) -{ +{ int packet_count = 5; int current; socket_t *skt = socket_create(4500); packet_t *pkt = packet_create(AF_INET); char *test_string = "Testing functionality of socket_t"; - - - pkt->data.ptr = alloc_bytes(strlen(test_string) + 1,"test_string"); + + + pkt->data.ptr = allocator_alloc(strlen(test_string) + 1,"test_string"); memcpy(pkt->data.ptr,test_string,strlen(test_string) + 1); pkt->data.len = strlen(test_string) + 1; - + /* send to previously bound socket */ pkt->set_destination(pkt, "127.0.0.1", 4500); /* send packet_count packets */ for (current = 0; current < packet_count; current++) { - if (skt->send(skt, pkt) == FAILED) + if (skt->send(skt, pkt) == FAILED) { tester->assert_true(tester, 0, "packet send"); } } pkt->destroy(pkt); - + /* receive packet_count packets */ for (current = 0; current < packet_count; current++) { @@ -63,7 +63,7 @@ void test_socket(tester_t *tester) tester->assert_false(tester, strcmp(test_string, pkt->data.ptr), "packet exchange"); pkt->destroy(pkt); } - + tester->assert_true(tester, (skt->destroy(skt) == SUCCESS), "socket destroy call check"); } |