null+****@clear*****
null+****@clear*****
2011年 12月 29日 (木) 12:19:37 JST
Ryo Onodera 2011-12-29 12:19:37 +0900 (Thu, 29 Dec 2011)
New Revision: 2e9ba7996bdcedf024647679cb681c5935ba595e
Log:
add tests for table_create command
Modified files:
test/unit/core/test-command-table-create.c
Modified: test/unit/core/test-command-table-create.c (+41 -0)
===================================================================
--- test/unit/core/test-command-table-create.c 2011-12-29 10:43:42 +0900 (8364e8c)
+++ test/unit/core/test-command-table-create.c 2011-12-29 12:19:37 +0900 (ab4fbd1)
@@ -23,6 +23,11 @@
#include <str.h>
+void test_hash_key(void);
+void test_pat_key(void);
+void test_dat_key(void);
+void test_no_key(void);
+
void test_invalid_name(void);
static gchar *tmp_directory;
@@ -76,6 +81,42 @@ cut_teardown(void)
remove_tmp_directory();
}
+static void
+grn_test_assert_users_table_type(unsigned char type)
+{
+ static const char *users = "Users";
+ grn_obj *object = grn_ctx_get(context, users, strlen(users));
+ cut_assert_equal_int(type, object->header.type);
+}
+
+void
+test_hash_key(void)
+{
+ assert_send_command("table_create Users TABLE_HASH_KEY ShortText");
+ grn_test_assert_users_table_type(GRN_TABLE_HASH_KEY);
+}
+
+void
+test_pat_key(void)
+{
+ assert_send_command("table_create Users TABLE_PAT_KEY ShortText");
+ grn_test_assert_users_table_type(GRN_TABLE_PAT_KEY);
+}
+
+void
+test_dat_key(void)
+{
+ assert_send_command("table_create Users TABLE_DAT_KEY ShortText");
+ grn_test_assert_users_table_type(GRN_TABLE_DAT_KEY);
+}
+
+void
+test_no_key(void)
+{
+ assert_send_command("table_create Users TABLE_NO_KEY");
+ grn_test_assert_users_table_type(GRN_TABLE_NO_KEY);
+}
+
void
test_invalid_name(void)
{