- fix test
[oweals/gnunet.git] / src / ats / test_ats_mlp.c
1 /*
2      This file is part of GNUnet.
3      (C) 2010,2011 Christian Grothoff (and other contributing authors)
4
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.
9
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.
14
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.
19 */
20 /**
21  * @file ats/test_ats_mlp.c
22  * @brief test for the MLP solver
23  * @author Christian Grothoff
24  * @author Matthias Wachs
25
26  */
27 #include "platform.h"
28 #include "gnunet_util_lib.h"
29 #include "gnunet_statistics_service.h"
30 #include "gnunet-service-ats_addresses_mlp.h"
31
32 #define VERBOSE GNUNET_EXTRA_LOGGING
33 #define VERBOSE_ARM GNUNET_EXTRA_LOGGING
34
35 #define MLP_MAX_EXEC_DURATION   GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 3)
36 #define MLP_MAX_ITERATIONS      INT_MAX
37
38
39 static int ret;
40
41 struct GNUNET_STATISTICS_Handle * stats;
42
43 struct GAS_MLP_Handle *mlp;
44
45 static void
46 check (void *cls, char *const *args, const char *cfgfile,
47        const struct GNUNET_CONFIGURATION_Handle *cfg)
48 {
49 #if !HAVE_LIBGLPK
50   GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "GLPK not installed!");
51   ret = 1;
52   return;
53 #endif
54   stats = GNUNET_STATISTICS_create("ats", cfg);
55
56   mlp = GAS_mlp_init(NULL, MLP_MAX_EXEC_DURATION, MLP_MAX_ITERATIONS);
57   GNUNET_assert (mlp != NULL);
58
59   GAS_mlp_done (mlp);
60
61   GNUNET_STATISTICS_destroy(stats, GNUNET_NO);
62
63   ret = 0;
64   return;
65 }
66
67
68 int
69 main (int argc, char *argv[])
70 {
71
72   static char *const argv2[] = { "test_ats_mlp",
73     "-c",
74     "test_ats_api.conf",
75 #if VERBOSE
76     "-L", "DEBUG",
77 #else
78     "-L", "WARNING",
79 #endif
80     NULL
81   };
82
83   static struct GNUNET_GETOPT_CommandLineOption options[] = {
84     GNUNET_GETOPT_OPTION_END
85   };
86
87   GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
88                       "test_ats_mlp", "nohelp", options,
89                       &check, NULL);
90
91
92   return ret;
93 }
94
95 /* end of file test_ats_api_bandwidth_consumption.c */