3 * Copyright (C) 2008 Jürg Billeter
4 * Copyright (C) 2009 Didier Villevalois, Julien Peeters
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 * Julien Peeters <contact@julienpeeters.fr>
26 public class HashMapTests : MapTests {
28 public HashMapTests () {
30 add_test ("[HashMap] selected functions", test_selected_functions);
31 add_test ("[HashMap] GObject properties", test_gobject_properties);
34 public override void set_up () {
35 test_map = new HashMap<string,string> ();
38 public override void tear_down () {
42 public void test_selected_functions () {
43 var test_hash_map = test_map as HashMap<string,string>;
45 // Check the map exists
46 assert (test_hash_map != null);
48 // Check the selected hash and equal functions
49 assert (test_hash_map.key_hash_func == str_hash);
50 assert (test_hash_map.key_equal_func == str_equal);
51 assert (test_hash_map.value_equal_func == str_equal);
54 public new void test_gobject_properties () {
55 var test_hash_map = test_map as HashMap<string,string>;
57 // Check the list exists
58 assert (test_hash_map != null);
61 value = Value (typeof (HashFunc));
62 test_hash_map.get_property ("key-hash-func", ref value);
63 assert (value.get_pointer () == (void*) test_hash_map.key_hash_func);
66 value = Value (typeof (EqualFunc));
67 test_hash_map.get_property ("key-equal-func", ref value);
68 assert (value.get_pointer () == (void*) test_hash_map.key_equal_func);
71 value = Value (typeof (EqualFunc));
72 test_hash_map.get_property ("value-equal-func", ref value);
73 assert (value.get_pointer () == (void*) test_hash_map.value_equal_func);