aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_container_meta_data.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-02-20 13:54:25 +0100
committerChristian Grothoff <christian@grothoff.org>2017-02-20 13:54:25 +0100
commitf0149c5430f42a8bad422e9c51754af59c7bfa2f (patch)
treea2d5801772dfe45c6c1f98685230ab1c2823bfa8 /src/util/test_container_meta_data.c
parentd4c6f4e5ecccd9305fb0258968fa24b405455df3 (diff)
downloadgnunet-f0149c5430f42a8bad422e9c51754af59c7bfa2f.tar.gz
gnunet-f0149c5430f42a8bad422e9c51754af59c7bfa2f.zip
remove dependency on libextractor from testcase; fix #4901
Diffstat (limited to 'src/util/test_container_meta_data.c')
-rw-r--r--src/util/test_container_meta_data.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/util/test_container_meta_data.c b/src/util/test_container_meta_data.c
index d84935a1e..cd23674a3 100644
--- a/src/util/test_container_meta_data.c
+++ b/src/util/test_container_meta_data.c
@@ -27,10 +27,9 @@
27#include "platform.h" 27#include "platform.h"
28#include "gnunet_util_lib.h" 28#include "gnunet_util_lib.h"
29 29
30#if HAVE_EXTRACTOR_H
31
32#define ABORT(m) { fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); if (m != NULL) GNUNET_CONTAINER_meta_data_destroy(m); return 1; } 30#define ABORT(m) { fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); if (m != NULL) GNUNET_CONTAINER_meta_data_destroy(m); return 1; }
33 31
32
34static int 33static int
35testMeta (int i) 34testMeta (int i)
36{ 35{
@@ -106,10 +105,15 @@ testMeta (int i)
106 ABORT (m); 105 ABORT (m);
107 for (j = 0; j < i; j++) 106 for (j = 0; j < i; j++)
108 { 107 {
109 GNUNET_snprintf (val, sizeof (val), "%s.%d", 108 GNUNET_snprintf (val,
110 "A teststring that should compress well.", j); 109 sizeof (val),
110 "%s.%d",
111 "A teststring that should compress well.",
112 j);
111 if (GNUNET_OK != 113 if (GNUNET_OK !=
112 GNUNET_CONTAINER_meta_data_delete (m, EXTRACTOR_METATYPE_UNKNOWN, val, 114 GNUNET_CONTAINER_meta_data_delete (m,
115 EXTRACTOR_METATYPE_UNKNOWN,
116 val,
113 strlen (val) + 1)) 117 strlen (val) + 1))
114 { 118 {
115 ABORT (m); 119 ABORT (m);
@@ -121,7 +125,8 @@ testMeta (int i)
121 return 0; 125 return 0;
122} 126}
123 127
124int 128
129static int
125testMetaMore (int i) 130testMetaMore (int i)
126{ 131{
127 struct GNUNET_CONTAINER_MetaData *meta; 132 struct GNUNET_CONTAINER_MetaData *meta;
@@ -135,7 +140,7 @@ testMetaMore (int i)
135 { 140 {
136 GNUNET_snprintf (txt, 128, "%u -- %u\n", i, q); 141 GNUNET_snprintf (txt, 128, "%u -- %u\n", i, q);
137 GNUNET_CONTAINER_meta_data_insert (meta, "<test>", 142 GNUNET_CONTAINER_meta_data_insert (meta, "<test>",
138 q % EXTRACTOR_metatype_get_max (), 143 q % 42 /* EXTRACTOR_metatype_get_max () */,
139 EXTRACTOR_METAFORMAT_UTF8, "text/plain", 144 EXTRACTOR_METAFORMAT_UTF8, "text/plain",
140 txt, strlen (txt) + 1); 145 txt, strlen (txt) + 1);
141 } 146 }
@@ -153,6 +158,7 @@ testMetaMore (int i)
153 return 0; 158 return 0;
154} 159}
155 160
161
156static int 162static int
157testMetaLink () 163testMetaLink ()
158{ 164{
@@ -188,7 +194,8 @@ testMetaLink ()
188 return 0; 194 return 0;
189} 195}
190 196
191int 197
198static int
192check () 199check ()
193{ 200{
194 struct GNUNET_CONTAINER_MetaData *meta; 201 struct GNUNET_CONTAINER_MetaData *meta;
@@ -345,16 +352,5 @@ main (int argc, char *argv[])
345 return 0; 352 return 0;
346} 353}
347 354
348#else
349
350int
351main (int argc, char *argv[])
352{
353 fprintf (stderr,
354 "GNU libextractor not found, skipping test.\n");
355 return 0;
356}
357
358#endif
359 355
360/* end of test_container_meta_data.c */ 356/* end of test_container_meta_data.c */