aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/test_common_allocation.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/util/test_common_allocation.c b/src/util/test_common_allocation.c
index e2fc29e82..a24af7124 100644
--- a/src/util/test_common_allocation.c
+++ b/src/util/test_common_allocation.c
@@ -27,7 +27,7 @@
27 27
28 28
29static int 29static int
30check () 30check (void)
31{ 31{
32#define MAX_TESTVAL 1024 32#define MAX_TESTVAL 1024
33 char *ptrs[MAX_TESTVAL]; 33 char *ptrs[MAX_TESTVAL];
@@ -134,6 +134,28 @@ check ()
134} 134}
135 135
136 136
137static int
138check2 (void)
139{
140 char *a1 = NULL;
141 unsigned int a1_len = 0;
142 const char *a2 = "test";
143
144 GNUNET_array_append (a1,
145 a1_len,
146 'x');
147 GNUNET_array_concatenate (a1,
148 a1_len,
149 a2,
150 4);
151 GNUNET_assert (0 == strncmp ("xtest",
152 a1,
153 5));
154 GNUNET_assert (5 == a1_len);
155 return 0;
156}
157
158
137int 159int
138main (int argc, char *argv[]) 160main (int argc, char *argv[])
139{ 161{
@@ -142,7 +164,7 @@ main (int argc, char *argv[])
142 GNUNET_log_setup ("test-common-allocation", 164 GNUNET_log_setup ("test-common-allocation",
143 "WARNING", 165 "WARNING",
144 NULL); 166 NULL);
145 ret = check (); 167 ret = check () | check2 ();
146 if (ret != 0) 168 if (ret != 0)
147 fprintf (stderr, 169 fprintf (stderr,
148 "ERROR %d.\n", 170 "ERROR %d.\n",