diff options
Diffstat (limited to 'src/fs/test_plugin_block_fs.c')
-rw-r--r-- | src/fs/test_plugin_block_fs.c | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/src/fs/test_plugin_block_fs.c b/src/fs/test_plugin_block_fs.c deleted file mode 100644 index f15d10b17..000000000 --- a/src/fs/test_plugin_block_fs.c +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2010, 2012 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 fs/test_plugin_block_fs.c | ||
22 | * @brief test for plugin_block_fs.c | ||
23 | * @author Christian Grothoff | ||
24 | */ | ||
25 | #include "platform.h" | ||
26 | #include "gnunet_block_lib.h" | ||
27 | |||
28 | |||
29 | static int | ||
30 | test_fs (struct GNUNET_BLOCK_Context *ctx) | ||
31 | { | ||
32 | struct GNUNET_HashCode key; | ||
33 | char block[4]; | ||
34 | |||
35 | memset (block, 1, sizeof(block)); | ||
36 | if (GNUNET_OK != | ||
37 | GNUNET_BLOCK_get_key (ctx, | ||
38 | GNUNET_BLOCK_TYPE_FS_DBLOCK, | ||
39 | block, | ||
40 | sizeof(block), | ||
41 | &key)) | ||
42 | return 1; | ||
43 | if (GNUNET_OK != | ||
44 | GNUNET_BLOCK_check_block (ctx, | ||
45 | GNUNET_BLOCK_TYPE_FS_DBLOCK, | ||
46 | block, | ||
47 | sizeof(block))) | ||
48 | return 2; | ||
49 | if (GNUNET_OK != | ||
50 | GNUNET_BLOCK_check_query (ctx, | ||
51 | GNUNET_BLOCK_TYPE_FS_DBLOCK, | ||
52 | &key, | ||
53 | NULL, 0)) | ||
54 | return 4; | ||
55 | GNUNET_log_skip (1, GNUNET_NO); | ||
56 | if (GNUNET_NO != | ||
57 | GNUNET_BLOCK_check_query (ctx, | ||
58 | GNUNET_BLOCK_TYPE_FS_DBLOCK, | ||
59 | &key, | ||
60 | "bogus", 5)) | ||
61 | return 8; | ||
62 | GNUNET_log_skip (0, GNUNET_YES); | ||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | |||
67 | int | ||
68 | main (int argc, char *argv[]) | ||
69 | { | ||
70 | int ret; | ||
71 | struct GNUNET_BLOCK_Context *ctx; | ||
72 | struct GNUNET_CONFIGURATION_Handle *cfg; | ||
73 | |||
74 | GNUNET_log_setup ("test-block", "WARNING", NULL); | ||
75 | cfg = GNUNET_CONFIGURATION_create (); | ||
76 | ctx = GNUNET_BLOCK_context_create (cfg); | ||
77 | ret = test_fs (ctx); | ||
78 | GNUNET_BLOCK_context_destroy (ctx); | ||
79 | GNUNET_CONFIGURATION_destroy (cfg); | ||
80 | if (ret != 0) | ||
81 | fprintf (stderr, "Tests failed: %d\n", ret); | ||
82 | return ret; | ||
83 | } | ||
84 | |||
85 | |||
86 | /* end of test_plugin_block_fs.c */ | ||