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.c87
1 files changed, 0 insertions, 87 deletions
diff --git a/src/util/test_plugin.c b/src/util/test_plugin.c
deleted file mode 100644
index e739d17c9..000000000
--- a/src/util/test_plugin.c
+++ /dev/null
@@ -1,87 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2009 GNUnet e.V.
4
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.
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 Affero General Public License for more details.
14
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/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20/**
21 * @file util/test_plugin.c
22 * @brief testcase for plugin.c
23 */
24#include "platform.h"
25#include "gnunet_util_lib.h"
26
27
28static void
29test_cb (void *cls,
30 const char *libname,
31 void *lib_ret)
32{
33 const char *test_cls = cls;
34 char *ret;
35
36 GNUNET_assert (0 == strcmp (test_cls,
37 "test-closure"));
38 GNUNET_assert (0 == strcmp (lib_ret,
39 "Hello"));
40 ret = GNUNET_PLUGIN_unload (libname,
41 "out");
42 GNUNET_assert (NULL != ret);
43 GNUNET_assert (0 == strcmp (ret,
44 "World"));
45 free (ret);
46}
47
48
49int
50main (int argc, char *argv[])
51{
52 void *ret;
53
54 GNUNET_log_setup ("test-plugin",
55 "WARNING",
56 NULL);
57 GNUNET_log_skip (1,
58 GNUNET_NO);
59 ret = GNUNET_PLUGIN_load ("libgnunet_plugin_missing",
60 NULL);
61 GNUNET_log_skip (0, GNUNET_NO);
62 if (NULL != ret)
63 return 1;
64 ret = GNUNET_PLUGIN_load ("libgnunet_plugin_utiltest",
65 "in");
66 if (NULL == ret)
67 return 1;
68 if (0 != strcmp (ret,
69 "Hello"))
70 return 2;
71 ret = GNUNET_PLUGIN_unload ("libgnunet_plugin_utiltest",
72 "out");
73 if (NULL == ret)
74 return 3;
75 if (0 != strcmp (ret,
76 "World"))
77 return 4;
78 free (ret);
79 GNUNET_PLUGIN_load_all ("libgnunet_plugin_utiltes",
80 "in",
81 &test_cb,
82 "test-closure");
83 return 0;
84}
85
86
87/* end of test_plugin.c */