test_enum_transformation (void)
{
GType type;
- GValue orig = { 0, };
- GValue xform = { 0, };
+ GValue orig = G_VALUE_INIT;
+ GValue xform = G_VALUE_INIT;
GEnumValue values[] = { {0,"0","0"}, {1,"1","1"}};
type = g_enum_register_static ("TestEnum", values);
g_value_init (&xform, G_TYPE_CHAR);
g_value_transform (&orig, &xform);
g_assert (g_value_get_char (&xform) == 1);
+ g_assert (g_value_get_schar (&xform) == 1);
memset (&xform, 0, sizeof (GValue));
g_value_init (&xform, G_TYPE_UCHAR);
test_gtype_value (void)
{
GType type;
- GValue value = { 0, };
- GValue copy = { 0, };
+ GValue value = G_VALUE_INIT;
+ GValue copy = G_VALUE_INIT;
g_value_init (&value, G_TYPE_GTYPE);
static void
test_collection (void)
{
- GValue value = { 0, };
+ GValue value = G_VALUE_INIT;
gchar *error;
g_value_init (&value, G_TYPE_CHAR);
static void
test_copying (void)
{
- GValue value = { 0, };
+ GValue value = G_VALUE_INIT;
gchar *error;
{
error = lcopy (&value, &c);
g_assert (error == NULL);
g_assert (strcmp (c, "string ?") == 0);
+ g_free (c);
}
{
g_assert (g_variant_is_of_type (c, G_VARIANT_TYPE ("u")));
g_assert_cmpuint (g_variant_get_uint32 (c), ==, 42);
g_variant_unref (c);
+ g_value_unset (&value);
}
}
main (int argc, char *argv[])
{
g_test_init (&argc, &argv, NULL);
- g_type_init ();
g_test_add_func ("/gvalue/enum-transformation", test_enum_transformation);
g_test_add_func ("/gvalue/gtype", test_gtype_value);