diff options
Diffstat (limited to 'src/fs/test_plugin_block_fs.c')
-rw-r--r-- | src/fs/test_plugin_block_fs.c | 92 |
1 files changed, 0 insertions, 92 deletions
diff --git a/src/fs/test_plugin_block_fs.c b/src/fs/test_plugin_block_fs.c deleted file mode 100644 index 4f71c5d74..000000000 --- a/src/fs/test_plugin_block_fs.c +++ /dev/null | |||
@@ -1,92 +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, GNUNET_BLOCK_TYPE_FS_DBLOCK, block, | ||
38 | sizeof(block), &key)) | ||
39 | return 1; | ||
40 | if (GNUNET_BLOCK_EVALUATION_OK_LAST != | ||
41 | GNUNET_BLOCK_evaluate (ctx, | ||
42 | GNUNET_BLOCK_TYPE_FS_DBLOCK, | ||
43 | NULL, | ||
44 | GNUNET_BLOCK_EO_NONE, | ||
45 | &key, | ||
46 | NULL, 0, | ||
47 | block, sizeof(block))) | ||
48 | return 2; | ||
49 | if (GNUNET_BLOCK_EVALUATION_REQUEST_VALID != | ||
50 | GNUNET_BLOCK_evaluate (ctx, | ||
51 | GNUNET_BLOCK_TYPE_FS_DBLOCK, | ||
52 | NULL, | ||
53 | GNUNET_BLOCK_EO_NONE, | ||
54 | &key, | ||
55 | NULL, 0, | ||
56 | NULL, 0)) | ||
57 | return 4; | ||
58 | GNUNET_log_skip (1, GNUNET_NO); | ||
59 | if (GNUNET_BLOCK_EVALUATION_REQUEST_INVALID != | ||
60 | GNUNET_BLOCK_evaluate (ctx, | ||
61 | GNUNET_BLOCK_TYPE_FS_DBLOCK, | ||
62 | NULL, | ||
63 | GNUNET_BLOCK_EO_NONE, | ||
64 | &key, | ||
65 | "bogus", 5, | ||
66 | NULL, 0)) | ||
67 | return 8; | ||
68 | GNUNET_log_skip (0, GNUNET_YES); | ||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | |||
73 | int | ||
74 | main (int argc, char *argv[]) | ||
75 | { | ||
76 | int ret; | ||
77 | struct GNUNET_BLOCK_Context *ctx; | ||
78 | struct GNUNET_CONFIGURATION_Handle *cfg; | ||
79 | |||
80 | GNUNET_log_setup ("test-block", "WARNING", NULL); | ||
81 | cfg = GNUNET_CONFIGURATION_create (); | ||
82 | ctx = GNUNET_BLOCK_context_create (cfg); | ||
83 | ret = test_fs (ctx); | ||
84 | GNUNET_BLOCK_context_destroy (ctx); | ||
85 | GNUNET_CONFIGURATION_destroy (cfg); | ||
86 | if (ret != 0) | ||
87 | fprintf (stderr, "Tests failed: %d\n", ret); | ||
88 | return ret; | ||
89 | } | ||
90 | |||
91 | |||
92 | /* end of test_plugin_block_fs.c */ | ||