Debian Codegraph @

tests/wp/spa-pod.c

raw
1 /* WirePlumber
2 *
3 * Copyright © 2020 Collabora Ltd.
4 * @author Julian Bouzas <[email protected]>
5 *
6 * SPDX-License-Identifier: MIT
7 */
8
9 #include "../common/test-log.h"
10
11 static void
12 test_spa_pod_basic (void)
13 {
14 /* None */
15 {
16 g_autoptr (WpSpaPod) pod = wp_spa_pod_new_none ();
17 g_assert_nonnull (pod);
18 g_assert_true (wp_spa_pod_is_none (pod));
19 g_assert_false (wp_spa_pod_is_id (pod));
20 g_assert_cmpstr ("Spa:None", ==,
21 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
22 g_autoptr (WpSpaPod) other = wp_spa_pod_new_none ();
23 g_assert_true (wp_spa_pod_equal (pod, other));
24 }
25
26 /* Boolean */
27 {
28 g_autoptr (WpSpaPod) copy = NULL;
29 g_assert_null (copy);
30
31 {
32 g_autoptr (WpSpaPod) pod = wp_spa_pod_new_boolean (TRUE);
33 g_assert_nonnull (pod);
34 g_assert_true (wp_spa_pod_is_boolean (pod));
35 gboolean value = FALSE;
36 g_assert_true (wp_spa_pod_get_boolean (pod, &value));
37 g_assert_true (value);
38 g_assert_cmpstr ("Spa:Bool", ==,
39 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
40 g_assert_true (wp_spa_pod_set_boolean (pod, FALSE));
41 g_assert_true (wp_spa_pod_get_boolean (pod, &value));
42 g_assert_false (value);
43
44 copy = wp_spa_pod_copy (pod);
45 }
46
47 g_assert_nonnull (copy);
48 g_assert_true (wp_spa_pod_is_boolean (copy));
49 gboolean value = FALSE;
50 g_assert_true (wp_spa_pod_get_boolean (copy, &value));
51 g_assert_false (value);
52 g_assert_cmpstr ("Spa:Bool", ==,
53 wp_spa_type_name (wp_spa_pod_get_spa_type (copy)));
54 g_autoptr (WpSpaPod) other = wp_spa_pod_new_boolean (TRUE);
55 g_assert_true (wp_spa_pod_set_pod (copy, other));
56 g_assert_true (wp_spa_pod_get_boolean (copy, &value));
57 g_assert_true (value);
58 g_assert_true (wp_spa_pod_equal (copy, other));
59 }
60
61 /* Id */
62 {
63 g_autoptr (WpSpaPod) pod = wp_spa_pod_new_id (5);
64 g_assert_nonnull (pod);
65 g_assert_true (wp_spa_pod_is_id (pod));
66 guint32 value = 0;
67 g_assert_true (wp_spa_pod_get_id (pod, &value));
68 g_assert_cmpuint (value, ==, 5);
69 g_assert_cmpstr ("Spa:Id", ==,
70 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
71 g_assert_true (wp_spa_pod_set_id (pod, 10));
72 g_assert_true (wp_spa_pod_get_id (pod, &value));
73 g_assert_cmpuint (value, ==, 10);
74 g_autoptr (WpSpaPod) other = wp_spa_pod_new_id (20);
75 g_assert_true (wp_spa_pod_set_pod (pod, other));
76 g_assert_true (wp_spa_pod_get_id (pod, &value));
77 g_assert_cmpuint (value, ==, 20);
78 g_assert_true (wp_spa_pod_equal (pod, other));
79 }
80
81 /* Int */
82 {
83 g_autoptr (WpSpaPod) pod = wp_spa_pod_new_int (-12);
84 g_assert_nonnull (pod);
85 g_assert_true (wp_spa_pod_is_int (pod));
86 gint32 value = 0;
87 g_assert_true (wp_spa_pod_get_int (pod, &value));
88 g_assert_cmpint (value, ==, -12);
89 g_assert_cmpstr ("Spa:Int", ==,
90 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
91 g_assert_true (wp_spa_pod_set_int (pod, 9999));
92 g_assert_true (wp_spa_pod_get_int (pod, &value));
93 g_assert_cmpint (value, ==, 9999);
94 g_autoptr (WpSpaPod) other = wp_spa_pod_new_int (1000);
95 g_assert_true (wp_spa_pod_set_pod (pod, other));
96 g_assert_true (wp_spa_pod_get_int (pod, &value));
97 g_assert_cmpuint (value, ==, 1000);
98 g_assert_true (wp_spa_pod_equal (pod, other));
99 }
100
101 /* Long */
102 {
103 g_autoptr (WpSpaPod) pod = wp_spa_pod_new_long (LONG_MAX);
104 g_assert_nonnull (pod);
105 g_assert_true (wp_spa_pod_is_long (pod));
106 gint64 value = 0;
107 g_assert_true (wp_spa_pod_get_long (pod, &value));
108 g_assert_cmpint (value, ==, LONG_MAX);
109 g_assert_cmpstr ("Spa:Long", ==,
110 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
111 g_assert_true (wp_spa_pod_set_long (pod, LONG_MIN));
112 g_assert_true (wp_spa_pod_get_long (pod, &value));
113 g_assert_cmpuint (value, ==, LONG_MIN);
114 g_autoptr (WpSpaPod) other = wp_spa_pod_new_long (0);
115 g_assert_true (wp_spa_pod_set_pod (pod, other));
116 g_assert_true (wp_spa_pod_get_long (pod, &value));
117 g_assert_cmpuint (value, ==, 0);
118 g_assert_true (wp_spa_pod_equal (pod, other));
119 }
120
121 /* Float */
122 {
123 g_autoptr (WpSpaPod) pod = wp_spa_pod_new_float (3.14);
124 g_assert_nonnull (pod);
125 g_assert_true (wp_spa_pod_is_float (pod));
126 float value = 0;
127 g_assert_true (wp_spa_pod_get_float (pod, &value));
128 g_assert_cmpfloat_with_epsilon (value, 3.14, 0.001);
129 g_assert_cmpstr ("Spa:Float", ==,
130 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
131 g_assert_true (wp_spa_pod_set_float (pod, 1.0));
132 g_assert_true (wp_spa_pod_get_float (pod, &value));
133 g_assert_cmpfloat_with_epsilon (value, 1.0, 0.001);
134 g_autoptr (WpSpaPod) other = wp_spa_pod_new_float (-3.14);
135 g_assert_true (wp_spa_pod_set_pod (pod, other));
136 g_assert_true (wp_spa_pod_get_float (pod, &value));
137 g_assert_cmpfloat_with_epsilon (value, -3.14, 0.001);
138 g_assert_true (wp_spa_pod_equal (pod, other));
139 }
140
141 /* Double */
142 {
143 g_autoptr (WpSpaPod) pod = wp_spa_pod_new_double (2.718281828);
144 g_assert_nonnull (pod);
145 g_assert_true (wp_spa_pod_is_double (pod));
146 double value = 0;
147 g_assert_true (wp_spa_pod_get_double (pod, &value));
148 g_assert_cmpfloat_with_epsilon (value, 2.718281828, 0.0000000001);
149 g_assert_cmpstr ("Spa:Double", ==,
150 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
151 g_assert_true (wp_spa_pod_set_double (pod, 2.0));
152 g_assert_true (wp_spa_pod_get_double (pod, &value));
153 g_assert_cmpfloat_with_epsilon (value, 2.0, 0.0000000001);
154 g_autoptr (WpSpaPod) other = wp_spa_pod_new_double (3.0);
155 g_assert_true (wp_spa_pod_set_pod (pod, other));
156 g_assert_true (wp_spa_pod_get_double (pod, &value));
157 g_assert_cmpfloat_with_epsilon (value, 3.0, 0.0000000001);
158 g_assert_true (wp_spa_pod_equal (pod, other));
159 }
160
161 /* String */
162 {
163 g_autoptr (WpSpaPod) pod = wp_spa_pod_new_string ("WirePlumber");
164 g_assert_nonnull (pod);
165 g_assert_true (wp_spa_pod_is_string (pod));
166 const char *value = NULL;
167 g_assert_true (wp_spa_pod_get_string (pod, &value));
168 g_assert_nonnull (value);
169 g_assert_cmpstr (value, ==, "WirePlumber");
170 g_assert_cmpstr ("Spa:String", ==,
171 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
172 g_autoptr (WpSpaPod) other = wp_spa_pod_new_string ("Other");
173 g_assert_nonnull (other);
174 g_assert_true (wp_spa_pod_set_pod (pod, other));
175 g_assert_true (wp_spa_pod_get_string (pod, &value));
176 g_assert_nonnull (value);
177 g_assert_cmpstr (value, ==, "Other");
178 g_assert_true (wp_spa_pod_equal (pod, other));
179 }
180
181 /* Bytes */
182 {
183 g_autoptr (WpSpaPod) pod = wp_spa_pod_new_bytes ("bytes", 5);
184 g_assert_nonnull (pod);
185 g_assert_true (wp_spa_pod_is_bytes (pod));
186 gconstpointer value = NULL;
187 guint32 len = 0;
188 g_assert_true (wp_spa_pod_get_bytes (pod, &value, &len));
189 g_assert_nonnull (value);
190 g_assert_cmpmem (value, len, "bytes", 5);
191 g_assert_cmpuint (len, ==, 5);
192 g_assert_cmpstr ("Spa:Bytes", ==,
193 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
194 g_autoptr (WpSpaPod) other = wp_spa_pod_new_bytes ("pod", 3);
195 g_assert_true (wp_spa_pod_set_pod (pod, other));
196 g_assert_true (wp_spa_pod_get_bytes (pod, &value, &len));
197 g_assert_nonnull (value);
198 g_assert_cmpmem (value, len, "pod", 3);
199 g_assert_cmpuint (len, ==, 3);
200 g_assert_true (wp_spa_pod_equal (pod, other));
201 }
202
203 /* Pointer */
204 {
205 gint i = 3;
206 g_autoptr (WpSpaPod) pod = wp_spa_pod_new_pointer ("Spa:Pointer:Buffer", &i);
207 g_assert_nonnull (pod);
208 g_assert_true (wp_spa_pod_is_pointer (pod));
209 gconstpointer p = NULL;
210 g_assert_true (wp_spa_pod_get_pointer (pod, &p));
211 g_assert_nonnull (p);
212 g_assert_true (p == &i);
213 g_assert_cmpint (*(gint *)p, ==, 3);
214 g_assert_cmpstr ("Spa:Pointer:Buffer", ==,
215 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
216
217 float f = 1.1;
218 g_autoptr (WpSpaPod) other = wp_spa_pod_new_pointer ("Spa:Pointer:Meta", &f);
219 g_assert_true (wp_spa_pod_set_pod (pod, other));
220 g_assert_true (wp_spa_pod_get_pointer (pod, &p));
221 g_assert_nonnull (p);
222 g_assert_true (p == &f);
223 g_assert_cmpfloat_with_epsilon (*(float *)p, 1.1, 0.01);
224 g_assert_cmpstr ("Spa:Pointer:Meta", ==,
225 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
226 g_assert_true (wp_spa_pod_equal (pod, other));
227 }
228
229 /* Fd */
230 {
231 g_autoptr (WpSpaPod) pod = wp_spa_pod_new_fd (4);
232 g_assert_nonnull (pod);
233 g_assert_true (wp_spa_pod_is_fd (pod));
234 gint64 value = 0;
235 g_assert_true (wp_spa_pod_get_fd (pod, &value));
236 g_assert_cmpint (value, ==, 4);
237 g_assert_cmpstr ("Spa:Fd", ==,
238 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
239 g_assert_true (wp_spa_pod_set_fd (pod, 1));
240 g_assert_true (wp_spa_pod_get_fd (pod, &value));
241 g_assert_cmpuint (value, ==, 1);
242 g_autoptr (WpSpaPod) other = wp_spa_pod_new_fd (10);
243 g_assert_true (wp_spa_pod_set_pod (pod, other));
244 g_assert_true (wp_spa_pod_get_fd (pod, &value));
245 g_assert_cmpuint (value, ==, 10);
246 g_assert_true (wp_spa_pod_equal (pod, other));
247 }
248
249 /* Rectangle */
250 {
251 g_autoptr (WpSpaPod) pod = wp_spa_pod_new_rectangle (1920, 1080);
252 g_assert_nonnull (pod);
253 g_assert_true (wp_spa_pod_is_rectangle (pod));
254 guint32 width = 0;
255 guint32 height = 0;
256 g_assert_true (wp_spa_pod_get_rectangle (pod, &width, &height));
257 g_assert_cmpint (width, ==, 1920);
258 g_assert_cmpint (height, ==, 1080);
259 g_assert_cmpstr ("Spa:Rectangle", ==,
260 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
261 g_assert_true (wp_spa_pod_set_rectangle (pod, 640, 480));
262 g_assert_true (wp_spa_pod_get_rectangle (pod, &width, &height));
263 g_assert_cmpint (width, ==, 640);
264 g_assert_cmpint (height, ==, 480);
265 g_autoptr (WpSpaPod) other = wp_spa_pod_new_rectangle (200, 100);
266 g_assert_true (wp_spa_pod_set_pod (pod, other));
267 g_assert_true (wp_spa_pod_get_rectangle (pod, &width, &height));
268 g_assert_cmpint (width, ==, 200);
269 g_assert_cmpint (height, ==, 100);
270 g_assert_true (wp_spa_pod_equal (pod, other));
271 }
272
273 /* Fraction */
274 {
275 g_autoptr (WpSpaPod) pod = wp_spa_pod_new_fraction (16, 9);
276 g_assert_nonnull (pod);
277 g_assert_true (wp_spa_pod_is_fraction (pod));
278 guint32 num = 0;
279 guint32 denom = 0;
280 g_assert_true (wp_spa_pod_get_fraction (pod, &num, &denom));
281 g_assert_cmpint (num, ==, 16);
282 g_assert_cmpint (denom, ==, 9);
283 g_assert_cmpstr ("Spa:Fraction", ==,
284 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
285 g_assert_true (wp_spa_pod_set_fraction (pod, 4, 3));
286 g_assert_true (wp_spa_pod_get_fraction (pod, &num, &denom));
287 g_assert_cmpint (num, ==, 4);
288 g_assert_cmpint (denom, ==, 3);
289 g_autoptr (WpSpaPod) other = wp_spa_pod_new_fraction (2, 1);
290 g_assert_true (wp_spa_pod_set_pod (pod, other));
291 g_assert_true (wp_spa_pod_get_fraction (pod, &num, &denom));
292 g_assert_cmpint (num, ==, 2);
293 g_assert_cmpint (denom, ==, 1);
294 g_assert_true (wp_spa_pod_equal (pod, other));
295 }
296 }
297
298 static void
299 test_spa_pod_choice (void)
300 {
301 /* Static Enum */
302 {
303 g_autoptr (WpSpaPod) pod = wp_spa_pod_new_choice (
304 "Enum", "i", 0, "i", 1, "i", 2, NULL);
305 g_assert_nonnull (pod);
306 g_assert_true (wp_spa_pod_is_choice (pod));
307 g_assert_cmpstr ("Spa:Pod:Choice", ==,
308 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
309 g_assert_cmpstr ("Enum", ==,
310 wp_spa_id_value_short_name (wp_spa_pod_get_choice_type (pod)));
311
312 g_autoptr (WpSpaPod) child = wp_spa_pod_get_choice_child (pod);
313 g_assert_nonnull (child);
314 g_assert_cmpstr ("Spa:Int", ==,
315 wp_spa_type_name (wp_spa_pod_get_spa_type (child)));
316 gint32 value = 1;
317 g_assert_true (wp_spa_pod_get_int (child, &value));
318 g_assert_cmpint (value, ==, 0);
319 g_assert_true (wp_spa_pod_set_int (child, 3));
320 g_assert_true (wp_spa_pod_get_int (child, &value));
321 g_assert_cmpint (value, ==, 3);
322 }
323
324 /* Static None */
325 {
326 g_autoptr (WpSpaPod) pod = wp_spa_pod_new_choice ("None", "s",
327 "default value", NULL);
328 g_assert_nonnull (pod);
329 g_assert_true (wp_spa_pod_is_choice (pod));
330 g_assert_cmpstr ("Spa:Pod:Choice", ==,
331 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
332
333 {
334 g_autoptr (WpSpaPod) child = wp_spa_pod_get_choice_child (pod);
335 g_assert_nonnull (child);
336 g_assert_cmpstr ("Spa:String", ==,
337 wp_spa_type_name (wp_spa_pod_get_spa_type (child)));
338 const char *value = NULL;
339 g_assert_true (wp_spa_pod_get_string (child, &value));
340 g_assert_nonnull (value);
341 g_assert_cmpstr ("default value", ==, value);
342 g_autoptr (WpSpaPod) str_pod = wp_spa_pod_new_string ("new value");
343 g_assert_true (wp_spa_pod_set_pod (child, str_pod));
344 g_assert_true (wp_spa_pod_get_string (child, &value));
345 g_assert_cmpstr ("new value", ==, value);
346 }
347
348 {
349 g_autoptr (WpSpaPod) child = wp_spa_pod_get_choice_child (pod);
350 g_assert_nonnull (child);
351 g_assert_cmpstr ("Spa:String", ==,
352 wp_spa_type_name (wp_spa_pod_get_spa_type (child)));
353 const char *value = NULL;
354 g_assert_true (wp_spa_pod_get_string (child, &value));
355 g_assert_nonnull (value);
356 g_assert_cmpstr ("new value", ==, value);
357 }
358 }
359
360 /* Dynamic */
361 {
362 g_autoptr (WpSpaPodBuilder) b = wp_spa_pod_builder_new_choice ("Enum");
363 wp_spa_pod_builder_add (b, "i", 0, NULL);
364 wp_spa_pod_builder_add (b, "i", 1, NULL);
365 wp_spa_pod_builder_add (b, "i", 2, NULL);
366 g_autoptr (WpSpaPod) pod = wp_spa_pod_builder_end (b);
367 g_assert_nonnull (pod);
368 g_assert_true (wp_spa_pod_is_choice (pod));
369 g_assert_cmpstr ("Spa:Pod:Choice", ==,
370 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
371 }
372
373 /* It is not possible to use the parser to get the contents of a choice, you
374 * need to use the iterator API to achieve that. This is because there is no
375 * `spa_pod_parser_get_choice` API in the SPA library */
376 }
377
378 static void
379 test_spa_pod_array (void)
380 {
381 /* Dynamic */
382 {
383 WpSpaPodBuilder *b = wp_spa_pod_builder_new_array ();
384 wp_spa_pod_builder_add (b, "b", FALSE, NULL);
385 wp_spa_pod_builder_add (b, "b", TRUE, NULL);
386 wp_spa_pod_builder_add (b, "b", TRUE, NULL);
387 wp_spa_pod_builder_add (b, "b", FALSE, NULL);
388 wp_spa_pod_builder_add (b, "b", TRUE, NULL);
389 g_autoptr (WpSpaPod) pod = wp_spa_pod_builder_end (b);
390 g_assert_nonnull (pod);
391 g_assert_true (wp_spa_pod_is_array (pod));
392 g_assert_cmpstr ("Spa:Array", ==,
393 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
394 wp_spa_pod_builder_unref (b);
395 g_assert_true (wp_spa_pod_is_array (pod));
396
397 g_autoptr (WpSpaPod) child = wp_spa_pod_get_array_child (pod);
398 g_assert_nonnull (child);
399 g_assert_cmpstr ("Spa:Bool", ==,
400 wp_spa_type_name (wp_spa_pod_get_spa_type (child)));
401 gboolean value = TRUE;
402 g_assert_true (wp_spa_pod_get_boolean (child, &value));
403 g_assert_false (value);
404 }
405
406 /* It is not possible to use the parser to get the contents of an array, you
407 * need to use the iterator API to achieve that. This is because there is no
408 * `spa_pod_parser_get_array` API in the SPA library. */
409 }
410
411 static void
412 test_spa_pod_object (void)
413 {
414 /* Static */
415 {
416 g_autoptr (WpSpaPod) pod = wp_spa_pod_new_object (
417 "Spa:Pod:Object:Param:Props", "Props",
418 "mute", "b", FALSE,
419 "volume", "f", 0.5,
420 "frequency", "i", 440,
421 "device", "s", "device-name",
422 "deviceFd", "h", 5,
423 "id-01000000", "b", TRUE,
424 NULL);
425 g_assert_nonnull (pod);
426 g_assert_true (wp_spa_pod_is_object (pod));
427 g_assert_cmpstr ("Spa:Pod:Object:Param:Props", ==,
428 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
429
430 const char *id_name;
431 gboolean mute = TRUE;
432 float vol = 0.0;
433 gint32 frequency;
434 const char *device;
435 gint64 device_fd;
436 gboolean custom = FALSE;
437 g_assert_true (wp_spa_pod_get_object (pod,
438 &id_name,
439 "mute", "b", &mute,
440 "volume", "f", &vol,
441 "frequency", "i", &frequency,
442 "device", "s", &device,
443 "deviceFd", "h", &device_fd,
444 "id-01000000", "b", &custom,
445 NULL));
446 g_assert_cmpstr (id_name, ==, "Props");
447 g_assert_false (mute);
448 g_assert_cmpfloat_with_epsilon (vol, 0.5, 0.01);
449 g_assert_cmpint (frequency, ==, 440);
450 g_assert_cmpstr (device, ==, "device-name");
451 g_assert_cmpint (device_fd, ==, 5);
452 g_assert_true (custom);
453 }
454
455 /* Dynamic */
456 {
457 g_autoptr (WpSpaPodBuilder) b = wp_spa_pod_builder_new_object (
458 "Spa:Pod:Object:Param:Props", "Props");
459 wp_spa_pod_builder_add_property (b, "mute");
460 wp_spa_pod_builder_add_boolean (b, FALSE);
461 wp_spa_pod_builder_add_property (b, "volume");
462 wp_spa_pod_builder_add_float (b, 0.5);
463 wp_spa_pod_builder_add_property (b, "frequency");
464 wp_spa_pod_builder_add_int (b, 440);
465 wp_spa_pod_builder_add_property (b, "device");
466 wp_spa_pod_builder_add_string (b, "device-name");
467 wp_spa_pod_builder_add_property (b, "deviceFd");
468 wp_spa_pod_builder_add_fd (b, 5);
469 wp_spa_pod_builder_add_property (b, "id-01000000");
470 wp_spa_pod_builder_add_boolean (b, TRUE);
471 g_autoptr (WpSpaPod) pod = wp_spa_pod_builder_end (b);
472 g_assert_nonnull (pod);
473 g_assert_true (wp_spa_pod_is_object (pod));
474 g_assert_cmpstr ("Spa:Pod:Object:Param:Props", ==,
475 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
476
477 const char *id_name;
478 gboolean mute = TRUE;
479 float vol = 0.0;
480 gint32 frequency;
481 const char *device;
482 gint64 device_fd;
483 gboolean custom = FALSE;
484 g_autoptr (WpSpaPodParser) p = wp_spa_pod_parser_new_object (pod, &id_name);
485 g_assert_nonnull (pod);
486 g_assert_true (wp_spa_pod_parser_get (p, "mute", "b", &mute, NULL));
487 g_assert_true (wp_spa_pod_parser_get (p, "volume", "f", &vol, NULL));
488 g_assert_true (wp_spa_pod_parser_get (p, "frequency", "i", &frequency, NULL));
489 g_assert_true (wp_spa_pod_parser_get (p, "device", "s", &device, NULL));
490 g_assert_true (wp_spa_pod_parser_get (p, "deviceFd", "h", &device_fd, NULL));
491 g_assert_true (wp_spa_pod_parser_get (p, "id-01000000", "b", &custom, NULL));
492 wp_spa_pod_parser_end (p);
493 g_assert_cmpstr (id_name, ==, "Props");
494 g_assert_false (mute);
495 g_assert_cmpfloat_with_epsilon (vol, 0.5, 0.01);
496 g_assert_cmpint (frequency, ==, 440);
497 g_assert_cmpstr (device, ==, "device-name");
498 g_assert_cmpint (device_fd, ==, 5);
499 g_assert_true (custom);
500 }
501 }
502
503 static void
504 test_spa_pod_struct (void)
505 {
506 /* Dynamic */
507 {
508 g_autoptr (WpSpaPodBuilder) b = wp_spa_pod_builder_new_struct ();
509 wp_spa_pod_builder_add_boolean (b, TRUE);
510 wp_spa_pod_builder_add_id (b, 2);
511 wp_spa_pod_builder_add_int (b, 8);
512 wp_spa_pod_builder_add_long (b, 64);
513 wp_spa_pod_builder_add_float (b, 3.14);
514 wp_spa_pod_builder_add_double (b, 2.718281828);
515 wp_spa_pod_builder_add_string (b, "WirePlumber");
516 wp_spa_pod_builder_add_bytes (b, "bytes", 5);
517 wp_spa_pod_builder_add_pointer (b, "Spa:Pointer:Buffer", b);
518 wp_spa_pod_builder_add_fd (b, 4);
519 wp_spa_pod_builder_add_rectangle (b, 1920, 1080);
520 wp_spa_pod_builder_add_fraction (b, 16, 9);
521 {
522 g_autoptr (WpSpaPod) pod = wp_spa_pod_new_int (35254);
523 wp_spa_pod_builder_add_pod (b, pod);
524 }
525 {
526 g_autoptr (WpSpaPod) pod = wp_spa_pod_new_object (
527 "Spa:Pod:Object:Param:Props", "Props",
528 "mute", "b", FALSE,
529 NULL);
530 wp_spa_pod_builder_add (b, "P", pod, NULL);
531 }
532 g_autoptr (WpSpaPod) pod = wp_spa_pod_builder_end (b);
533 g_assert_nonnull (pod);
534 g_assert_true (wp_spa_pod_is_struct (pod));
535 g_assert_cmpstr ("Spa:Pod:Struct", ==,
536 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
537
538 g_autoptr (WpSpaPodParser) p = wp_spa_pod_parser_new_struct (pod);
539 g_assert_nonnull (pod);
540
541 gboolean value_boolean;
542 g_assert_true (wp_spa_pod_parser_get_boolean (p, &value_boolean));
543 g_assert_true (value_boolean);
544
545 guint32 value_id;
546 g_assert_true (wp_spa_pod_parser_get_id (p, &value_id));
547 g_assert_cmpuint (value_id, ==, 2);
548
549 gint32 value_int;
550 g_assert_true (wp_spa_pod_parser_get_int (p, &value_int));
551 g_assert_cmpint (value_int, ==, 8);
552
553 gint64 value_long;
554 g_assert_true (wp_spa_pod_parser_get_long (p, &value_long));
555 g_assert_cmpint (value_long, ==, 64);
556
557 float value_float;
558 g_assert_true (wp_spa_pod_parser_get_float (p, &value_float));
559 g_assert_cmpfloat_with_epsilon (value_float, 3.14, 0.001);
560
561 double value_double;
562 g_assert_true (wp_spa_pod_parser_get_double (p, &value_double));
563 g_assert_cmpfloat_with_epsilon (value_double, 2.718281828, 0.0000000001);
564
565 const char *value_string;
566 g_assert_true (wp_spa_pod_parser_get_string (p, &value_string));
567 g_assert_cmpstr (value_string, ==, "WirePlumber");
568
569 gconstpointer value_bytes;
570 guint32 len_bytes;
571 g_assert_true (wp_spa_pod_parser_get_bytes (p, &value_bytes, &len_bytes));
572 g_assert_cmpmem (value_bytes, len_bytes, "bytes", 5);
573 g_assert_cmpuint (len_bytes, ==, 5);
574
575 gconstpointer value_pointer;
576 g_assert_true (wp_spa_pod_parser_get_pointer (p, &value_pointer));
577 g_assert_nonnull (value_pointer);
578 g_assert_true (value_pointer == b);
579
580 gint64 value_fd;
581 g_assert_true (wp_spa_pod_parser_get_fd (p, &value_fd));
582 g_assert_cmpint (value_fd, ==, 4);
583
584 guint32 value_width;
585 guint32 value_height;
586 g_assert_true (wp_spa_pod_parser_get_rectangle (p, &value_width, &value_height));
587 g_assert_cmpuint (value_width, ==, 1920);
588 g_assert_cmpuint (value_height, ==, 1080);
589
590 guint32 value_num;
591 guint32 value_denom;
592 g_assert_true (wp_spa_pod_parser_get_fraction (p, &value_num, &value_denom));
593 g_assert_cmpuint (value_num, ==, 16);
594 g_assert_cmpuint (value_denom, ==, 9);
595
596 g_autoptr (WpSpaPod) value_pod = wp_spa_pod_parser_get_pod (p);
597 g_assert_nonnull (value_pod);
598 gint value_pod_int;
599 g_assert_true (wp_spa_pod_get_int (value_pod, &value_pod_int));
600 g_assert_cmpint (value_pod_int, ==, 35254);
601
602 g_autoptr (WpSpaPod) value_object = NULL;
603 g_assert_true (wp_spa_pod_parser_get (p, "P", &value_object, NULL));
604 g_assert_nonnull (value_object);
605 const char *id_name;
606 gboolean mute = TRUE;
607
608 g_assert_true (wp_spa_pod_get_object (value_object,
609 &id_name,
610 "mute", "b", &mute,
611 NULL));
612 g_assert_cmpstr (id_name, ==, "Props");
613 g_assert_false (mute);
614 }
615 }
616
617 static void
618 test_spa_pod_sequence (void)
619 {
620 /* Static */
621 {
622 g_autoptr (WpSpaPod) pod = wp_spa_pod_new_sequence (0,
623 10, "Properties", "l", G_GINT64_CONSTANT (9999), NULL);
624 g_assert_nonnull (pod);
625 g_assert_true (wp_spa_pod_is_sequence (pod));
626 g_assert_cmpstr ("Spa:Pod:Sequence", ==,
627 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
628 }
629
630 /* Dynamic */
631 {
632 g_autoptr (WpSpaPodBuilder) b = wp_spa_pod_builder_new_sequence (0);
633 wp_spa_pod_builder_add_control (b, 10, "Properties");
634 wp_spa_pod_builder_add_long (b, G_GINT64_CONSTANT (9999));
635 g_autoptr (WpSpaPod) pod = wp_spa_pod_builder_end (b);
636 g_assert_nonnull (pod);
637 g_assert_true (wp_spa_pod_is_sequence (pod));
638 g_assert_cmpstr ("Spa:Pod:Sequence", ==,
639 wp_spa_type_name (wp_spa_pod_get_spa_type (pod)));
640 }
641
642 /* It is not possible to use the parser to get the contents of a sequence, you
643 * need to use the iterator API to achieve that. This is because there is no
644 * `spa_pod_parser_get_sequence` API in the SPA library. */
645 }
646
647 static void
648 choice_foreach (const GValue *item, gpointer data)
649 {
650 gint32 *total = data;
651 const gint32 *value = g_value_get_pointer (item);
652 *total += *value;
653 }
654
655 static void
656 array_foreach (const GValue *item, gpointer data)
657 {
658 gint32 *total = data;
659 const gint32 *value = g_value_get_pointer (item);
660 *total += *value;
661 }
662
663 static void
664 object_foreach (const GValue *item, gpointer data)
665 {
666 guint32 *total_props = data;
667 WpSpaPod *prop = g_value_get_boxed (item);
668 g_assert_true (wp_spa_pod_is_property (prop));
669 *total_props += 1;
670 }
671
672 static void
673 struct_foreach (const GValue *item, gpointer data)
674 {
675 guint32 *total_fields = data;
676 *total_fields += 1;
677 }
678
679 static void
680 sequence_foreach (const GValue *item, gpointer data)
681 {
682 guint32 *offset_total = data;
683 WpSpaPod *control = g_value_get_boxed (item);
684 g_assert_true (wp_spa_pod_is_control (control));
685 guint32 offset = 0;
686 g_assert_true (wp_spa_pod_get_control (control, &offset, NULL, NULL));
687 *offset_total += offset;
688 }
689
690 static void
691 test_spa_pod_iterator (void)
692 {
693 /* Choice */
694 {
695 g_autoptr (WpSpaPodBuilder) b = wp_spa_pod_builder_new_choice ("Enum");
696 wp_spa_pod_builder_add (b, "i", 0, NULL);
697 wp_spa_pod_builder_add (b, "i", 1, NULL);
698 wp_spa_pod_builder_add (b, "i", 2, NULL);
699 g_autoptr (WpSpaPod) pod = wp_spa_pod_builder_end (b);
700 g_assert_nonnull (pod);
701
702 g_autoptr (WpIterator) it = wp_spa_pod_new_iterator (pod);
703 g_assert_nonnull (it);
704
705 {
706 GValue next = G_VALUE_INIT;
707 g_assert_true (wp_iterator_next (it, &next));
708 gpointer p = g_value_get_pointer (&next);
709 g_assert_nonnull (p);
710 g_assert_cmpint (*(gint *)p, ==, 0);
711 g_value_unset (&next);
712 }
713
714 {
715 GValue next = G_VALUE_INIT;
716 g_assert_true (wp_iterator_next (it, &next));
717 gpointer p = g_value_get_pointer (&next);
718 g_assert_nonnull (p);
719 g_assert_cmpint (*(gint *)p, ==, 1);
720 g_value_unset (&next);
721 }
722
723 {
724 GValue next = G_VALUE_INIT;
725 g_assert_true (wp_iterator_next (it, &next));
726 gpointer p = g_value_get_pointer (&next);
727 g_assert_nonnull (p);
728 g_assert_cmpint (*(gint *)p, ==, 2);
729 g_value_unset (&next);
730 }
731
732 {
733 g_assert_false (wp_iterator_next (it, NULL));
734 }
735
736 gint32 total = 0;
737 g_assert_true (wp_iterator_foreach (it, choice_foreach, &total));
738 g_assert_cmpint (total, ==, 3);
739
740 }
741
742 /* Array */
743 {
744 g_autoptr (WpSpaPodBuilder) b = wp_spa_pod_builder_new_array ();
745 wp_spa_pod_builder_add_int (b, 1);
746 wp_spa_pod_builder_add_int (b, 2);
747 wp_spa_pod_builder_add_int (b, 3);
748 g_autoptr (WpSpaPod) pod = wp_spa_pod_builder_end (b);
749 g_assert_nonnull (pod);
750
751 g_autoptr (WpIterator) it = wp_spa_pod_new_iterator (pod);
752 g_assert_nonnull (it);
753
754 {
755 GValue next = G_VALUE_INIT;
756 g_assert_true (wp_iterator_next (it, &next));
757 gpointer p = g_value_get_pointer (&next);
758 g_assert_nonnull (p);
759 g_assert_cmpint (*(gint *)p, ==, 1);
760 g_value_unset (&next);
761 }
762
763 {
764 GValue next = G_VALUE_INIT;
765 g_assert_true (wp_iterator_next (it, &next));
766 gpointer p = g_value_get_pointer (&next);
767 g_assert_nonnull (p);
768 g_assert_cmpint (*(gint *)p, ==, 2);
769 g_value_unset (&next);
770 }
771
772 {
773 GValue next = G_VALUE_INIT;
774 g_assert_true (wp_iterator_next (it, &next));
775 gpointer p = g_value_get_pointer (&next);
776 g_assert_nonnull (p);
777 g_assert_cmpint (*(gint *)p, ==, 3);
778 g_value_unset (&next);
779 }
780
781 {
782 g_assert_false (wp_iterator_next (it, NULL));
783 }
784
785 gint total = 0;
786 g_assert_true (wp_iterator_foreach (it, array_foreach, &total));
787 g_assert_cmpint (total, ==, 6);
788 }
789
790 /* Object */
791 {
792 g_autoptr (WpSpaPodBuilder) b = wp_spa_pod_builder_new_object (
793 "Spa:Pod:Object:Param:Props", "Props");
794 wp_spa_pod_builder_add_property (b, "mute");
795 wp_spa_pod_builder_add_boolean (b, FALSE);
796 wp_spa_pod_builder_add_property (b, "device");
797 wp_spa_pod_builder_add_string (b, "device-name");
798 wp_spa_pod_builder_add_property (b, "id-01000000");
799 wp_spa_pod_builder_add_boolean (b, TRUE);
800 g_autoptr (WpSpaPod) pod = wp_spa_pod_builder_end (b);
801 g_assert_nonnull (pod);
802
803 g_autoptr (WpIterator) it = wp_spa_pod_new_iterator (pod);
804 g_assert_nonnull (it);
805
806 {
807 GValue next = G_VALUE_INIT;
808 g_assert_true (wp_iterator_next (it, &next));
809 WpSpaPod *p = g_value_get_boxed (&next);
810 g_assert_nonnull (p);
811 g_assert_true (wp_spa_pod_is_property (p));
812 const char *key = NULL;
813 g_autoptr (WpSpaPod) value = NULL;
814 g_assert_true (wp_spa_pod_get_property (p, &key, &value));
815 g_assert_cmpstr (key, ==, "mute");
816 gboolean b = TRUE;
817 g_assert_true (wp_spa_pod_get_boolean (value, &b));
818 g_assert_false (b);
819 g_value_unset (&next);
820 }
821
822 {
823 GValue next = G_VALUE_INIT;
824 g_assert_true (wp_iterator_next (it, &next));
825 WpSpaPod *p = g_value_get_boxed (&next);
826 g_assert_nonnull (p);
827 g_assert_true (wp_spa_pod_is_property (p));
828 const char *key = NULL;
829 g_autoptr (WpSpaPod) value = NULL;
830 g_assert_true (wp_spa_pod_get_property (p, &key, &value));
831 g_assert_cmpstr (key, ==, "device");
832 const char *s = NULL;
833 g_assert_true (wp_spa_pod_get_string (value, &s));
834 g_assert_cmpstr (s, ==, "device-name");
835 g_value_unset (&next);
836 }
837
838 {
839 GValue next = G_VALUE_INIT;
840 g_assert_true (wp_iterator_next (it, &next));
841 WpSpaPod *p = g_value_get_boxed (&next);
842 g_assert_nonnull (p);
843 g_assert_true (wp_spa_pod_is_property (p));
844 const char *key = NULL;
845 g_autoptr (WpSpaPod) value = NULL;
846 g_assert_true (wp_spa_pod_get_property (p, &key, &value));
847 g_assert_cmpstr (key, ==, "id-01000000");
848 gboolean b = FALSE;
849 g_assert_true (wp_spa_pod_get_boolean (value, &b));
850 g_assert_true (b);
851 g_value_unset (&next);
852 }
853
854 {
855 g_assert_false (wp_iterator_next (it, NULL));
856 }
857
858 guint32 total_props = 0;
859 g_assert_true (wp_iterator_foreach (it, object_foreach, &total_props));
860 g_assert_cmpuint (total_props, ==, 3);
861 }
862
863 /* Struct */
864 {
865 g_autoptr (WpSpaPodBuilder) b = wp_spa_pod_builder_new_struct ();
866 wp_spa_pod_builder_add_boolean (b, TRUE);
867 wp_spa_pod_builder_add_id (b, 2);
868 wp_spa_pod_builder_add_int (b, 8);
869 g_autoptr (WpSpaPod) pod = wp_spa_pod_builder_end (b);
870 g_assert_nonnull (pod);
871
872 g_autoptr (WpIterator) it = wp_spa_pod_new_iterator (pod);
873 g_assert_nonnull (it);
874
875 {
876 GValue next = G_VALUE_INIT;
877 g_assert_true (wp_iterator_next (it, &next));
878 WpSpaPod *p = g_value_get_boxed (&next);
879 g_assert_nonnull (p);
880 gboolean v = FALSE;
881 g_assert_true (wp_spa_pod_get_boolean (p, &v));
882 g_assert_true (v);
883 g_value_unset (&next);
884 }
885
886 {
887 GValue next = G_VALUE_INIT;
888 g_assert_true (wp_iterator_next (it, &next));
889 WpSpaPod *p = g_value_get_boxed (&next);
890 g_assert_nonnull (p);
891 guint32 v = 0;
892 g_assert_true (wp_spa_pod_get_id (p, &v));
893 g_assert_cmpuint (v, ==, 2);
894 g_value_unset (&next);
895 }
896
897 {
898 GValue next = G_VALUE_INIT;
899 g_assert_true (wp_iterator_next (it, &next));
900 WpSpaPod *p = g_value_get_boxed (&next);
901 g_assert_nonnull (p);
902 gint v = 0;
903 g_assert_true (wp_spa_pod_get_int (p, &v));
904 g_assert_cmpint (v, ==, 8);
905 g_value_unset (&next);
906 }
907
908 {
909 g_assert_false (wp_iterator_next (it, NULL));
910 }
911
912 guint32 total_fields = 0;
913 g_assert_true (wp_iterator_foreach (it, struct_foreach, &total_fields));
914 g_assert_cmpuint (total_fields, ==, 3);
915 }
916
917 /* Sequence */
918 {
919 g_autoptr (WpSpaPodBuilder) b = wp_spa_pod_builder_new_sequence (0);
920 wp_spa_pod_builder_add_control (b, 10, "Properties");
921 wp_spa_pod_builder_add_float (b, 0.33);
922 wp_spa_pod_builder_add_control (b, 40, "Properties");
923 wp_spa_pod_builder_add_float (b, 0.66);
924 g_autoptr (WpSpaPod) pod = wp_spa_pod_builder_end (b);
925 g_assert_nonnull (pod);
926
927 g_autoptr (WpIterator) it = wp_spa_pod_new_iterator (pod);
928 g_assert_nonnull (it);
929
930 {
931 GValue next = G_VALUE_INIT;
932 g_assert_true (wp_iterator_next (it, &next));
933 WpSpaPod *p = g_value_get_boxed (&next);
934 g_assert_nonnull (p);
935 g_assert_true (wp_spa_pod_is_control (p));
936 guint32 offset = 0;
937 const char *type_name = NULL;
938 g_autoptr (WpSpaPod) value = NULL;
939 g_assert_true (wp_spa_pod_get_control (p, &offset, &type_name, &value));
940 g_assert_cmpuint (offset, ==, 10);
941 g_assert_cmpstr (type_name, ==, "Properties");
942 float f = 0;
943 g_assert_true (wp_spa_pod_get_float (value, &f));
944 g_assert_cmpfloat_with_epsilon (f, 0.33, 0.001);
945 g_value_unset (&next);
946 }
947
948 {
949 GValue next = G_VALUE_INIT;
950 g_assert_true (wp_iterator_next (it, &next));
951 WpSpaPod *p = g_value_get_boxed (&next);
952 g_assert_nonnull (p);
953 g_assert_true (wp_spa_pod_is_control (p));
954 guint32 offset = 0;
955 const char *type_name = NULL;
956 g_autoptr (WpSpaPod) value = NULL;
957 g_assert_true (wp_spa_pod_get_control (p, &offset, &type_name, &value));
958 g_assert_cmpuint (offset, ==, 40);
959 g_assert_cmpstr (type_name, ==, "Properties");
960 float f = 0;
961 g_assert_true (wp_spa_pod_get_float (value, &f));
962 g_assert_cmpfloat_with_epsilon (f, 0.66, 0.001);
963 g_value_unset (&next);
964 }
965
966 {
967 g_assert_false (wp_iterator_next (it, NULL));
968 }
969
970 guint32 offset_total = 0;
971 g_assert_true (wp_iterator_foreach (it, sequence_foreach, &offset_total));
972 g_assert_cmpuint (offset_total, ==, 50);
973 }
974 }
975
976 static void
977 test_spa_pod_unique_owner (void)
978 {
979 /* Create an object */
980 WpSpaPod *pod = wp_spa_pod_new_object (
981 "Spa:Pod:Object:Param:PropInfo", "PropInfo",
982 "id", "K", "unknown",
983 "name", "s", "prop-info-name",
984 NULL);
985 g_assert_nonnull (pod);
986 g_assert_true (wp_spa_pod_is_unique_owner (pod));
987
988 /* Get the first property using an iterator */
989 GValue next = G_VALUE_INIT;
990 g_autoptr (WpSpaPod) property = NULL;
991 {
992 g_autoptr (WpIterator) it = wp_spa_pod_new_iterator (pod);
993 g_assert_nonnull (it);
994 g_assert_true (wp_iterator_next (it, &next));
995 property = g_value_dup_boxed (&next);
996 }
997 g_assert_nonnull (property);
998 g_assert_true (wp_spa_pod_is_property (property));
999 {
1000 g_autoptr (WpSpaPod) value = NULL;
1001 const char *key = NULL;
1002 g_assert_true (wp_spa_pod_get_property (property, &key, &value));
1003 g_assert_nonnull (key);
1004 g_assert_cmpstr (key, ==, "id");
1005 g_assert_nonnull (value);
1006 guint32 id = 0;
1007 g_assert_true (wp_spa_pod_get_id (value, &id));
1008 g_assert_cmpuint (id, ==, 1);
1009 }
1010
1011 /* Own the data */
1012 g_assert_true (wp_spa_pod_is_unique_owner (pod));
1013 g_assert_false (wp_spa_pod_is_unique_owner (property));
1014 property = wp_spa_pod_ensure_unique_owner (property);
1015 g_assert_true (wp_spa_pod_is_unique_owner (pod));
1016 g_assert_true (wp_spa_pod_is_unique_owner (property));
1017
1018 /* Destroy the object */
1019 wp_spa_pod_unref (pod);
1020 g_assert_true (wp_spa_pod_is_unique_owner (property));
1021
1022 /* Make sure the property data is still valid */
1023 {
1024 g_autoptr (WpSpaPod) value = NULL;
1025 const char *key = NULL;
1026 g_assert_true (wp_spa_pod_get_property (property, &key, &value));
1027 g_assert_nonnull (key);
1028 g_assert_cmpstr (key, ==, "id");
1029 g_assert_nonnull (value);
1030 guint32 id = 0;
1031 g_assert_true (wp_spa_pod_get_id (value, &id));
1032 g_assert_cmpuint (id, ==, 1);
1033 }
1034
1035 /* Destroy the property */
1036 g_value_unset (&next);
1037 }
1038
1039 static void
1040 test_spa_pod_port_config (void)
1041 {
1042 const gint32 rate = 48000;
1043 const gint32 channels = 2;
1044
1045 /* Build the format to make sure the types exist */
1046 g_autoptr (WpSpaPodBuilder) builder = wp_spa_pod_builder_new_object (
1047 "Spa:Pod:Object:Param:Format", "Format");
1048 wp_spa_pod_builder_add (builder,
1049 "mediaType", "K", "audio",
1050 "mediaSubtype", "K", "raw",
1051 "format", "K", "S16LE",
1052 "rate", "i", rate,
1053 "channels", "i", channels,
1054 NULL);
1055 g_autoptr (WpSpaPodBuilder) position_builder = wp_spa_pod_builder_new_array ();
1056 for (gint i = 0; i < channels; i++)
1057 wp_spa_pod_builder_add_id (position_builder, 0);
1058 wp_spa_pod_builder_add_property (builder, "position");
1059 g_autoptr (WpSpaPod) position = wp_spa_pod_builder_end (position_builder);
1060 wp_spa_pod_builder_add_pod (builder, position);
1061 g_autoptr (WpSpaPod) format = wp_spa_pod_builder_end (builder);
1062 g_assert_nonnull (format);
1063
1064 /* Build the port config to make sure the types exist */
1065 g_autoptr (WpSpaPod) pod = wp_spa_pod_new_object (
1066 "Spa:Pod:Object:Param:PortConfig", "PortConfig",
1067 "direction", "K", "Input",
1068 "mode", "K", "dsp",
1069 "monitor", "b", FALSE,
1070 "control", "b", FALSE,
1071 "format", "P", format,
1072 NULL);
1073 g_assert_nonnull (pod);
1074 }
1075
1076 int
1077 main (int argc, char *argv[])
1078 {
1079 g_test_init (&argc, &argv, NULL);
1080 g_log_set_writer_func (wp_log_writer_default, NULL, NULL);
1081
1082 g_test_add_func ("/wp/spa-pod/basic", test_spa_pod_basic);
1083 g_test_add_func ("/wp/spa-pod/choice", test_spa_pod_choice);
1084 g_test_add_func ("/wp/spa-pod/array", test_spa_pod_array);
1085 g_test_add_func ("/wp/spa-pod/object", test_spa_pod_object);
1086 g_test_add_func ("/wp/spa-pod/struct", test_spa_pod_struct);
1087 g_test_add_func ("/wp/spa-pod/sequence", test_spa_pod_sequence);
1088 g_test_add_func ("/wp/spa-pod/iterator", test_spa_pod_iterator);
1089 g_test_add_func ("/wp/spa-pod/unique-owner", test_spa_pod_unique_owner);
1090 g_test_add_func ("/wp/spa-pod/port-config", test_spa_pod_port_config);
1091
1092 return g_test_run ();
1093 }