aboutsummaryrefslogtreecommitdiff
path: root/src/block
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-07-15 15:04:45 +0000
committerChristian Grothoff <christian@grothoff.org>2012-07-15 15:04:45 +0000
commit428fb513ef4353f382a5e1b35e838af1fed59058 (patch)
tree8b96409d27bfe90d724b85facd8e15fc7a80074b /src/block
parentf50072ff43b084ae76ae17fed0610f315db81255 (diff)
downloadgnunet-428fb513ef4353f382a5e1b35e838af1fed59058.tar.gz
gnunet-428fb513ef4353f382a5e1b35e838af1fed59058.zip
-moving block test to resolve cyclic dependency
Diffstat (limited to 'src/block')
-rw-r--r--src/block/Makefile.am12
-rw-r--r--src/block/test_block.c77
2 files changed, 0 insertions, 89 deletions
diff --git a/src/block/Makefile.am b/src/block/Makefile.am
index a949833f9..d0a5ae752 100644
--- a/src/block/Makefile.am
+++ b/src/block/Makefile.am
@@ -49,15 +49,3 @@ libgnunetblock_la_DEPENDENCIES = \
49libgnunetblock_la_LDFLAGS = \ 49libgnunetblock_la_LDFLAGS = \
50 $(GN_LIB_LDFLAGS) \ 50 $(GN_LIB_LDFLAGS) \
51 -version-info 0:0:0 51 -version-info 0:0:0
52
53check_PROGRAMS = \
54 test_block
55
56#TESTS = $(check_PROGRAMS)
57
58test_block_SOURCES = \
59 test_block.c
60test_block_LDADD = \
61 $(top_builddir)/src/block/libgnunetblock.la \
62 $(top_builddir)/src/util/libgnunetutil.la
63
diff --git a/src/block/test_block.c b/src/block/test_block.c
deleted file mode 100644
index 5e2b34696..000000000
--- a/src/block/test_block.c
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2 This file is part of GNUnet
3 (C) 2010 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 block/test_block.c
22 * @brief test for block.c
23 * @author Christian Grothoff
24 */
25#include "platform.h"
26#include "gnunet_block_lib.h"
27
28#define DEBUG GNUNET_EXTRA_LOGGING
29
30#define VERBOSE GNUNET_NO
31
32static int
33test_fs (struct GNUNET_BLOCK_Context *ctx)
34{
35 struct GNUNET_HashCode key;
36 char block[4];
37
38 memset (block, 1, sizeof (block));
39 if (GNUNET_OK !=
40 GNUNET_BLOCK_get_key (ctx, GNUNET_BLOCK_TYPE_FS_DBLOCK, block,
41 sizeof (block), &key))
42 return 1;
43 if (GNUNET_BLOCK_EVALUATION_OK_LAST !=
44 GNUNET_BLOCK_evaluate (ctx, GNUNET_BLOCK_TYPE_FS_DBLOCK, &key, NULL, 0,
45 NULL, 0, block, sizeof (block)))
46 return 2;
47 if (GNUNET_BLOCK_EVALUATION_REQUEST_VALID !=
48 GNUNET_BLOCK_evaluate (ctx, GNUNET_BLOCK_TYPE_FS_DBLOCK, &key, NULL, 0,
49 NULL, 0, NULL, 0))
50 return 4;
51 GNUNET_log_skip (1, GNUNET_NO);
52 if (GNUNET_BLOCK_EVALUATION_REQUEST_INVALID !=
53 GNUNET_BLOCK_evaluate (ctx, GNUNET_BLOCK_TYPE_FS_DBLOCK, &key, NULL, 0,
54 "bogus", 5, NULL, 0))
55 return 8;
56 GNUNET_log_skip (0, GNUNET_YES);
57 return 0;
58}
59
60int
61main (int argc, char *argv[])
62{
63 int ret;
64 struct GNUNET_BLOCK_Context *ctx;
65 struct GNUNET_CONFIGURATION_Handle *cfg;
66
67 GNUNET_log_setup ("test-block", "WARNING", NULL);
68 cfg = GNUNET_CONFIGURATION_create ();
69 GNUNET_CONFIGURATION_set_value_string (cfg, "block", "PLUGINS", "fs");
70 ctx = GNUNET_BLOCK_context_create (cfg);
71 ret = test_fs (ctx);
72 GNUNET_BLOCK_context_destroy (ctx);
73 GNUNET_CONFIGURATION_destroy (cfg);
74 if (ret != 0)
75 FPRINTF (stderr, "Tests failed: %d\n", ret);
76 return ret;
77}