Groonga 3.0.9 Source Code Document
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
grn-test-utils.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 2; coding: utf-8 -*- */
2 /*
3  Copyright (C) 2008-2013 Kouhei Sutou <kou@clear-code.com>
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 #ifndef __GRN_TEST_UTILS_H__
20 #define __GRN_TEST_UTILS_H__
21 
22 #include <groonga.h>
23 
24 #include <gcutter.h>
25 
26 #include <string.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #define GRN_TEST_ENV_TABLE_PATH "GRN_TEST_TABLE_PATH"
33 #define GRN_TEST_ENV_TABLE_TYPE "GRN_TEST_TABLE_TYPE"
34 #define GRN_TEST_ENV_HASH_PATH "GRN_TEST_HASH_PATH"
35 #define GRN_TEST_ENV_PATRICIA_TRIE_PATH "GRN_TEST_PATRICIA_TRIE_PATH"
36 #define GRN_TEST_ENV_MULTI_THREAD "GRN_TEST_MULTI_THREAD"
37 #define GRN_TEST_ENV_N_PROCESSES "GRN_TEST_N_PROCESSES"
38 #define GRN_TEST_ENV_PROCESS_NUMBER "GRN_TEST_PROCESS_NUMBER"
39 
40 #define GRN_TEST_GEO_COORDINATE(hours, minutes, seconds) \
41  ((hours) * 3600 + (minutes) * 60 + (seconds)) * 1000
42 
43 #define GRN_TEST_GEO_POINT_STRING(latitude, longitude) \
44  g_strdup_printf("%dx%d", latitude, longitude)
45 
46 #if !GLIB_CHECK_VERSION(2, 32, 0)
47 # define g_thread_new(name, func, data) \
48  g_thread_create(func, data, TRUE, NULL)
49 #endif
50 
51 typedef void (*grn_test_set_parameters_func) (void);
52 
53 const gchar *grn_rc_to_string (grn_rc rc);
54 const gchar *grn_test_get_base_dir (void);
55 const gchar *grn_test_get_build_dir (void);
56 const gchar *grn_test_get_tmp_dir (void);
57 
61  (grn_logger_info *logger);
63  (grn_logger_info *logger);
64 const gchar *grn_collect_logger_to_string (grn_logger_info *logger);
66  (grn_logger_info *logger);
68 
70  setup_grn_logger (void);
72 
73 GString *grn_long_path_new (const gchar *base_path,
74  gssize max_size);
75 GString *grn_long_name_new (gssize max_size);
76 
78  grn_table_cursor *cursor);
80  grn_obj *patricia_trie);
82  grn_table_cursor *cursor);
84  grn_obj *patricia_trie);
86  unsigned char type);
87 void grn_test_object_inspect (GString *output,
89  grn_obj *object);
90 
92  const gchar *command);
94  const gchar *line_separated_commands);
95 
97  grn_obj *table,
98  const gchar *text_column_name);
99 
101  (gdouble coordinate_in_degree);
102 gdouble grn_test_coordinate_in_degree (gint coordinate_in_milliseconds);
103 const gchar *grn_test_location_string (gdouble latitude_in_degree,
104  gdouble longitude_in_degree);
105 
106 #ifdef __cplusplus
107 }
108 #endif
109 
110 #endif