Add some more cases to the app-id unit tests
[glib.git] / glib / tests / base64.c
blobffb00d532dbc17a1cc8aa98b9c9b411441698c64
1 #include <glib.h>
2 #include <string.h>
3 #include <stdlib.h>
5 #define DATA_SIZE 1024
6 #define BLOCK_SIZE 32
7 #define NUM_BLOCKS 32
8 static guchar data[DATA_SIZE];
10 static void
11 test_incremental (gboolean line_break,
12 gint length)
14 char *p;
15 gsize len, decoded_len, max, input_len, block_size;
16 int state, save;
17 guint decoder_save;
18 char *text;
19 guchar *data2;
21 data2 = g_malloc (length);
22 text = g_malloc (length * 4);
24 len = 0;
25 state = 0;
26 save = 0;
27 input_len = 0;
28 while (input_len < length)
30 block_size = MIN (BLOCK_SIZE, length - input_len);
31 len += g_base64_encode_step (data + input_len, block_size,
32 line_break, text + len, &state, &save);
33 input_len += block_size;
35 len += g_base64_encode_close (line_break, text + len, &state, &save);
37 if (line_break)
38 max = length * 4 / 3 + length * 4 / (3 * 72) + 7;
39 else
40 max = length * 4 / 3 + 6;
42 /* Check encoded length */
43 g_assert_cmpint (len, <=, max);
45 decoded_len = 0;
46 state = 0;
47 decoder_save = 0;
48 p = text;
49 while (len > 0)
51 int chunk_len = MIN (BLOCK_SIZE, len);
52 decoded_len += g_base64_decode_step (p,
53 chunk_len,
54 data2 + decoded_len,
55 &state, &decoder_save);
56 p += chunk_len;
57 len -= chunk_len;
60 g_assert_cmpmem (data, length, data2, decoded_len);
62 g_free (text);
63 g_free (data2);
66 static void
67 test_incremental_break (gconstpointer d)
69 gint length = GPOINTER_TO_INT (d);
71 test_incremental (TRUE, length);
74 static void
75 test_incremental_nobreak (gconstpointer d)
77 gint length = GPOINTER_TO_INT (d);
79 test_incremental (FALSE, length);
82 static void
83 test_full (gconstpointer d)
85 gint length = GPOINTER_TO_INT (d);
86 char *text;
87 guchar *data2;
88 gsize len;
90 text = g_base64_encode (data, length);
91 data2 = g_base64_decode (text, &len);
92 g_free (text);
94 g_assert_cmpmem (data, length, data2, len);
96 g_free (data2);
99 struct MyRawData
101 gint length; /* of data */
102 guchar data[DATA_SIZE];
105 /* 100 pre-encoded string from data[] buffer. Data length from 1..100
107 static const char *ok_100_encode_strs[] = {
108 "AA==",
109 "AAE=",
110 "AAEC",
111 "AAECAw==",
112 "AAECAwQ=",
113 "AAECAwQF",
114 "AAECAwQFBg==",
115 "AAECAwQFBgc=",
116 "AAECAwQFBgcI",
117 "AAECAwQFBgcICQ==",
118 "AAECAwQFBgcICQo=",
119 "AAECAwQFBgcICQoL",
120 "AAECAwQFBgcICQoLDA==",
121 "AAECAwQFBgcICQoLDA0=",
122 "AAECAwQFBgcICQoLDA0O",
123 "AAECAwQFBgcICQoLDA0ODw==",
124 "AAECAwQFBgcICQoLDA0ODxA=",
125 "AAECAwQFBgcICQoLDA0ODxAR",
126 "AAECAwQFBgcICQoLDA0ODxAREg==",
127 "AAECAwQFBgcICQoLDA0ODxAREhM=",
128 "AAECAwQFBgcICQoLDA0ODxAREhMU",
129 "AAECAwQFBgcICQoLDA0ODxAREhMUFQ==",
130 "AAECAwQFBgcICQoLDA0ODxAREhMUFRY=",
131 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYX",
132 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGA==",
133 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBk=",
134 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBka",
135 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGw==",
136 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxw=",
137 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwd",
138 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHg==",
139 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8=",
140 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8g",
141 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gIQ==",
142 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISI=",
143 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIj",
144 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJA==",
145 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCU=",
146 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUm",
147 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJw==",
148 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJyg=",
149 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygp",
150 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKg==",
151 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKis=",
152 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKiss",
153 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLQ==",
154 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4=",
155 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4v",
156 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMA==",
157 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDE=",
158 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEy",
159 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMw==",
160 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ=",
161 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1",
162 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Ng==",
163 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc=",
164 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4",
165 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OQ==",
166 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo=",
167 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7",
168 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PA==",
169 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0=",
170 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+",
171 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+Pw==",
172 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0A=",
173 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BB",
174 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQg==",
175 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkM=",
176 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNE",
177 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERQ==",
178 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUY=",
179 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZH",
180 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSA==",
181 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSEk=",
182 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElK",
183 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKSw==",
184 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0w=",
185 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xN",
186 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTg==",
187 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk8=",
188 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9Q",
189 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUQ==",
190 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVI=",
191 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJT",
192 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVA==",
193 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFU=",
194 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVW",
195 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWVw==",
196 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1g=",
197 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZ",
198 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWg==",
199 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWls=",
200 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltc",
201 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXQ==",
202 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV4=",
203 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5f",
204 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYA==",
205 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGE=",
206 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFi",
207 "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiYw==",
208 NULL
211 static void
212 generate_databuffer_for_base64 (struct MyRawData *p)
214 int i;
215 for (i = 0; i < DATA_SIZE; i++)
216 p->data[i] = i;
219 static void
220 test_base64_encode (void)
222 int i;
223 gint length = 1;
224 char *text;
225 struct MyRawData myraw;
227 generate_databuffer_for_base64 (&myraw);
229 for (i = 0; ok_100_encode_strs[i]; i++)
231 length = i + 1;
232 text = g_base64_encode (myraw.data, length);
233 g_assert_cmpstr (text, ==, ok_100_encode_strs[i]);
234 /* printf ("\"%s\",\n",text); */
235 g_free (text);
240 static void
241 decode_and_compare (const gchar *datap,
242 const struct MyRawData *p)
244 guchar *data2;
245 gsize len;
247 data2 = g_base64_decode (datap, &len);
248 g_assert_cmpmem (p->data, p->length, data2, len);
249 g_free (data2);
252 static void
253 decode_inplace_and_compare (const gchar *datap,
254 const struct MyRawData *p)
256 gchar *data;
257 guchar *data2;
258 gsize len;
260 data = g_strdup (datap);
261 data2 = g_base64_decode_inplace (data, &len);
262 g_assert_cmpmem (p->data, p->length, data2, len);
263 g_free (data2);
266 static void
267 test_base64_decode (void)
269 int i;
270 struct MyRawData myraw;
272 generate_databuffer_for_base64 (&myraw);
274 for (i = 0; ok_100_encode_strs[i]; i++)
276 myraw.length = i + 1;
277 decode_and_compare (ok_100_encode_strs[i], &myraw);
281 static void
282 test_base64_decode_inplace (void)
284 int i;
285 struct MyRawData myraw;
287 generate_databuffer_for_base64 (&myraw);
289 for (i = 0; ok_100_encode_strs[i]; i++)
291 myraw.length = i + 1;
292 decode_inplace_and_compare (ok_100_encode_strs[i], &myraw);
296 static void
297 test_base64_encode_decode (void)
299 int i;
300 char *text;
301 struct MyRawData myraw;
303 generate_databuffer_for_base64 (&myraw);
305 for (i = 0; i < DATA_SIZE; i++)
307 myraw.length = i + 1;
308 text = g_base64_encode (myraw.data, myraw.length);
310 decode_and_compare (text, &myraw);
312 g_free (text);
316 static void
317 test_base64_decode_smallblock (gconstpointer blocksize_p)
319 const guint blocksize = GPOINTER_TO_UINT (blocksize_p);
320 guint i;
322 for (i = 0; ok_100_encode_strs[i]; i++)
324 const char *str = ok_100_encode_strs[i];
325 const char *p;
326 gsize len = strlen (str);
327 gint state = 0;
328 guint save = 0;
329 guchar *decoded;
330 gsize decoded_size = 0;
331 guchar *decoded_atonce;
332 gsize decoded_atonce_size = 0;
334 decoded = g_malloc (len / 4 * 3 + 3);
336 p = str;
337 while (len > 0)
339 int chunk_len = MIN (blocksize, len);
340 gsize size = g_base64_decode_step (p, chunk_len,
341 decoded + decoded_size,
342 &state, &save);
343 decoded_size += size;
344 len -= chunk_len;
345 p += chunk_len;
348 decoded_atonce = g_base64_decode (str, &decoded_atonce_size);
350 g_assert_cmpmem (decoded, decoded_size, decoded_atonce, decoded_atonce_size);
352 g_free (decoded);
353 g_free (decoded_atonce);
359 main (int argc, char *argv[])
361 gint i;
363 g_test_init (&argc, &argv, NULL);
365 for (i = 0; i < DATA_SIZE; i++)
366 data[i] = (guchar)i;
368 g_test_add_data_func ("/base64/full/1", GINT_TO_POINTER (DATA_SIZE), test_full);
369 g_test_add_data_func ("/base64/full/2", GINT_TO_POINTER (1), test_full);
370 g_test_add_data_func ("/base64/full/3", GINT_TO_POINTER (2), test_full);
371 g_test_add_data_func ("/base64/full/4", GINT_TO_POINTER (3), test_full);
373 g_test_add_data_func ("/base64/incremental/nobreak/1", GINT_TO_POINTER (DATA_SIZE), test_incremental_nobreak);
374 g_test_add_data_func ("/base64/incremental/break/1", GINT_TO_POINTER (DATA_SIZE), test_incremental_break);
376 g_test_add_data_func ("/base64/incremental/nobreak/2", GINT_TO_POINTER (DATA_SIZE - 1), test_incremental_nobreak);
377 g_test_add_data_func ("/base64/incremental/break/2", GINT_TO_POINTER (DATA_SIZE - 1), test_incremental_break);
379 g_test_add_data_func ("/base64/incremental/nobreak/3", GINT_TO_POINTER (DATA_SIZE - 2), test_incremental_nobreak);
380 g_test_add_data_func ("/base64/incremental/break/3", GINT_TO_POINTER (DATA_SIZE - 2), test_incremental_break);
382 g_test_add_data_func ("/base64/incremental/nobreak/4-a", GINT_TO_POINTER (1), test_incremental_nobreak);
383 g_test_add_data_func ("/base64/incremental/nobreak/4-b", GINT_TO_POINTER (2), test_incremental_nobreak);
384 g_test_add_data_func ("/base64/incremental/nobreak/4-c", GINT_TO_POINTER (3), test_incremental_nobreak);
386 g_test_add_func ("/base64/encode", test_base64_encode);
387 g_test_add_func ("/base64/decode", test_base64_decode);
388 g_test_add_func ("/base64/decode-inplace", test_base64_decode_inplace);
389 g_test_add_func ("/base64/encode-decode", test_base64_encode_decode);
391 g_test_add_data_func ("/base64/incremental/smallblock/1", GINT_TO_POINTER(1),
392 test_base64_decode_smallblock);
393 g_test_add_data_func ("/base64/incremental/smallblock/2", GINT_TO_POINTER(2),
394 test_base64_decode_smallblock);
395 g_test_add_data_func ("/base64/incremental/smallblock/3", GINT_TO_POINTER(3),
396 test_base64_decode_smallblock);
397 g_test_add_data_func ("/base64/incremental/smallblock/4", GINT_TO_POINTER(4),
398 test_base64_decode_smallblock);
400 return g_test_run ();