2 This file is part of GNUnet.
3 Copyright (C) 2010-2015 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
21 * @file ats/test_ats_api.c
23 * @author Christian Grothoff
26 #include "test_ats_lib.h"
29 * Global timeout for the testcase.
31 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3)
34 * Definition of the test as a sequence of commands.
36 static struct Command test_commands[] = {
38 .code = CMD_ADD_ADDRESS,
39 .label = "add-address-0-0",
40 .details.add_address = {
45 .scope = GNUNET_ATS_NET_LAN
49 /* adding same address again should fail */
51 .code = CMD_ADD_ADDRESS,
52 .label = "add-address-0-0:FAIL",
53 .details.add_address = {
58 .scope = GNUNET_ATS_NET_LAN
63 /* some solver still require explicit start */
65 .code = CMD_REQUEST_CONNECTION_START,
67 .details.request_connection_start = {
71 /* check we got an address */
73 .code = CMD_AWAIT_ADDRESS_SUGGESTION,
74 .details.await_address_suggestion = {
75 .add_label = "add-address-0-0"
78 /* check monitor also got the address */
80 .code = CMD_AWAIT_ADDRESS_INFORMATION,
81 .details.await_address_information = {
82 .add_label = "add-address-0-0"
85 /* test session API */
87 .code = CMD_ADD_SESSION,
88 .label = "add-session-0-0-1",
89 .details.add_session = {
90 .add_label ="add-address-0-0",
95 .code = CMD_DEL_SESSION,
96 .details.del_session = {
97 .add_session_label = "add-session-0-0-1",
100 /* test preference API */
102 .code = CMD_CHANGE_PREFERENCE,
103 .details.change_preference = {
105 /* FIXME: preference details */
109 .code = CMD_PROVIDE_FEEDBACK,
110 .details.provide_feedback = {
113 /* FIXME: preference details */
116 /* test sanity check address listing */
118 .code = CMD_LIST_ADDRESSES,
119 .details.list_addresses = {
124 .min_active_calls = 1,
125 .max_active_calls = 1
128 /* remove address testing */
130 .code = CMD_DEL_ADDRESS,
131 .details.del_address = {
132 .add_label = "add-address-0-0"
135 /* check we got disconnected */
137 .code = CMD_AWAIT_DISCONNECT_SUGGESTION,
138 .details.await_disconnect_suggestion = {
142 /* just for symmetry, also stop asking for the connection */
144 .code = CMD_REQUEST_CONNECTION_STOP,
145 .details.request_connection_stop = {
146 .connect_label = "request-0",
149 /* add address again */
151 .code = CMD_ADD_ADDRESS,
152 .label = "add-address-0-0:1",
153 .details.add_address = {
158 .scope = GNUNET_ATS_NET_LAN
162 /* some solver still require explicit start */
164 .code = CMD_REQUEST_CONNECTION_START,
165 .label = "request-0",
166 .details.request_connection_start = {
170 /* check we got an address */
172 .code = CMD_AWAIT_ADDRESS_SUGGESTION,
173 .details.await_address_suggestion = {
174 .add_label = "add-address-0-0:1"
177 /* add alternative address */
179 .code = CMD_ADD_ADDRESS,
180 .label = "add-address-0-1",
181 .details.add_address = {
186 .scope = GNUNET_ATS_NET_LAN
190 /* remove original address */
192 .code = CMD_DEL_ADDRESS,
193 .details.del_address = {
194 .add_label = "add-address-0-0:1"
197 /* check we switched to alternative address */
199 .code = CMD_AWAIT_ADDRESS_SUGGESTION,
200 .details.await_address_suggestion = {
201 .add_label = "add-address-0-1"
204 /* remove alternative address */
206 .code = CMD_DEL_ADDRESS,
207 .details.del_address = {
208 .add_label = "add-address-0-1"
211 /* check we got disconnected */
213 .code = CMD_AWAIT_DISCONNECT_SUGGESTION,
214 .details.await_disconnect_suggestion = {
218 /* just for symmetry, also stop asking for the connection */
220 .code = CMD_REQUEST_CONNECTION_STOP,
221 .details.request_connection_stop = {
222 .connect_label = "request-0",
225 /* Test ends successfully */
236 return TEST_ATS_run (argc,
243 /* end of file test_ats_api.c */