22 #include <glib/gstdio.h>
24 #include "../lib/grn-assertions.h"
31 static gchar *tmp_directory;
37 static unsigned n_keys;
44 "table-sort-key-from-str",
51 g_free(tmp_directory);
55 remove_tmp_directory(
void)
57 cut_remove_path(tmp_directory, NULL);
63 const gchar *database_path;
65 remove_tmp_directory();
66 g_mkdir_with_parents(tmp_directory, 0700);
71 database_path = cut_build_path(tmp_directory,
"database.groonga", NULL);
93 remove_tmp_directory();
99 #define ADD_DATUM(str, count) \
100 gcut_add_datum("[" str "] == " #count, \
101 "keys", G_TYPE_STRING, str, \
102 "count", G_TYPE_UINT, count, \
128 const char *str = gcut_data_get_string(data,
"keys");
131 cut_assert_not_null(keys);
132 cut_assert_equal_uint(gcut_data_get_uint(data,
"count"), n_keys);
133 for (i = 0; i < n_keys; ++
i) {
134 cut_assert_not_null(keys[i].key);
141 #define ADD_DATUM(str) \
142 gcut_add_datum("[" str "] is invalid", \
143 "keys", G_TYPE_STRING, str, \
160 const char *str = gcut_data_get_string(data,
"keys");
163 cut_assert_null(keys);
164 cut_assert_equal_uint(0, nkeys);