1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * SPDX-License-Identifier: LGPL-2.1-or-later
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
21 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GLib Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GLib at ftp://ftp.gtk.org/pub/gtk/.
27 #define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_30
30 #include <glib-object.h>
31 #include "gobject/gvaluecollector.h"
34 test_enum_transformation (void)
37 GValue orig = G_VALUE_INIT;
38 GValue xform = G_VALUE_INIT;
39 GEnumValue values[] = { {0,"0","0"}, {1,"1","1"}};
41 type = g_enum_register_static ("TestEnum", values);
43 g_value_init (&orig, type);
44 g_value_set_enum (&orig, 1);
46 memset (&xform, 0, sizeof (GValue));
47 g_value_init (&xform, G_TYPE_CHAR);
48 g_value_transform (&orig, &xform);
49 g_assert_cmpint (g_value_get_char (&xform), ==, 1);
50 g_assert_cmpint (g_value_get_schar (&xform), ==, 1);
52 memset (&xform, 0, sizeof (GValue));
53 g_value_init (&xform, G_TYPE_UCHAR);
54 g_value_transform (&orig, &xform);
55 g_assert_cmpint (g_value_get_uchar (&xform), ==, 1);
57 memset (&xform, 0, sizeof (GValue));
58 g_value_init (&xform, G_TYPE_INT);
59 g_value_transform (&orig, &xform);
60 g_assert_cmpint (g_value_get_int (&xform), ==, 1);
62 memset (&xform, 0, sizeof (GValue));
63 g_value_init (&xform, G_TYPE_UINT);
64 g_value_transform (&orig, &xform);
65 g_assert_cmpint (g_value_get_uint (&xform), ==, 1);
67 memset (&xform, 0, sizeof (GValue));
68 g_value_init (&xform, G_TYPE_LONG);
69 g_value_transform (&orig, &xform);
70 g_assert_cmpint (g_value_get_long (&xform), ==, 1);
72 memset (&xform, 0, sizeof (GValue));
73 g_value_init (&xform, G_TYPE_ULONG);
74 g_value_transform (&orig, &xform);
75 g_assert_cmpint (g_value_get_ulong (&xform), ==, 1);
77 memset (&xform, 0, sizeof (GValue));
78 g_value_init (&xform, G_TYPE_INT64);
79 g_value_transform (&orig, &xform);
80 g_assert_cmpint (g_value_get_int64 (&xform), ==, 1);
82 memset (&xform, 0, sizeof (GValue));
83 g_value_init (&xform, G_TYPE_UINT64);
84 g_value_transform (&orig, &xform);
85 g_assert_cmpint (g_value_get_uint64 (&xform), ==, 1);
90 test_gtype_value (void)
93 GValue value = G_VALUE_INIT;
94 GValue copy = G_VALUE_INIT;
96 g_value_init (&value, G_TYPE_GTYPE);
98 g_value_set_gtype (&value, G_TYPE_BOXED);
99 type = g_value_get_gtype (&value);
100 g_assert_true (type == G_TYPE_BOXED);
102 g_value_init (©, G_TYPE_GTYPE);
103 g_value_copy (&value, ©);
104 type = g_value_get_gtype (©);
105 g_assert_true (type == G_TYPE_BOXED);
109 collect (GValue *value, ...)
116 va_start (var_args, value);
117 G_VALUE_COLLECT (value, var_args, 0, &error);
124 lcopy (GValue *value, ...)
131 va_start (var_args, value);
132 G_VALUE_LCOPY (value, var_args, 0, &error);
139 test_collection (void)
141 GValue value = G_VALUE_INIT;
144 g_value_init (&value, G_TYPE_CHAR);
145 error = collect (&value, 'c');
146 g_assert_null (error);
147 g_assert_cmpint (g_value_get_char (&value), ==, 'c');
149 g_value_unset (&value);
150 g_value_init (&value, G_TYPE_UCHAR);
151 error = collect (&value, 129);
152 g_assert_null (error);
153 g_assert_cmpint (g_value_get_uchar (&value), ==, 129);
155 g_value_unset (&value);
156 g_value_init (&value, G_TYPE_BOOLEAN);
157 error = collect (&value, TRUE);
158 g_assert_null (error);
159 g_assert_cmpint (g_value_get_boolean (&value), ==, TRUE);
161 g_value_unset (&value);
162 g_value_init (&value, G_TYPE_INT);
163 error = collect (&value, G_MAXINT);
164 g_assert_null (error);
165 g_assert_cmpint (g_value_get_int (&value), ==, G_MAXINT);
167 g_value_unset (&value);
168 g_value_init (&value, G_TYPE_UINT);
169 error = collect (&value, G_MAXUINT);
170 g_assert_null (error);
171 g_assert_cmpuint (g_value_get_uint (&value), ==, G_MAXUINT);
173 g_value_unset (&value);
174 g_value_init (&value, G_TYPE_LONG);
175 error = collect (&value, G_MAXLONG);
176 g_assert_null (error);
177 g_assert_cmpint (g_value_get_long (&value), ==, G_MAXLONG);
179 g_value_unset (&value);
180 g_value_init (&value, G_TYPE_ULONG);
181 error = collect (&value, G_MAXULONG);
182 g_assert_null (error);
183 g_assert_cmpuint (g_value_get_ulong (&value), ==, G_MAXULONG);
185 g_value_unset (&value);
186 g_value_init (&value, G_TYPE_INT64);
187 error = collect (&value, G_MAXINT64);
188 g_assert_null (error);
189 g_assert_cmpint (g_value_get_int64 (&value), ==, G_MAXINT64);
191 g_value_unset (&value);
192 g_value_init (&value, G_TYPE_UINT64);
193 error = collect (&value, G_MAXUINT64);
194 g_assert_null (error);
195 g_assert_cmpuint (g_value_get_uint64 (&value), ==, G_MAXUINT64);
197 g_value_unset (&value);
198 g_value_init (&value, G_TYPE_FLOAT);
199 error = collect (&value, G_MAXFLOAT);
200 g_assert_null (error);
201 g_assert_cmpfloat (g_value_get_float (&value), ==, G_MAXFLOAT);
203 g_value_unset (&value);
204 g_value_init (&value, G_TYPE_DOUBLE);
205 error = collect (&value, G_MAXDOUBLE);
206 g_assert_null (error);
207 g_assert_cmpfloat (g_value_get_double (&value), ==, G_MAXDOUBLE);
209 g_value_unset (&value);
210 g_value_init (&value, G_TYPE_STRING);
211 error = collect (&value, "string ?");
212 g_assert_null (error);
213 g_assert_cmpstr (g_value_get_string (&value), ==, "string ?");
215 g_value_unset (&value);
216 g_value_init (&value, G_TYPE_GTYPE);
217 error = collect (&value, G_TYPE_BOXED);
218 g_assert_null (error);
219 g_assert_true (g_value_get_gtype (&value) == G_TYPE_BOXED);
221 g_value_unset (&value);
222 g_value_init (&value, G_TYPE_VARIANT);
223 error = collect (&value, g_variant_new_uint32 (42));
224 g_assert_null (error);
225 g_assert_true (g_variant_is_of_type (g_value_get_variant (&value),
226 G_VARIANT_TYPE ("u")));
227 g_assert_cmpuint (g_variant_get_uint32 (g_value_get_variant (&value)), ==, 42);
229 g_value_unset (&value);
235 GValue value = G_VALUE_INIT;
241 g_value_init (&value, G_TYPE_CHAR);
242 g_value_set_char (&value, 'c');
243 error = lcopy (&value, &c);
244 g_assert_null (error);
245 g_assert_cmpint (c, ==, 'c');
251 g_value_unset (&value);
252 g_value_init (&value, G_TYPE_UCHAR);
253 g_value_set_uchar (&value, 129);
254 error = lcopy (&value, &c);
255 g_assert_null (error);
256 g_assert_cmpint (c, ==, 129);
262 g_value_unset (&value);
263 g_value_init (&value, G_TYPE_INT);
264 g_value_set_int (&value, G_MAXINT);
265 error = lcopy (&value, &c);
266 g_assert_null (error);
267 g_assert_cmpint (c, ==, G_MAXINT);
273 g_value_unset (&value);
274 g_value_init (&value, G_TYPE_UINT);
275 g_value_set_uint (&value, G_MAXUINT);
276 error = lcopy (&value, &c);
277 g_assert_null (error);
278 g_assert_cmpuint (c, ==, G_MAXUINT);
284 g_value_unset (&value);
285 g_value_init (&value, G_TYPE_LONG);
286 g_value_set_long (&value, G_MAXLONG);
287 error = lcopy (&value, &c);
288 g_assert_null (error);
289 g_assert (c == G_MAXLONG);
295 g_value_unset (&value);
296 g_value_init (&value, G_TYPE_ULONG);
297 g_value_set_ulong (&value, G_MAXULONG);
298 error = lcopy (&value, &c);
299 g_assert_null (error);
300 g_assert (c == G_MAXULONG);
306 g_value_unset (&value);
307 g_value_init (&value, G_TYPE_INT64);
308 g_value_set_int64 (&value, G_MAXINT64);
309 error = lcopy (&value, &c);
310 g_assert_null (error);
311 g_assert (c == G_MAXINT64);
317 g_value_unset (&value);
318 g_value_init (&value, G_TYPE_UINT64);
319 g_value_set_uint64 (&value, G_MAXUINT64);
320 error = lcopy (&value, &c);
321 g_assert_null (error);
322 g_assert (c == G_MAXUINT64);
328 g_value_unset (&value);
329 g_value_init (&value, G_TYPE_FLOAT);
330 g_value_set_float (&value, G_MAXFLOAT);
331 error = lcopy (&value, &c);
332 g_assert_null (error);
333 g_assert (c == G_MAXFLOAT);
339 g_value_unset (&value);
340 g_value_init (&value, G_TYPE_DOUBLE);
341 g_value_set_double (&value, G_MAXDOUBLE);
342 error = lcopy (&value, &c);
343 g_assert_null (error);
344 g_assert (c == G_MAXDOUBLE);
350 g_value_unset (&value);
351 g_value_init (&value, G_TYPE_STRING);
352 g_value_set_string (&value, "string ?");
353 error = lcopy (&value, &c);
354 g_assert_null (error);
355 g_assert_cmpstr (c, ==, "string ?");
360 GType c = G_TYPE_NONE;
362 g_value_unset (&value);
363 g_value_init (&value, G_TYPE_GTYPE);
364 g_value_set_gtype (&value, G_TYPE_BOXED);
365 error = lcopy (&value, &c);
366 g_assert_null (error);
367 g_assert_true (c == G_TYPE_BOXED);
373 g_value_unset (&value);
374 g_value_init (&value, G_TYPE_VARIANT);
375 g_value_set_variant (&value, g_variant_new_uint32 (42));
376 error = lcopy (&value, &c);
377 g_assert_null (error);
378 g_assert_nonnull (c);
379 g_assert (g_variant_is_of_type (c, G_VARIANT_TYPE ("u")));
380 g_assert_cmpuint (g_variant_get_uint32 (c), ==, 42);
382 g_value_unset (&value);
387 test_value_basic (void)
389 GValue value = G_VALUE_INIT;
391 g_assert_false (G_IS_VALUE (&value));
392 g_assert_false (G_VALUE_HOLDS_INT (&value));
393 g_value_unset (&value);
394 g_assert_false (G_IS_VALUE (&value));
395 g_assert_false (G_VALUE_HOLDS_INT (&value));
397 g_value_init (&value, G_TYPE_INT);
398 g_assert_true (G_IS_VALUE (&value));
399 g_assert_true (G_VALUE_HOLDS_INT (&value));
400 g_assert_false (G_VALUE_HOLDS_UINT (&value));
401 g_assert_cmpint (g_value_get_int (&value), ==, 0);
403 g_value_set_int (&value, 10);
404 g_assert_cmpint (g_value_get_int (&value), ==, 10);
406 g_value_reset (&value);
407 g_assert_true (G_IS_VALUE (&value));
408 g_assert_true (G_VALUE_HOLDS_INT (&value));
409 g_assert_cmpint (g_value_get_int (&value), ==, 0);
411 g_value_unset (&value);
412 g_assert_false (G_IS_VALUE (&value));
413 g_assert_false (G_VALUE_HOLDS_INT (&value));
417 test_value_string (void)
419 const gchar *static1 = "static1";
420 const gchar *static2 = "static2";
421 const gchar *storedstr;
422 const gchar *copystr;
424 GValue value = G_VALUE_INIT;
425 GValue copy = G_VALUE_INIT;
427 g_test_summary ("Test that G_TYPE_STRING GValue copy properly");
430 * Regular strings (ownership not passed)
433 /* Create a regular string gvalue and make sure it copies the provided string */
434 g_value_init (&value, G_TYPE_STRING);
435 g_assert_true (G_VALUE_HOLDS_STRING (&value));
437 /* The string contents should be empty at this point */
438 storedstr = g_value_get_string (&value);
439 g_assert_true (storedstr == NULL);
441 g_value_set_string (&value, static1);
442 /* The contents should be a copy of the same string */
443 storedstr = g_value_get_string (&value);
444 g_assert_true (storedstr != static1);
445 g_assert_cmpstr (storedstr, ==, static1);
446 /* Check g_value_dup_string() provides a copy */
447 str1 = g_value_dup_string (&value);
448 g_assert_true (storedstr != str1);
449 g_assert_cmpstr (str1, ==, static1);
452 /* Copying a regular string gvalue should copy the contents */
453 g_value_init (©, G_TYPE_STRING);
454 g_value_copy (&value, ©);
455 copystr = g_value_get_string (©);
456 g_assert_true (copystr != storedstr);
457 g_assert_cmpstr (copystr, ==, static1);
458 g_value_unset (©);
460 /* Setting a new string should change the contents */
461 g_value_set_string (&value, static2);
462 /* The contents should be a copy of that *new* string */
463 storedstr = g_value_get_string (&value);
464 g_assert_true (storedstr != static2);
465 g_assert_cmpstr (storedstr, ==, static2);
467 /* Setting a static string over that should also change it (test for
468 * coverage and valgrind) */
469 g_value_set_static_string (&value, static1);
470 storedstr = g_value_get_string (&value);
471 g_assert_true (storedstr != static2);
472 g_assert_cmpstr (storedstr, ==, static1);
474 /* Giving a string directly (ownership passed) should replace the content */
475 str2 = g_strdup (static2);
476 g_value_take_string (&value, str2);
477 storedstr = g_value_get_string (&value);
478 g_assert_true (storedstr != static2);
479 g_assert_cmpstr (storedstr, ==, str2);
481 g_value_unset (&value);
484 * Regular strings (ownership passed)
487 g_value_init (&value, G_TYPE_STRING);
488 g_assert_true (G_VALUE_HOLDS_STRING (&value));
489 str1 = g_strdup (static1);
490 g_value_take_string (&value, str1);
491 /* The contents should be the string we provided */
492 storedstr = g_value_get_string (&value);
493 g_assert_true (storedstr == str1);
494 /* But g_value_dup_string() should provide a copy */
495 str2 = g_value_dup_string (&value);
496 g_assert_true (storedstr != str2);
497 g_assert_cmpstr (str2, ==, static1);
500 /* Copying a regular string gvalue (even with ownership passed) should copy
502 g_value_init (©, G_TYPE_STRING);
503 g_value_copy (&value, ©);
504 copystr = g_value_get_string (©);
505 g_assert_true (copystr != storedstr);
506 g_assert_cmpstr (copystr, ==, static1);
507 g_value_unset (©);
509 /* Setting a new regular string should change the contents */
510 g_value_set_string (&value, static2);
511 /* The contents should be a copy of that *new* string */
512 storedstr = g_value_get_string (&value);
513 g_assert_true (storedstr != static2);
514 g_assert_cmpstr (storedstr, ==, static2);
516 g_value_unset (&value);
521 g_value_init (&value, G_TYPE_STRING);
522 g_assert_true (G_VALUE_HOLDS_STRING (&value));
523 g_value_set_static_string (&value, static1);
524 /* The contents should be the string we provided */
525 storedstr = g_value_get_string (&value);
526 g_assert_true (storedstr == static1);
527 /* But g_value_dup_string() should provide a copy */
528 str2 = g_value_dup_string (&value);
529 g_assert_true (storedstr != str2);
530 g_assert_cmpstr (str2, ==, static1);
533 /* Copying a static string gvalue should *actually* copy the contents */
534 g_value_init (©, G_TYPE_STRING);
535 g_value_copy (&value, ©);
536 copystr = g_value_get_string (©);
537 g_assert_true (copystr != static1);
538 g_value_unset (©);
540 /* Setting a new string should change the contents */
541 g_value_set_static_string (&value, static2);
542 /* The contents should be a copy of that *new* string */
543 storedstr = g_value_get_string (&value);
544 g_assert_true (storedstr != static1);
545 g_assert_cmpstr (storedstr, ==, static2);
547 g_value_unset (&value);
550 * Interned/Canonical strings
552 static1 = g_intern_static_string (static1);
553 g_value_init (&value, G_TYPE_STRING);
554 g_assert_true (G_VALUE_HOLDS_STRING (&value));
555 g_value_set_interned_string (&value, static1);
556 g_assert_true (G_VALUE_IS_INTERNED_STRING (&value));
557 /* The contents should be the string we provided */
558 storedstr = g_value_get_string (&value);
559 g_assert_true (storedstr == static1);
560 /* But g_value_dup_string() should provide a copy */
561 str2 = g_value_dup_string (&value);
562 g_assert_true (storedstr != str2);
563 g_assert_cmpstr (str2, ==, static1);
566 /* Copying an interned string gvalue should *not* copy the contents
567 * and should still be an interned string */
568 g_value_init (©, G_TYPE_STRING);
569 g_value_copy (&value, ©);
570 g_assert_true (G_VALUE_IS_INTERNED_STRING (©));
571 copystr = g_value_get_string (©);
572 g_assert_true (copystr == static1);
573 g_value_unset (©);
575 /* Setting a new interned string should change the contents */
576 static2 = g_intern_static_string (static2);
577 g_value_set_interned_string (&value, static2);
578 g_assert_true (G_VALUE_IS_INTERNED_STRING (&value));
579 /* The contents should be the interned string */
580 storedstr = g_value_get_string (&value);
581 g_assert_cmpstr (storedstr, ==, static2);
583 /* Setting a new regular string should change the contents */
584 g_value_set_string (&value, static2);
585 g_assert_false (G_VALUE_IS_INTERNED_STRING (&value));
586 /* The contents should be a copy of that *new* string */
587 storedstr = g_value_get_string (&value);
588 g_assert_true (storedstr != static2);
589 g_assert_cmpstr (storedstr, ==, static2);
591 g_value_unset (&value);
595 cmpint (gconstpointer a, gconstpointer b)
597 const GValue *aa = a;
598 const GValue *bb = b;
600 return g_value_get_int (aa) - g_value_get_int (bb);
604 test_valuearray_basic (void)
608 GValue v = G_VALUE_INIT;
612 a = g_value_array_new (20);
614 g_value_init (&v, G_TYPE_INT);
615 for (i = 0; i < 100; i++)
617 g_value_set_int (&v, i);
618 g_value_array_append (a, &v);
621 g_assert_cmpint (a->n_values, ==, 100);
622 p = g_value_array_get_nth (a, 5);
623 g_assert_cmpint (g_value_get_int (p), ==, 5);
625 for (i = 20; i < 100; i+= 5)
626 g_value_array_remove (a, 100 - i);
628 for (i = 100; i < 150; i++)
630 g_value_set_int (&v, i);
631 g_value_array_prepend (a, &v);
634 g_value_array_sort (a, cmpint);
635 for (i = 0; i < a->n_values - 1; i++)
636 g_assert_cmpint (g_value_get_int (&a->values[i]), <=, g_value_get_int (&a->values[i+1]));
638 a2 = g_value_array_copy (a);
639 for (i = 0; i < a->n_values; i++)
640 g_assert_cmpint (g_value_get_int (&a->values[i]), ==, g_value_get_int (&a2->values[i]));
642 g_value_array_free (a);
643 g_value_array_free (a2);
646 /* We create some dummy objects with this relationship:
648 * GObject TestInterface
650 * TestObjectA TestObjectB /
652 * TestObjectA1 TestObjectA2-------
654 * ie: TestObjectA1 and TestObjectA2 are subclasses of TestObjectA
655 * and TestObjectB is related to neither. TestObjectA2 and TestObjectB
656 * implement TestInterface
659 typedef GTypeInterface TestInterfaceInterface;
660 static GType test_interface_get_type (void);
661 G_DEFINE_INTERFACE (TestInterface, test_interface, G_TYPE_OBJECT)
662 static void test_interface_default_init (TestInterfaceInterface *iface) { }
664 static GType test_object_a_get_type (void);
665 typedef GObject TestObjectA; typedef GObjectClass TestObjectAClass;
666 G_DEFINE_TYPE (TestObjectA, test_object_a, G_TYPE_OBJECT)
667 static void test_object_a_class_init (TestObjectAClass *class) { }
668 static void test_object_a_init (TestObjectA *a) { }
670 static GType test_object_b_get_type (void);
671 typedef GObject TestObjectB; typedef GObjectClass TestObjectBClass;
672 static void test_object_b_iface_init (TestInterfaceInterface *iface) { }
673 G_DEFINE_TYPE_WITH_CODE (TestObjectB, test_object_b, G_TYPE_OBJECT,
674 G_IMPLEMENT_INTERFACE (test_interface_get_type (), test_object_b_iface_init))
675 static void test_object_b_class_init (TestObjectBClass *class) { }
676 static void test_object_b_init (TestObjectB *b) { }
678 static GType test_object_a1_get_type (void);
679 typedef GObject TestObjectA1; typedef GObjectClass TestObjectA1Class;
680 G_DEFINE_TYPE (TestObjectA1, test_object_a1, test_object_a_get_type ())
681 static void test_object_a1_class_init (TestObjectA1Class *class) { }
682 static void test_object_a1_init (TestObjectA1 *c) { }
684 static GType test_object_a2_get_type (void);
685 typedef GObject TestObjectA2; typedef GObjectClass TestObjectA2Class;
686 static void test_object_a2_iface_init (TestInterfaceInterface *iface) { }
687 G_DEFINE_TYPE_WITH_CODE (TestObjectA2, test_object_a2, test_object_a_get_type (),
688 G_IMPLEMENT_INTERFACE (test_interface_get_type (), test_object_a2_iface_init))
689 static void test_object_a2_class_init (TestObjectA2Class *class) { }
690 static void test_object_a2_init (TestObjectA2 *b) { }
693 test_value_transform_object (void)
695 GValue src = G_VALUE_INIT;
696 GValue dest = G_VALUE_INIT;
701 test_interface_get_type (),
702 test_object_a_get_type (),
703 test_object_b_get_type (),
704 test_object_a1_get_type (),
705 test_object_a2_get_type ()
708 for (i = 0; i < G_N_ELEMENTS (types); i++)
710 if (!G_TYPE_IS_CLASSED (types[i]))
713 object = g_object_new (types[i], NULL);
715 for (s = 0; s < G_N_ELEMENTS (types); s++)
717 if (!G_TYPE_CHECK_INSTANCE_TYPE (object, types[s]))
720 g_value_init (&src, types[s]);
721 g_value_set_object (&src, object);
722 g_value_set_object (&src, g_value_get_object (&src));
724 for (d = 0; d < G_N_ELEMENTS (types); d++)
726 g_test_message ("Next: %s object in GValue of %s to GValue of %s", g_type_name (types[i]), g_type_name (types[s]), g_type_name (types[d]));
727 g_assert_true (g_value_type_transformable (types[s], types[d]));
728 g_value_init (&dest, types[d]);
729 g_assert_true (g_value_transform (&src, &dest));
730 g_assert_cmpint (g_value_get_object (&dest) != NULL, ==, G_TYPE_CHECK_INSTANCE_TYPE (object, types[d]));
731 g_value_unset (&dest);
733 g_value_unset (&src);
736 g_object_unref (object);
741 main (int argc, char *argv[])
743 g_test_init (&argc, &argv, NULL);
745 g_test_add_func ("/value/basic", test_value_basic);
746 g_test_add_func ("/value/array/basic", test_valuearray_basic);
747 g_test_add_func ("/value/collection", test_collection);
748 g_test_add_func ("/value/copying", test_copying);
749 g_test_add_func ("/value/enum-transformation", test_enum_transformation);
750 g_test_add_func ("/value/gtype", test_gtype_value);
751 g_test_add_func ("/value/string", test_value_string);
752 g_test_add_func ("/value/transform-object", test_value_transform_object);
754 return g_test_run ();