1 /* testhashmultimap.c generated by valac 0.18.0, the Vala compiler
2 * generated from testhashmultimap.vala, do not modify */
4 /* testhashmultimap.vala
6 * Copyright (C) 2008 Jürg Billeter
7 * Copyright (C) 2009 Didier Villevalois, Julien Peeters
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 * Jürg Billeter <j@bitron.ch>
25 * Didier 'Ptitjes Villevalois <ptitjes@free.fr>
26 * Julien Peeters <contact@julienpeeters.fr>
30 #include <glib-object.h>
36 #define GEE_TYPE_TEST_CASE (gee_test_case_get_type ())
37 #define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase))
38 #define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass))
39 #define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE))
40 #define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE))
41 #define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass))
43 typedef struct _GeeTestCase GeeTestCase;
44 typedef struct _GeeTestCaseClass GeeTestCaseClass;
45 typedef struct _GeeTestCasePrivate GeeTestCasePrivate;
47 #define TYPE_MULTI_MAP_TESTS (multi_map_tests_get_type ())
48 #define MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MULTI_MAP_TESTS, MultiMapTests))
49 #define MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MULTI_MAP_TESTS, MultiMapTestsClass))
50 #define IS_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MULTI_MAP_TESTS))
51 #define IS_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MULTI_MAP_TESTS))
52 #define MULTI_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MULTI_MAP_TESTS, MultiMapTestsClass))
54 typedef struct _MultiMapTests MultiMapTests;
55 typedef struct _MultiMapTestsClass MultiMapTestsClass;
56 typedef struct _MultiMapTestsPrivate MultiMapTestsPrivate;
58 #define TYPE_HASH_MULTI_MAP_TESTS (hash_multi_map_tests_get_type ())
59 #define HASH_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HASH_MULTI_MAP_TESTS, HashMultiMapTests))
60 #define HASH_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HASH_MULTI_MAP_TESTS, HashMultiMapTestsClass))
61 #define IS_HASH_MULTI_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HASH_MULTI_MAP_TESTS))
62 #define IS_HASH_MULTI_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HASH_MULTI_MAP_TESTS))
63 #define HASH_MULTI_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HASH_MULTI_MAP_TESTS, HashMultiMapTestsClass))
65 typedef struct _HashMultiMapTests HashMultiMapTests;
66 typedef struct _HashMultiMapTestsClass HashMultiMapTestsClass;
67 typedef struct _HashMultiMapTestsPrivate HashMultiMapTestsPrivate;
68 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
69 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
72 GObject parent_instance;
73 GeeTestCasePrivate * priv;
76 struct _GeeTestCaseClass {
77 GObjectClass parent_class;
78 void (*set_up) (GeeTestCase* self);
79 void (*tear_down) (GeeTestCase* self);
82 struct _MultiMapTests {
83 GeeTestCase parent_instance;
84 MultiMapTestsPrivate * priv;
85 GeeMultiMap* test_multi_map;
88 struct _MultiMapTestsClass {
89 GeeTestCaseClass parent_class;
92 struct _HashMultiMapTests {
93 MultiMapTests parent_instance;
94 HashMultiMapTestsPrivate * priv;
97 struct _HashMultiMapTestsClass {
98 MultiMapTestsClass parent_class;
101 typedef void (*GeeTestCaseTestMethod) (void* user_data);
103 static gpointer hash_multi_map_tests_parent_class = NULL;
105 GType gee_test_case_get_type (void) G_GNUC_CONST;
106 GType multi_map_tests_get_type (void) G_GNUC_CONST;
107 GType hash_multi_map_tests_get_type (void) G_GNUC_CONST;
109 HASH_MULTI_MAP_TESTS_DUMMY_PROPERTY
111 HashMultiMapTests* hash_multi_map_tests_new (void);
112 HashMultiMapTests* hash_multi_map_tests_construct (GType object_type);
113 MultiMapTests* multi_map_tests_construct (GType object_type, const gchar* name);
114 void gee_test_case_add_test (GeeTestCase* self, const gchar* name, GeeTestCaseTestMethod test, void* test_target, GDestroyNotify test_target_destroy_notify);
115 static void hash_multi_map_tests_test_selected_functions (HashMultiMapTests* self);
116 static void _hash_multi_map_tests_test_selected_functions_gee_test_case_test_method (gpointer self);
117 static void hash_multi_map_tests_real_set_up (GeeTestCase* base);
118 static void hash_multi_map_tests_real_tear_down (GeeTestCase* base);
121 static void _hash_multi_map_tests_test_selected_functions_gee_test_case_test_method (gpointer self) {
122 hash_multi_map_tests_test_selected_functions (self);
126 HashMultiMapTests* hash_multi_map_tests_construct (GType object_type) {
127 HashMultiMapTests * self = NULL;
128 self = (HashMultiMapTests*) multi_map_tests_construct (object_type, "HashMultiMap");
129 gee_test_case_add_test ((GeeTestCase*) self, "[HashMultiMap] selected functions", _hash_multi_map_tests_test_selected_functions_gee_test_case_test_method, g_object_ref (self), g_object_unref);
134 HashMultiMapTests* hash_multi_map_tests_new (void) {
135 return hash_multi_map_tests_construct (TYPE_HASH_MULTI_MAP_TESTS);
139 static void hash_multi_map_tests_real_set_up (GeeTestCase* base) {
140 HashMultiMapTests * self;
141 GeeHashMultiMap* _tmp0_;
142 self = (HashMultiMapTests*) base;
143 _tmp0_ = gee_hash_multi_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
144 _g_object_unref0 (((MultiMapTests*) self)->test_multi_map);
145 ((MultiMapTests*) self)->test_multi_map = (GeeMultiMap*) _tmp0_;
149 static void hash_multi_map_tests_real_tear_down (GeeTestCase* base) {
150 HashMultiMapTests * self;
151 self = (HashMultiMapTests*) base;
152 _g_object_unref0 (((MultiMapTests*) self)->test_multi_map);
153 ((MultiMapTests*) self)->test_multi_map = NULL;
157 static gpointer _g_object_ref0 (gpointer self) {
158 return self ? g_object_ref (self) : NULL;
162 static void hash_multi_map_tests_test_selected_functions (HashMultiMapTests* self) {
164 GeeHashMultiMap* _tmp1_;
165 GeeHashMultiMap* test_hash_multi_map;
166 g_return_if_fail (self != NULL);
167 _tmp0_ = ((MultiMapTests*) self)->test_multi_map;
168 _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GEE_TYPE_HASH_MULTI_MAP) ? ((GeeHashMultiMap*) _tmp0_) : NULL);
169 test_hash_multi_map = _tmp1_;
170 _vala_assert (test_hash_multi_map != NULL, "test_hash_multi_map != null");
171 _g_object_unref0 (test_hash_multi_map);
175 static void hash_multi_map_tests_class_init (HashMultiMapTestsClass * klass) {
176 hash_multi_map_tests_parent_class = g_type_class_peek_parent (klass);
177 GEE_TEST_CASE_CLASS (klass)->set_up = hash_multi_map_tests_real_set_up;
178 GEE_TEST_CASE_CLASS (klass)->tear_down = hash_multi_map_tests_real_tear_down;
182 static void hash_multi_map_tests_instance_init (HashMultiMapTests * self) {
186 GType hash_multi_map_tests_get_type (void) {
187 static volatile gsize hash_multi_map_tests_type_id__volatile = 0;
188 if (g_once_init_enter (&hash_multi_map_tests_type_id__volatile)) {
189 static const GTypeInfo g_define_type_info = { sizeof (HashMultiMapTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) hash_multi_map_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (HashMultiMapTests), 0, (GInstanceInitFunc) hash_multi_map_tests_instance_init, NULL };
190 GType hash_multi_map_tests_type_id;
191 hash_multi_map_tests_type_id = g_type_register_static (TYPE_MULTI_MAP_TESTS, "HashMultiMapTests", &g_define_type_info, 0);
192 g_once_init_leave (&hash_multi_map_tests_type_id__volatile, hash_multi_map_tests_type_id);
194 return hash_multi_map_tests_type_id__volatile;