1 /* gimarshallingtestsextra.c
3 * Copyright (C) 2016 Thibault Saunier <tsaunier@gnome.org>
5 * This file is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation; either version 3 of the
8 * License, or (at your option) any later version.
10 * This file is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "gimarshallingtestsextra.h"
23 gi_marshalling_tests_compare_two_gerrors_in_gvalue (GValue *v, GValue *v1)
25 GError *error, * error1;
27 g_assert_cmpstr (g_type_name (G_VALUE_TYPE (v)), ==,
28 g_type_name (G_TYPE_ERROR));
29 g_assert_cmpstr (g_type_name (G_VALUE_TYPE (v1)), ==,
30 g_type_name (G_TYPE_ERROR));
32 error = (GError*) g_value_get_boxed (v);
33 error1 = (GError*) g_value_get_boxed (v1);
35 g_assert_cmpint (error->domain, ==, error1->domain);
36 g_assert_cmpint (error->code, ==, error1->code);
37 g_assert_cmpstr (error->message, ==, error1->message);
41 * gi_marshalling_tests_ghashtable_enum_none_in:
42 * @hash_table: (element-type gint GIMarshallingTestsExtraEnum) (transfer none):
45 gi_marshalling_tests_ghashtable_enum_none_in (GHashTable *hash_table)
47 g_assert_cmpint (GPOINTER_TO_INT (g_hash_table_lookup (hash_table, GINT_TO_POINTER (1))), ==, GI_MARSHALLING_TESTS_EXTRA_ENUM_VALUE1);
48 g_assert_cmpint (GPOINTER_TO_INT (g_hash_table_lookup (hash_table, GINT_TO_POINTER (2))), ==, GI_MARSHALLING_TESTS_EXTRA_ENUM_VALUE2);
49 g_assert_cmpint (GPOINTER_TO_INT (g_hash_table_lookup (hash_table, GINT_TO_POINTER (3))), ==, GI_MARSHALLING_TESTS_EXTRA_ENUM_VALUE3);
53 * gi_marshalling_tests_ghashtable_enum_none_return:
55 * Returns: (element-type gint GIMarshallingTestsExtraEnum) (transfer none):
58 gi_marshalling_tests_ghashtable_enum_none_return (void)
60 static GHashTable *hash_table = NULL;
62 if (hash_table == NULL)
64 hash_table = g_hash_table_new (NULL, NULL);
65 g_hash_table_insert (hash_table, GINT_TO_POINTER (1), GINT_TO_POINTER (GI_MARSHALLING_TESTS_EXTRA_ENUM_VALUE1));
66 g_hash_table_insert (hash_table, GINT_TO_POINTER (2), GINT_TO_POINTER (GI_MARSHALLING_TESTS_EXTRA_ENUM_VALUE2));
67 g_hash_table_insert (hash_table, GINT_TO_POINTER (3), GINT_TO_POINTER (GI_MARSHALLING_TESTS_EXTRA_ENUM_VALUE3));
74 * gi_marshalling_tests_filename_copy:
75 * @path_in: (type filename) (nullable)
77 * Returns: (type filename) (nullable)
80 gi_marshalling_tests_filename_copy (gchar *path_in)
82 return g_strdup (path_in);
86 * gi_marshalling_tests_filename_to_glib_repr:
87 * @path_in: (type filename) (nullable)
89 * Returns: (array length=len) (element-type guint8)
92 gi_marshalling_tests_filename_to_glib_repr (gchar *path_in, gsize *len)
94 *len = strlen(path_in);
95 return g_strdup (path_in);
99 * gi_marshalling_tests_filename_exists:
100 * @path: (type filename)
103 gi_marshalling_tests_filename_exists (gchar *path)
105 return g_file_test (path, G_FILE_TEST_EXISTS);