2 This file is part of GNUnet.
3 Copyright (C) 2010-2015 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your 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 Affero General Public License for more details.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * @file ats/test_ats_api.c
21 * @author Christian Grothoff
24 #include "test_ats_lib.h"
27 * Global timeout for the testcase.
29 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3)
32 * Definition of the test as a sequence of commands.
34 static struct Command test_commands[] = {
36 .code = CMD_ADD_ADDRESS,
37 .label = "add-address-0-0",
38 .details.add_address = {
41 .addr_flags = GNUNET_HELLO_ADDRESS_INFO_NONE,
44 .scope = GNUNET_NT_LAN
48 /* 1: adding same address again should fail */
50 .code = CMD_ADD_ADDRESS,
51 .label = "add-address-0-0:FAIL",
52 .details.add_address = {
55 .addr_flags = GNUNET_HELLO_ADDRESS_INFO_NONE,
58 .scope = GNUNET_NT_LAN
63 /* 2: some solver still require explicit start */
65 .code = CMD_REQUEST_CONNECTION_START,
67 .details.request_connection_start = {
71 /* 3: check we got an address */
73 .code = CMD_AWAIT_ADDRESS_SUGGESTION,
74 .details.await_address_suggestion = {
75 .add_label = "add-address-0-0"
78 /* 4: 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 /* 5: 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 /* 7: 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 /* 9: 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 /* 10: remove address testing */
130 .code = CMD_DEL_ADDRESS,
131 .details.del_address = {
132 .add_label = "add-address-0-0"
135 /* 11: check we got disconnected */
137 .code = CMD_AWAIT_DISCONNECT_SUGGESTION,
138 .details.await_disconnect_suggestion = {
142 /* 12: 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 /* 13: add address again */
151 .code = CMD_ADD_ADDRESS,
152 .label = "add-address-0-0:1",
153 .details.add_address = {
158 .scope = GNUNET_NT_LAN
162 /* 14: some solver still require explicit start */
164 .code = CMD_REQUEST_CONNECTION_START,
165 .label = "request-0",
166 .details.request_connection_start = {
170 /* 15: 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 /* 16: add alternative address */
179 .code = CMD_ADD_ADDRESS,
180 .label = "add-address-0-1",
181 .details.add_address = {
184 .addr_flags = GNUNET_HELLO_ADDRESS_INFO_NONE,
187 .scope = GNUNET_NT_LAN
191 /* 17: remove original address */
193 .code = CMD_DEL_ADDRESS,
194 .details.del_address = {
195 .add_label = "add-address-0-0:1"
198 /* 18: check we switched to alternative address */
200 .code = CMD_AWAIT_ADDRESS_SUGGESTION,
201 .details.await_address_suggestion = {
202 .add_label = "add-address-0-1"
205 /* 19: remove alternative address */
207 .code = CMD_DEL_ADDRESS,
208 .details.del_address = {
209 .add_label = "add-address-0-1"
212 /* 20: check we got disconnected */
214 .code = CMD_AWAIT_DISCONNECT_SUGGESTION,
215 .details.await_disconnect_suggestion = {
219 /* 21: just for symmetry, also stop asking for the connection */
221 .code = CMD_REQUEST_CONNECTION_STOP,
222 .details.request_connection_stop = {
223 .connect_label = "request-0",
226 /* Test ends successfully */
237 return TEST_ATS_run (argc,
244 /* end of file test_ats_api.c */