- changed memory allocator functions to own allocator calls
This commit is contained in:
@@ -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");
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user