Update Changelog
[profile/ivi/libgee.git] / tests / testhashmap.c
1 /* testhashmap.c generated by valac 0.18.0, the Vala compiler
2  * generated from testhashmap.vala, do not modify */
3
4 /* testhashmap.vala
5  *
6  * Copyright (C) 2008  Jürg Billeter
7  * Copyright (C) 2009  Didier Villevalois, Julien Peeters
8  *
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.
13
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.
18
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
22  *
23  * Author:
24  *      Julien Peeters <contact@julienpeeters.fr>
25  */
26
27 #include <glib.h>
28 #include <glib-object.h>
29 #include <gee.h>
30 #include <stdlib.h>
31 #include <string.h>
32
33
34 #define GEE_TYPE_TEST_CASE (gee_test_case_get_type ())
35 #define GEE_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_TEST_CASE, GeeTestCase))
36 #define GEE_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_TEST_CASE, GeeTestCaseClass))
37 #define GEE_IS_TEST_CASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_TEST_CASE))
38 #define GEE_IS_TEST_CASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_TEST_CASE))
39 #define GEE_TEST_CASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_TEST_CASE, GeeTestCaseClass))
40
41 typedef struct _GeeTestCase GeeTestCase;
42 typedef struct _GeeTestCaseClass GeeTestCaseClass;
43 typedef struct _GeeTestCasePrivate GeeTestCasePrivate;
44
45 #define TYPE_MAP_TESTS (map_tests_get_type ())
46 #define MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAP_TESTS, MapTests))
47 #define MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAP_TESTS, MapTestsClass))
48 #define IS_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAP_TESTS))
49 #define IS_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAP_TESTS))
50 #define MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAP_TESTS, MapTestsClass))
51
52 typedef struct _MapTests MapTests;
53 typedef struct _MapTestsClass MapTestsClass;
54 typedef struct _MapTestsPrivate MapTestsPrivate;
55
56 #define TYPE_HASH_MAP_TESTS (hash_map_tests_get_type ())
57 #define HASH_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_HASH_MAP_TESTS, HashMapTests))
58 #define HASH_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_HASH_MAP_TESTS, HashMapTestsClass))
59 #define IS_HASH_MAP_TESTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_HASH_MAP_TESTS))
60 #define IS_HASH_MAP_TESTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_HASH_MAP_TESTS))
61 #define HASH_MAP_TESTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_HASH_MAP_TESTS, HashMapTestsClass))
62
63 typedef struct _HashMapTests HashMapTests;
64 typedef struct _HashMapTestsClass HashMapTestsClass;
65 typedef struct _HashMapTestsPrivate HashMapTestsPrivate;
66 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
67
68 struct _GeeTestCase {
69         GObject parent_instance;
70         GeeTestCasePrivate * priv;
71 };
72
73 struct _GeeTestCaseClass {
74         GObjectClass parent_class;
75         void (*set_up) (GeeTestCase* self);
76         void (*tear_down) (GeeTestCase* self);
77 };
78
79 struct _MapTests {
80         GeeTestCase parent_instance;
81         MapTestsPrivate * priv;
82         GeeMap* test_map;
83 };
84
85 struct _MapTestsClass {
86         GeeTestCaseClass parent_class;
87 };
88
89 struct _HashMapTests {
90         MapTests parent_instance;
91         HashMapTestsPrivate * priv;
92 };
93
94 struct _HashMapTestsClass {
95         MapTestsClass parent_class;
96 };
97
98
99 static gpointer hash_map_tests_parent_class = NULL;
100
101 GType gee_test_case_get_type (void) G_GNUC_CONST;
102 GType map_tests_get_type (void) G_GNUC_CONST;
103 GType hash_map_tests_get_type (void) G_GNUC_CONST;
104 enum  {
105         HASH_MAP_TESTS_DUMMY_PROPERTY
106 };
107 HashMapTests* hash_map_tests_new (void);
108 HashMapTests* hash_map_tests_construct (GType object_type);
109 MapTests* map_tests_construct (GType object_type, const gchar* name);
110 static void hash_map_tests_real_set_up (GeeTestCase* base);
111 static void hash_map_tests_real_tear_down (GeeTestCase* base);
112
113
114 HashMapTests* hash_map_tests_construct (GType object_type) {
115         HashMapTests * self = NULL;
116         self = (HashMapTests*) map_tests_construct (object_type, "HashMap");
117         return self;
118 }
119
120
121 HashMapTests* hash_map_tests_new (void) {
122         return hash_map_tests_construct (TYPE_HASH_MAP_TESTS);
123 }
124
125
126 static void hash_map_tests_real_set_up (GeeTestCase* base) {
127         HashMapTests * self;
128         GeeHashMap* _tmp0_;
129         self = (HashMapTests*) base;
130         _tmp0_ = gee_hash_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);
131         _g_object_unref0 (((MapTests*) self)->test_map);
132         ((MapTests*) self)->test_map = (GeeMap*) _tmp0_;
133 }
134
135
136 static void hash_map_tests_real_tear_down (GeeTestCase* base) {
137         HashMapTests * self;
138         self = (HashMapTests*) base;
139         _g_object_unref0 (((MapTests*) self)->test_map);
140         ((MapTests*) self)->test_map = NULL;
141 }
142
143
144 static void hash_map_tests_class_init (HashMapTestsClass * klass) {
145         hash_map_tests_parent_class = g_type_class_peek_parent (klass);
146         GEE_TEST_CASE_CLASS (klass)->set_up = hash_map_tests_real_set_up;
147         GEE_TEST_CASE_CLASS (klass)->tear_down = hash_map_tests_real_tear_down;
148 }
149
150
151 static void hash_map_tests_instance_init (HashMapTests * self) {
152 }
153
154
155 GType hash_map_tests_get_type (void) {
156         static volatile gsize hash_map_tests_type_id__volatile = 0;
157         if (g_once_init_enter (&hash_map_tests_type_id__volatile)) {
158                 static const GTypeInfo g_define_type_info = { sizeof (HashMapTestsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) hash_map_tests_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (HashMapTests), 0, (GInstanceInitFunc) hash_map_tests_instance_init, NULL };
159                 GType hash_map_tests_type_id;
160                 hash_map_tests_type_id = g_type_register_static (TYPE_MAP_TESTS, "HashMapTests", &g_define_type_info, 0);
161                 g_once_init_leave (&hash_map_tests_type_id__volatile, hash_map_tests_type_id);
162         }
163         return hash_map_tests_type_id__volatile;
164 }
165
166
167