22 #include <glib/gstdio.h>
24 #include "../lib/grn-assertions.h"
33 static gchar *tmp_directory;
34 static const gchar *database_path;
50 g_free(tmp_directory);
54 remove_tmp_directory(
void)
56 cut_remove_path(tmp_directory, NULL);
62 remove_tmp_directory();
63 g_mkdir_with_parents(tmp_directory, 0700);
72 database_path = cut_build_path(tmp_directory,
"database.groonga", NULL);
85 remove_tmp_directory();
91 #define ADD_DATA(label, flags) \
92 gcut_add_datum(label, \
93 "flags", G_TYPE_INT, flags, \
122 #define ADD_DATA(label, table_type, key) \
123 gcut_add_datum(label, \
124 "table_type", G_TYPE_STRING, table_type, \
125 "key", G_TYPE_STRING, key, \
128 ADD_DATA(
"hash table - lower",
"TABLE_HASH_KEY",
"alice");
129 ADD_DATA(
"hash table - upper",
"TABLE_HASH_KEY",
"ALICE");
130 ADD_DATA(
"hash table - mixed",
"TABLE_HASH_KEY",
"AlIcE");
132 ADD_DATA(
"patricia trie - lower",
"TABLE_PAT_KEY",
"alice");
133 ADD_DATA(
"patricia trie - upper",
"TABLE_PAT_KEY",
"ALICE");
134 ADD_DATA(
"patricia trie - mixed",
"TABLE_PAT_KEY",
"AlIcE");
136 ADD_DATA(
"double array trie - lower",
"TABLE_DAT_KEY",
"alice");
137 ADD_DATA(
"double array trie - upper",
"TABLE_DAT_KEY",
"ALICE");
138 ADD_DATA(
"double array trie - mixed",
"TABLE_DAT_KEY",
"AlIcE");
147 const gchar *search_key = gcut_data_get_string(data,
"key");
148 GList *actual_keys = NULL;
152 cut_take_printf(
"table_create Users %s ShortText "
153 "--normalizer NormalizerAuto",
154 gcut_data_get_string(data,
"table_type")));
155 cut_assert_equal_string(
165 search_key, strlen(search_key),
166 search_key, strlen(search_key),
172 actual_keys = g_list_append(actual_keys, g_strndup(key, key_length));
175 gcut_take_list(actual_keys, g_free);
177 gcut_assert_equal_list_string(gcut_take_new_list_string(
"alice", NULL),