diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-02-20 13:54:25 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-02-20 13:54:25 +0100 |
commit | f0149c5430f42a8bad422e9c51754af59c7bfa2f (patch) | |
tree | a2d5801772dfe45c6c1f98685230ab1c2823bfa8 /src/util/test_container_meta_data.c | |
parent | d4c6f4e5ecccd9305fb0258968fa24b405455df3 (diff) | |
download | gnunet-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.c | 34 |
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 | |||
34 | static int | 33 | static int |
35 | testMeta (int i) | 34 | testMeta (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 | ||
124 | int | 128 | |
129 | static int | ||
125 | testMetaMore (int i) | 130 | testMetaMore (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 | |||
156 | static int | 162 | static int |
157 | testMetaLink () | 163 | testMetaLink () |
158 | { | 164 | { |
@@ -188,7 +194,8 @@ testMetaLink () | |||
188 | return 0; | 194 | return 0; |
189 | } | 195 | } |
190 | 196 | ||
191 | int | 197 | |
198 | static int | ||
192 | check () | 199 | check () |
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 | |||
350 | int | ||
351 | main (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 */ |