35 setup_trie_common(
"patricia-trie-search");
48 gcut_list_string_free(keys);
67 teardown_trie_common();
70 #define create_hash() \
71 hash = grn_hash_create(context, NULL, sizeof(grn_id), \
74 #define cut_assert_create_hash() do \
79 cut_assert_equal_g_list_string(NULL, messages()); \
85 retrieve_all_keys(
void)
93 NULL, 0, NULL, 0, 0, -1,
99 GString *null_terminated_key;
106 null_terminated_key = g_string_new_len(key, size);
107 keys = g_list_append(keys, g_string_free(null_terminated_key,
FALSE));
116 const gchar *search_key,
118 ...) G_GNUC_NULL_TERMINATED;
120 lcp_test_data_new(const gchar *expected_key, const gchar *search_key,
126 va_start(args, set_parameters);
127 test_data = trie_test_data_newv(NULL, search_key, expected_key,
129 set_parameters, &args);
138 trie_test_data_free(test_data);
144 cut_add_data(
"default - nonexistence",
145 lcp_test_data_new(NULL,
"カッター", NULL, NULL),
148 lcp_test_data_new(NULL,
"セ", NULL, NULL),
151 lcp_test_data_new(
"セナ",
"セナ", NULL, NULL),
154 lcp_test_data_new(
"セナセナ",
"セナセナセナ", NULL, NULL),
156 "sis - nonexistence",
157 lcp_test_data_new(NULL,
"カッター", set_sis, NULL),
160 lcp_test_data_new(
"セ",
"セ", set_sis, NULL),
163 lcp_test_data_new(
"セナ",
"セナ", set_sis, NULL),
166 lcp_test_data_new(
"セナセナ",
"セナセナセナ",
176 const gchar key1[] =
"セナ";
177 const gchar key2[] =
"ナセナセ";
178 const gchar key3[] =
"Groonga";
179 const gchar key4[] =
"セナ + Ruby";
180 const gchar key5[] =
"セナセナ";
182 trie_test_data_set_parameters(test_data);
197 const gchar *null_terminated_key;
201 null_terminated_key = cut_take_strndup(key, size);
202 cut_assert_equal_string(test_data->
expected_key, null_terminated_key);
209 GList *expected_keys,
210 const gchar *search_key,
212 ...) G_GNUC_NULL_TERMINATED;
214 xfix_test_data_new(
grn_rc expected_rc, GList *expected_keys,
215 const gchar *search_key,
221 va_start(args, set_parameters);
222 test_data = trie_test_data_newv(NULL, search_key, NULL, expected_rc,
224 set_parameters, &args);
233 trie_test_data_free(test_data);
239 cut_add_data(
"default - nonexistence",
244 gcut_list_string_new(
"セナ",
"セナ + Ruby",
250 gcut_list_string_new(
"セナ",
"セナ + Ruby",
258 "sis - nonexistence",
264 gcut_list_string_new(
"セ",
"セナ",
272 gcut_list_string_new(
"セナ",
276 "セナ", set_sis, NULL),
281 xfix_test_data_free);
288 const gchar key1[] =
"セナ";
289 const gchar key2[] =
"ナセナセ";
290 const gchar key3[] =
"Groonga";
291 const gchar key4[] =
"セナ + Ruby";
292 const gchar key5[] =
"セナセナ";
294 trie_test_data_set_parameters(test_data);
311 retrieve_all_keys());
317 cut_add_data(
"default - nonexistence",
325 gcut_list_string_new(
"セナ", NULL),
332 "sis - nonexistence",
338 gcut_list_string_new(
"セナセナ",
347 gcut_list_string_new(
"セナセナ",
351 "セナ", set_sis, NULL),
356 xfix_test_data_free);
363 const gchar key1[] =
"セナ";
364 const gchar key2[] =
"ナセナセ";
365 const gchar key3[] =
"Groonga";
366 const gchar key4[] =
"セナ + Ruby";
367 const gchar key5[] =
"セナセナ";
369 trie_test_data_set_parameters(test_data);
386 retrieve_all_keys());