From e168ee1785eff740af1e5b6db635bdc7bda010fa Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Thu, 27 Apr 2006 07:24:04 +0000 Subject: - add connection names to connections - stroke status / ipsec status shows them - added statusall for stroke - added status by connection name - some tests repaired, more to come --- Source/testing/receiver_test.c | 89 ------------------------------------------ 1 file changed, 89 deletions(-) delete mode 100644 Source/testing/receiver_test.c (limited to 'Source/testing/receiver_test.c') diff --git a/Source/testing/receiver_test.c b/Source/testing/receiver_test.c deleted file mode 100644 index 763e52517..000000000 --- a/Source/testing/receiver_test.c +++ /dev/null @@ -1,89 +0,0 @@ -/** - * @file receiver_test.c - * - * @brief Tests for the receiver_t class. - * - */ - -/* - * Copyright (C) 2005 Jan Hutter, Martin Willi - * Hochschule fuer Technik Rapperswil - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. See . - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - */ - -#include -#include - -#include "receiver_test.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -/** - * Number of packets to send by sender-thread - */ -#define NUMBER_OF_PACKETS_TO_SEND 100 - -/** - * Port to send the packets to - */ -#define PORT_TO_SEND 4600 - -/** - * Destination IP Address - */ -#define DESTINATION_IP "127.0.0.1" - -void test_receiver(protected_tester_t *tester) -{ - int i; - receiver_t *receiver; - packet_t *packet; - job_t *job; - packet_t *received_packet; - receiver = receiver_create(); - chunk_t test_data; - - for (i = 0; i < NUMBER_OF_PACKETS_TO_SEND; i++) - { - packet = packet_create(); - packet->set_destination(packet, host_create(AF_INET,DESTINATION_IP,PORT_TO_SEND)); - test_data.len = (sizeof(int)); - test_data.ptr = malloc(test_data.len); - *((int *) (test_data.ptr)) = i; - packet->set_data(packet, test_data); - charon->socket->send(charon->socket, packet); - packet->destroy(packet); - } - - for (i = 0; i < NUMBER_OF_PACKETS_TO_SEND; i++) - { - job = charon->job_queue->get(charon->job_queue); - tester->assert_true(tester, (job->get_type(job) == INCOMING_PACKET), "job type check"); - - received_packet = ((incoming_packet_job_t *)(job))->get_packet((incoming_packet_job_t *)(job)); - test_data = received_packet->get_data(received_packet); - tester->assert_true(tester, (test_data.len == (sizeof(int))), "received data length check"); - tester->assert_true(tester, (i == *((int *)(test_data.ptr))), "received data value check"); - received_packet->destroy(received_packet); - - job->destroy(job); - } - - receiver->destroy(receiver); -} -- cgit v1.2.3