Groonga 3.0.9 Source Code Document
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
grn-test-hash-assertions.c
Go to the documentation of this file.
1 /* -*- c-basic-offset: 2; coding: utf-8 -*- */
2 /*
3  Copyright (C) 2008-2009 Kouhei Sutou <kou@cozmixng.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License version 2.1 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #include <gcutter.h>
20 
21 #include <hash.h>
22 
24 
25 void
27 {
28  GError *error = NULL;
29  grn_logger_info *logger;
30 
31  logger = grn_test_hash_factory_get_logger(factory);
32  cut_assert_not_null(logger);
34  *hash = grn_test_hash_factory_create(factory, &error);
35  gcut_assert_error(error);
36  cut_assert_not_null(*hash);
37  gcut_assert_equal_list_string(NULL, grn_collect_logger_get_messages(logger));
38 }
39 
40 void
42 {
43  GError *error = NULL;
44  grn_logger_info *logger;
45 
46  logger = grn_test_hash_factory_get_logger(factory);
47  cut_assert_not_null(logger);
49  *hash = grn_test_hash_factory_open(factory, &error);
50  gcut_assert_error(error);
51  cut_assert_not_null(*hash);
52  gcut_assert_equal_list_string(NULL, grn_collect_logger_get_messages(logger));
53 }
54 
55 void
57  GrnTestHashFactory *factory)
58 {
59  GError *expected_error = NULL;
60  GError *actual_error = NULL;
61 
62  *hash = grn_test_hash_factory_open(factory, &actual_error);
63  expected_error = g_error_new(GRN_TEST_HASH_FACTORY_ERROR,
65  "failed to open grn_hash");
66  gcut_take_error(expected_error);
67  gcut_take_error(actual_error);
68  gcut_assert_equal_error(expected_error, actual_error);
69  cut_assert_null(*hash);
70 }