aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/test_plugin.c')
-rw-r--r--src/util/test_plugin.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/util/test_plugin.c b/src/util/test_plugin.c
new file mode 100644
index 000000000..22bf78b92
--- /dev/null
+++ b/src/util/test_plugin.c
@@ -0,0 +1,64 @@
1/*
2 This file is part of GNUnet.
3 (C) 2009 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 2, 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 util/test_plugin.c
22 * @brief testcase for plugin.c
23 */
24#include "platform.h"
25#include "gnunet_plugin_lib.h"
26
27#define VERBOSE GNUNET_NO
28
29static int
30check ()
31{
32 void *ret;
33
34 GNUNET_log_skip (1);
35 ret = GNUNET_PLUGIN_load ("libgnunet_plugin_missing", NULL);
36 GNUNET_log_skip (0);
37 if (ret != NULL)
38 return 1;
39 ret = GNUNET_PLUGIN_load ("libgnunet_plugin_test", "in");
40 if (ret == NULL)
41 return 1;
42 if (0 != strcmp (ret, "Hello"))
43 return 2;
44 ret = GNUNET_PLUGIN_unload ("libgnunet_plugin_test", "out");
45 if (ret == NULL)
46 return 3;
47 if (0 != strcmp (ret, "World"))
48 return 4;
49 free (ret);
50 return 0;
51}
52
53int
54main (int argc, char *argv[])
55{
56 int ret;
57
58 GNUNET_log_setup ("test-plugin", "WARNING", NULL);
59 ret = check ();
60
61 return ret;
62}
63
64/* end of test_plugin.c */