Update contrib.
1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 * Portion Copyright © 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
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 #undef G_DISABLE_ASSERT
33 #include <glib-object.h>
36 #include "mrt2_glib2_test.h"
41 test_enum_transformation (void)
45 GValue xform = { 0, };
46 GEnumValue values[] = { {0,"0","0"}, {1,"1","1"}};
48 type = g_enum_register_static ("TestEnum", values);
50 g_value_init (&orig, type);
51 g_value_set_enum (&orig, 1);
53 memset (&xform, 0, sizeof (GValue));
54 g_value_init (&xform, G_TYPE_CHAR);
55 g_value_transform (&orig, &xform);
56 g_assert (g_value_get_char (&xform) == 1);
58 memset (&xform, 0, sizeof (GValue));
59 g_value_init (&xform, G_TYPE_UCHAR);
60 g_value_transform (&orig, &xform);
61 g_assert (g_value_get_uchar (&xform) == 1);
63 memset (&xform, 0, sizeof (GValue));
64 g_value_init (&xform, G_TYPE_INT);
65 g_value_transform (&orig, &xform);
66 g_assert (g_value_get_int (&xform) == 1);
68 memset (&xform, 0, sizeof (GValue));
69 g_value_init (&xform, G_TYPE_UINT);
70 g_value_transform (&orig, &xform);
71 g_assert (g_value_get_uint (&xform) == 1);
73 memset (&xform, 0, sizeof (GValue));
74 g_value_init (&xform, G_TYPE_LONG);
75 g_value_transform (&orig, &xform);
76 g_assert (g_value_get_long (&xform) == 1);
78 memset (&xform, 0, sizeof (GValue));
79 g_value_init (&xform, G_TYPE_ULONG);
80 g_value_transform (&orig, &xform);
81 g_assert (g_value_get_ulong (&xform) == 1);
83 memset (&xform, 0, sizeof (GValue));
84 g_value_init (&xform, G_TYPE_INT64);
85 g_value_transform (&orig, &xform);
86 g_assert (g_value_get_int64 (&xform) == 1);
88 memset (&xform, 0, sizeof (GValue));
89 g_value_init (&xform, G_TYPE_UINT64);
90 g_value_transform (&orig, &xform);
91 g_assert (g_value_get_uint64 (&xform) == 1);
95 main (int argc, char *argv[])
99 g_log_set_handler (NULL, G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
100 g_set_print_handler(mrtPrintHandler);
106 test_enum_transformation ();
109 testResultXml("gvalue-test");
110 #endif /* EMULATOR */