aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-06-05 00:37:06 +0200
committerChristian Grothoff <christian@grothoff.org>2018-06-05 00:37:06 +0200
commit1f083a4593b1f07dcf24549853963dedde7f4d02 (patch)
treee57137969a8a0cfd5af064cd063177936c6b894a
parent324f6168c2374d7bb71c3632fb6521860d8fdfa1 (diff)
use real GNS record types in tests to avoid failures in new extra serialization/deserialization checking
-rw-r--r--src/gnsrecord/test_gnsrecord_crypto.c3
-rw-r--r--src/gnsrecord/test_gnsrecord_serialization.c106
-rw-r--r--src/namecache/test_namecache_api_cache_block.c5
-rw-r--r--src/namestore/perf_namestore_api_zone_iteration.c5
-rw-r--r--src/namestore/test_namestore_api_lookup_nick.c3
-rw-r--r--src/namestore/test_namestore_api_lookup_private.c3
-rw-r--r--src/namestore/test_namestore_api_lookup_public.c3
-rw-r--r--src/namestore/test_namestore_api_lookup_shadow.c3
-rw-r--r--src/namestore/test_namestore_api_lookup_shadow_filter.c4
-rw-r--r--src/namestore/test_namestore_api_monitoring.c14
-rw-r--r--src/namestore/test_namestore_api_monitoring_existing.c5
-rw-r--r--src/namestore/test_namestore_api_remove.c3
-rw-r--r--src/namestore/test_namestore_api_store.c3
-rw-r--r--src/namestore/test_namestore_api_store_update.c9
-rw-r--r--src/namestore/test_namestore_api_zone_iteration.c5
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_nick.c5
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_specific_zone.c5
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_stop.c12
-rw-r--r--src/namestore/test_namestore_api_zone_to_name.c5
-rw-r--r--src/namestore/test_plugin_namestore.c6
20 files changed, 123 insertions, 84 deletions
diff --git a/src/gnsrecord/test_gnsrecord_crypto.c b/src/gnsrecord/test_gnsrecord_crypto.c
index 9ba303e662..9dd09c0bf4 100644
--- a/src/gnsrecord/test_gnsrecord_crypto.c
+++ b/src/gnsrecord/test_gnsrecord_crypto.c
@@ -23,11 +23,12 @@
*/
#include "platform.h"
#include "gnunet_util_lib.h"
+#include "gnunet_dnsparser_lib.h"
#include "gnunet_gnsrecord_lib.h"
#define RECORDS 5
-#define TEST_RECORD_TYPE 1234
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TEST_RECORD_DATALEN 123
diff --git a/src/gnsrecord/test_gnsrecord_serialization.c b/src/gnsrecord/test_gnsrecord_serialization.c
index 3edd2bc488..a43bf2efa8 100644
--- a/src/gnsrecord/test_gnsrecord_serialization.c
+++ b/src/gnsrecord/test_gnsrecord_serialization.c
@@ -24,6 +24,7 @@
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_gnsrecord_lib.h"
+#include "gnunet_dnsparser_lib.h"
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100)
@@ -31,7 +32,9 @@ static int res;
static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
+ char *const *args,
+ const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
size_t len;
@@ -46,7 +49,7 @@ run (void *cls, char *const *args, const char *cfgfile,
data_len = 0;
for (c = 0; c < rd_count; c++)
{
- src[c].record_type = c+1;
+ src[c].record_type = GNUNET_DNSPARSER_TYPE_TXT;
src[c].data_size = data_len;
src[c].data = GNUNET_malloc (data_len);
@@ -69,58 +72,61 @@ run (void *cls, char *const *args, const char *cfgfile,
(unsigned int) len);
GNUNET_assert (rd_ser != NULL);
-
- struct GNUNET_GNSRECORD_Data dst[rd_count];
- GNUNET_assert (GNUNET_OK ==
- GNUNET_GNSRECORD_records_deserialize (len,
- rd_ser,
- rd_count,
- dst));
-
- GNUNET_assert (dst != NULL);
-
- for (c = 0; c < rd_count; c++)
{
- if (src[c].data_size != dst[c].data_size)
- {
- GNUNET_break (0);
- res = 1;
- }
- if (src[c].expiration_time != dst[c].expiration_time)
- {
- GNUNET_break (0);
- res = 1;
- }
- if (src[c].flags != dst[c].flags)
- {
- GNUNET_break (0);
- res = 1;
- }
- if (src[c].record_type != dst[c].record_type)
- {
- GNUNET_break (0);
- res = 1;
- }
+ struct GNUNET_GNSRECORD_Data dst[rd_count];
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_GNSRECORD_records_deserialize (len,
+ rd_ser,
+ rd_count,
+ dst));
- size_t data_size = src[c].data_size;
- char data[data_size];
- memset (data, 'a', data_size);
- if (0 != memcmp (data, dst[c].data, data_size))
- {
- GNUNET_break (0);
- res = 1;
- }
- if (0 != memcmp (data, src[c].data, data_size))
- {
- GNUNET_break (0);
- res = 1;
- }
- if (0 != memcmp (src[c].data, dst[c].data, src[c].data_size))
+ GNUNET_assert (dst != NULL);
+
+ for (c = 0; c < rd_count; c++)
{
- GNUNET_break (0);
- res = 1;
+ if (src[c].data_size != dst[c].data_size)
+ {
+ GNUNET_break (0);
+ res = 1;
+ }
+ if (src[c].expiration_time != dst[c].expiration_time)
+ {
+ GNUNET_break (0);
+ res = 1;
+ }
+ if (src[c].flags != dst[c].flags)
+ {
+ GNUNET_break (0);
+ res = 1;
+ }
+ if (src[c].record_type != dst[c].record_type)
+ {
+ GNUNET_break (0);
+ res = 1;
+ }
+
+ {
+ size_t data_size = src[c].data_size;
+ char data[data_size];
+
+ memset (data, 'a', data_size);
+ if (0 != memcmp (data, dst[c].data, data_size))
+ {
+ GNUNET_break (0);
+ res = 1;
+ }
+ if (0 != memcmp (data, src[c].data, data_size))
+ {
+ GNUNET_break (0);
+ res = 1;
+ }
+ if (0 != memcmp (src[c].data, dst[c].data, src[c].data_size))
+ {
+ GNUNET_break (0);
+ res = 1;
+ }
+ }
}
-
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Element [%i]: EQUAL\n", c);
}
diff --git a/src/namecache/test_namecache_api_cache_block.c b/src/namecache/test_namecache_api_cache_block.c
index 7b0e6e3185..f70388c2a3 100644
--- a/src/namecache/test_namecache_api_cache_block.c
+++ b/src/namecache/test_namecache_api_cache_block.c
@@ -24,8 +24,9 @@
#include "platform.h"
#include "gnunet_namecache_service.h"
#include "gnunet_testing_lib.h"
+#include "gnunet_dnsparser_lib.h"
-#define TEST_RECORD_TYPE 1234
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TEST_RECORD_DATALEN 123
@@ -108,7 +109,7 @@ rd_decrypt_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Block was decrypted successfully \n");
-
+
GNUNET_SCHEDULER_add_now (&end, NULL);
}
diff --git a/src/namestore/perf_namestore_api_zone_iteration.c b/src/namestore/perf_namestore_api_zone_iteration.c
index 55d6fafa0d..e73c61ea24 100644
--- a/src/namestore/perf_namestore_api_zone_iteration.c
+++ b/src/namestore/perf_namestore_api_zone_iteration.c
@@ -26,6 +26,9 @@
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
#include "namestore.h"
+#include "gnunet_dnsparser_lib.h"
+
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
/**
* A #BENCHMARK_SIZE of 1000 takes less than a minute on a reasonably
@@ -141,7 +144,7 @@ create_record (unsigned int count)
rd = GNUNET_malloc (count + sizeof (struct GNUNET_GNSRECORD_Data));
rd->expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us;
- rd->record_type = count;
+ rd->record_type = TEST_RECORD_TYPE;
rd->data_size = count;
rd->data = (void *) &rd[1];
rd->flags = 0;
diff --git a/src/namestore/test_namestore_api_lookup_nick.c b/src/namestore/test_namestore_api_lookup_nick.c
index b9ae93bf2b..acb30e79df 100644
--- a/src/namestore/test_namestore_api_lookup_nick.c
+++ b/src/namestore/test_namestore_api_lookup_nick.c
@@ -24,8 +24,9 @@
#include "platform.h"
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
+#include "gnunet_dnsparser_lib.h"
-#define TEST_RECORD_TYPE 1234
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TEST_RECORD_DATALEN 123
diff --git a/src/namestore/test_namestore_api_lookup_private.c b/src/namestore/test_namestore_api_lookup_private.c
index 689e73a2e9..3557e71fad 100644
--- a/src/namestore/test_namestore_api_lookup_private.c
+++ b/src/namestore/test_namestore_api_lookup_private.c
@@ -24,8 +24,9 @@
#include "platform.h"
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
+#include "gnunet_dnsparser_lib.h"
-#define TEST_RECORD_TYPE 1234
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TEST_RECORD_DATALEN 123
diff --git a/src/namestore/test_namestore_api_lookup_public.c b/src/namestore/test_namestore_api_lookup_public.c
index 28a68daf9c..f17bb6fc88 100644
--- a/src/namestore/test_namestore_api_lookup_public.c
+++ b/src/namestore/test_namestore_api_lookup_public.c
@@ -25,8 +25,9 @@
#include "gnunet_namecache_service.h"
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
+#include "gnunet_dnsparser_lib.h"
-#define TEST_RECORD_TYPE 1234
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TEST_RECORD_DATALEN 123
diff --git a/src/namestore/test_namestore_api_lookup_shadow.c b/src/namestore/test_namestore_api_lookup_shadow.c
index 39ce4e564f..1cab0a9f68 100644
--- a/src/namestore/test_namestore_api_lookup_shadow.c
+++ b/src/namestore/test_namestore_api_lookup_shadow.c
@@ -27,8 +27,9 @@
#include "gnunet_namecache_service.h"
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
+#include "gnunet_dnsparser_lib.h"
-#define TEST_RECORD_TYPE 1234
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TEST_RECORD_DATALEN 123
diff --git a/src/namestore/test_namestore_api_lookup_shadow_filter.c b/src/namestore/test_namestore_api_lookup_shadow_filter.c
index 09fd8ce073..0ccdf1f4bf 100644
--- a/src/namestore/test_namestore_api_lookup_shadow_filter.c
+++ b/src/namestore/test_namestore_api_lookup_shadow_filter.c
@@ -28,9 +28,11 @@
#include "gnunet_namecache_service.h"
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
+#include "gnunet_dnsparser_lib.h"
+
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TEST_NAME "dummy.dummy.gnunet"
-#define TEST_RECORD_TYPE 1234
#define TEST_RECORD_DATALEN 123
#define TEST_RECORD_DATA 'a'
#define TEST_SHADOW_RECORD_DATA 'b'
diff --git a/src/namestore/test_namestore_api_monitoring.c b/src/namestore/test_namestore_api_monitoring.c
index de202d5355..7c8ee27d74 100644
--- a/src/namestore/test_namestore_api_monitoring.c
+++ b/src/namestore/test_namestore_api_monitoring.c
@@ -25,6 +25,10 @@
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
#include "namestore.h"
+#include "gnunet_dnsparser_lib.h"
+
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
+
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100)
@@ -244,14 +248,14 @@ put_cont (void *cls,
static struct GNUNET_GNSRECORD_Data *
create_record (unsigned int count)
{
- unsigned int c;
- struct GNUNET_GNSRECORD_Data * rd;
+ struct GNUNET_GNSRECORD_Data *rd;
- rd = GNUNET_malloc (count * sizeof (struct GNUNET_GNSRECORD_Data));
- for (c = 0; c < count; c++)
+ rd = GNUNET_new_array (count,
+ struct GNUNET_GNSRECORD_Data);
+ for (unsigned int c = 0; c < count; c++)
{
rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us;
- rd[c].record_type = 1111;
+ rd[c].record_type = TEST_RECORD_TYPE;
rd[c].data_size = 50;
rd[c].data = GNUNET_malloc(50);
rd[c].flags = 0;
diff --git a/src/namestore/test_namestore_api_monitoring_existing.c b/src/namestore/test_namestore_api_monitoring_existing.c
index 449b36d65d..89fd9c8e9d 100644
--- a/src/namestore/test_namestore_api_monitoring_existing.c
+++ b/src/namestore/test_namestore_api_monitoring_existing.c
@@ -25,6 +25,9 @@
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
#include "namestore.h"
+#include "gnunet_dnsparser_lib.h"
+
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
@@ -292,7 +295,7 @@ create_record (unsigned int count)
for (unsigned int c = 0; c < count; c++)
{
rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us;
- rd[c].record_type = 1111;
+ rd[c].record_type = TEST_RECORD_TYPE;
rd[c].data_size = 50;
rd[c].data = GNUNET_malloc(50);
rd[c].flags = 0;
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c
index c9e2802bd7..8f7782300f 100644
--- a/src/namestore/test_namestore_api_remove.c
+++ b/src/namestore/test_namestore_api_remove.c
@@ -24,8 +24,9 @@
#include "platform.h"
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
+#include "gnunet_dnsparser_lib.h"
-#define TEST_RECORD_TYPE 1234
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TEST_RECORD_DATALEN 123
diff --git a/src/namestore/test_namestore_api_store.c b/src/namestore/test_namestore_api_store.c
index 4abcfa4d33..5112126c1e 100644
--- a/src/namestore/test_namestore_api_store.c
+++ b/src/namestore/test_namestore_api_store.c
@@ -24,8 +24,9 @@
#include "platform.h"
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
+#include "gnunet_dnsparser_lib.h"
-#define TEST_RECORD_TYPE 1234
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TEST_RECORD_DATALEN 123
diff --git a/src/namestore/test_namestore_api_store_update.c b/src/namestore/test_namestore_api_store_update.c
index 7b13cd9c58..d636018afb 100644
--- a/src/namestore/test_namestore_api_store_update.c
+++ b/src/namestore/test_namestore_api_store_update.c
@@ -27,15 +27,14 @@
#include "gnunet_namecache_service.h"
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
+#include "gnunet_dnsparser_lib.h"
-#define TEST_RECORD_TYPE 1234
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TEST_RECORD_DATALEN 123
#define TEST_RECORD_DATA 'a'
-#define TEST_RECORD_TYPE2 4321
-
#define TEST_RECORD_DATALEN2 234
#define TEST_RECORD_DATA2 'b'
@@ -149,7 +148,7 @@ rd_decrypt_cb (void *cls,
rd_new.flags = GNUNET_GNSRECORD_RF_NONE;
rd_new.expiration_time = GNUNET_TIME_absolute_get().abs_value_us + 1000000000;
- rd_new.record_type = TEST_RECORD_TYPE2;
+ rd_new.record_type = TEST_RECORD_TYPE;
rd_new.data_size = TEST_RECORD_DATALEN2;
rd_new.data = GNUNET_malloc (TEST_RECORD_DATALEN2);
memset ((char *) rd_new.data,
@@ -172,7 +171,7 @@ rd_decrypt_cb (void *cls,
memset (rd_cmp_data,
TEST_RECORD_DATA2,
TEST_RECORD_DATALEN2);
- GNUNET_assert (TEST_RECORD_TYPE2 == rd[0].record_type);
+ GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type);
GNUNET_assert (TEST_RECORD_DATALEN2 == rd[0].data_size);
GNUNET_assert (0 == memcmp (&rd_cmp_data,
rd[0].data,
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c
index 68c3de9b83..00b65a5762 100644
--- a/src/namestore/test_namestore_api_zone_iteration.c
+++ b/src/namestore/test_namestore_api_zone_iteration.c
@@ -25,6 +25,9 @@
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
#include "namestore.h"
+#include "gnunet_dnsparser_lib.h"
+
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100)
@@ -322,7 +325,7 @@ create_record (unsigned int count)
for (unsigned int c = 0; c < count; c++)
{
rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us;
- rd[c].record_type = 1111;
+ rd[c].record_type = TEST_RECORD_TYPE;
rd[c].data_size = 50;
rd[c].data = GNUNET_malloc(50);
rd[c].flags = 0;
diff --git a/src/namestore/test_namestore_api_zone_iteration_nick.c b/src/namestore/test_namestore_api_zone_iteration_nick.c
index d950b7e693..ff1b3d402b 100644
--- a/src/namestore/test_namestore_api_zone_iteration_nick.c
+++ b/src/namestore/test_namestore_api_zone_iteration_nick.c
@@ -25,6 +25,9 @@
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
#include "namestore.h"
+#include "gnunet_dnsparser_lib.h"
+
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define ZONE_NICK_1 "nick1"
#define ZONE_NICK_2 "nick2"
@@ -322,7 +325,7 @@ create_record (unsigned int count)
for (unsigned int c = 0; c < count; c++)
{
rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us;
- rd[c].record_type = 1111;
+ rd[c].record_type = TEST_RECORD_TYPE;
rd[c].data_size = 50;
rd[c].data = GNUNET_malloc(50);
rd[c].flags = 0;
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
index 0b137cc629..a861842977 100644
--- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
+++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
@@ -26,6 +26,9 @@
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
#include "namestore.h"
+#include "gnunet_dnsparser_lib.h"
+
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100)
@@ -299,7 +302,7 @@ create_record (unsigned int count)
for (unsigned int c = 0; c < count; c++)
{
rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us;
- rd[c].record_type = 1111;
+ rd[c].record_type = TEST_RECORD_TYPE;
rd[c].data_size = 50;
rd[c].data = GNUNET_malloc(50);
rd[c].flags = 0;
diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c
index c7358fc6ea..98514885c1 100644
--- a/src/namestore/test_namestore_api_zone_iteration_stop.c
+++ b/src/namestore/test_namestore_api_zone_iteration_stop.c
@@ -25,7 +25,9 @@
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
#include "namestore.h"
+#include "gnunet_dnsparser_lib.h"
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100)
#define WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2)
@@ -349,14 +351,14 @@ put_cont (void *cls, int32_t success, const char *emsg)
static struct GNUNET_GNSRECORD_Data *
create_record (unsigned int count)
{
- unsigned int c;
- struct GNUNET_GNSRECORD_Data * rd;
+ struct GNUNET_GNSRECORD_Data *rd;
- rd = GNUNET_malloc (count * sizeof (struct GNUNET_GNSRECORD_Data));
- for (c = 0; c < count; c++)
+ rd = GNUNET_new_array (count,
+ struct GNUNET_GNSRECORD_Data);
+ for (unsigned int c = 0; c < count; c++)
{
rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us;
- rd[c].record_type = 1111;
+ rd[c].record_type = TEST_RECORD_TYPE;
rd[c].data_size = 50;
rd[c].data = GNUNET_malloc(50);
rd[c].flags = 0;
diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c
index 292d8f7019..4ce940114d 100644
--- a/src/namestore/test_namestore_api_zone_to_name.c
+++ b/src/namestore/test_namestore_api_zone_to_name.c
@@ -25,10 +25,11 @@
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
#include "namestore.h"
+#include "gnunet_dnsparser_lib.h"
-#define RECORDS 5
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
-#define TEST_RECORD_TYPE 1234
+#define RECORDS 5
#define TEST_RECORD_DATALEN 123
diff --git a/src/namestore/test_plugin_namestore.c b/src/namestore/test_plugin_namestore.c
index 8732acbcb2..5c8f5e6f74 100644
--- a/src/namestore/test_plugin_namestore.c
+++ b/src/namestore/test_plugin_namestore.c
@@ -26,7 +26,9 @@
#include "gnunet_util_lib.h"
#include "gnunet_namestore_plugin.h"
#include "gnunet_testing_lib.h"
+#include "gnunet_dnsparser_lib.h"
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
static int ok;
@@ -110,7 +112,7 @@ test_record (void *cls,
{
GNUNET_assert (rd[i].data_size == id % 10);
GNUNET_assert (0 == memcmp ("Hello World", rd[i].data, id % 10));
- GNUNET_assert (rd[i].record_type == 1 + (id % 13));
+ GNUNET_assert (rd[i].record_type == TEST_RECORD_TYPE);
GNUNET_assert (rd[i].flags == 0);
}
memset (&tzone_private_key,
@@ -154,7 +156,7 @@ put_record (struct GNUNET_NAMESTORE_PluginFunctions *nsp,
rd[i].data = "Hello World";
rd[i].data_size = id % 10;
rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES).abs_value_us;
- rd[i].record_type = 1 + (id % 13);
+ rd[i].record_type = TEST_RECORD_TYPE;
rd[i].flags = 0;
}
memset (&zone_private_key, (id % 241), sizeof (zone_private_key));