aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/test_reclaim_attribute.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/reclaim/test_reclaim_attribute.c')
-rw-r--r--src/reclaim/test_reclaim_attribute.c49
1 files changed, 0 insertions, 49 deletions
diff --git a/src/reclaim/test_reclaim_attribute.c b/src/reclaim/test_reclaim_attribute.c
deleted file mode 100644
index f8faf8021..000000000
--- a/src/reclaim/test_reclaim_attribute.c
+++ /dev/null
@@ -1,49 +0,0 @@
1#include "platform.h"
2#include "gnunet_common.h"
3#include "gnunet_reclaim_lib.h"
4#include "gnunet_container_lib.h"
5
6int
7main (int argc, char *argv[])
8{
9 struct GNUNET_RECLAIM_AttributeList *al;
10 struct GNUNET_RECLAIM_AttributeList *al_two;
11 struct GNUNET_RECLAIM_AttributeListEntry *ale;
12 char attrname[100];
13 char attrdata[100];
14 size_t ser_len_claimed;
15 size_t ser_len_actual;
16 char *ser_data;
17 int count = 0;
18
19 al = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
20 for (int i = 0; i < 12; i++)
21 {
22 memset (attrname, 0, 100);
23 memset (attrdata, 0, 100);
24 sprintf (attrname, "attr%d", i);
25 sprintf (attrdata, "%d", i);
26 ale = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry);
27 ale->attribute = GNUNET_RECLAIM_attribute_new (attrname,
28 &GNUNET_RECLAIM_ID_ZERO,
29 GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING,
30 attrdata,
31 strlen (attrdata));
32 GNUNET_CONTAINER_DLL_insert (al->list_head,
33 al->list_tail,
34 ale);
35 }
36 ser_len_claimed = GNUNET_RECLAIM_attribute_list_serialize_get_size (al);
37 ser_data = GNUNET_malloc (ser_len_claimed);
38 ser_len_actual = GNUNET_RECLAIM_attribute_list_serialize (al,
39 ser_data);
40 GNUNET_assert (ser_len_claimed == ser_len_actual);
41 al_two = GNUNET_RECLAIM_attribute_list_deserialize (ser_data,
42 ser_len_actual);
43 for (ale = al_two->list_head; NULL != ale; ale = ale->next)
44 count++;
45 GNUNET_assert (12 == count);
46 //GNUNET_assert (-1 != deser_len);
47 GNUNET_free (ser_data);
48 GNUNET_RECLAIM_attribute_list_destroy (al);
49}