null+****@clear*****
null+****@clear*****
2010年 6月 14日 (月) 11:20:07 JST
Kouhei Sutou 2010-06-14 02:20:07 +0000 (Mon, 14 Jun 2010) New Revision: 94e2bbd7a47797a3236f5dffe852cf1ebd5d967c Log: add a test for Bug #123. Modified files: test/unit/core/test-load.c Modified: test/unit/core/test-load.c (+40 -5) =================================================================== --- test/unit/core/test-load.c 2010-06-14 01:22:58 +0000 (66dd318) +++ test/unit/core/test-load.c 2010-06-14 02:20:07 +0000 (d1ac8d6) @@ -24,6 +24,8 @@ #include <str.h> void test_columns(void); +void attributes_bool(void); +void test_bool(void); static gchar *tmp_directory; @@ -83,11 +85,13 @@ test_columns(void) assert_send_command("table_create Users TABLE_HASH_KEY ShortText"); assert_send_command("column_create Users name COLUMN_SCALAR ShortText"); assert_send_command("column_create Users desc COLUMN_SCALAR ShortText"); - assert_send_command("load --table Users --columns '_key,name,desc'\n" - "[\n" - " [\"mori\", \"モリ\", \"タポ\"],\n" - " [\"tapo\", \"タポ\", \"モリモリモリタポ\"]\n" - "]"); + cut_assert_equal_string( + "2", + send_command("load --table Users --columns '_key,name,desc'\n" + "[\n" + " [\"mori\", \"モリ\", \"タポ\"],\n" + " [\"tapo\", \"タポ\", \"モリモリモリタポ\"]\n" + "]")); cut_assert_equal_string("[[[2]," "[" "[\"_id\",\"UInt32\"]," @@ -100,3 +104,34 @@ test_columns(void) "]]", send_command("select Users")); } + +void +attributes_bool(void) +{ + cut_set_attributes("bug", "123", + NULL); +} + +void +test_bool(void) +{ + assert_send_command("table_create Users TABLE_HASH_KEY ShortText"); + assert_send_command("column_create Users enabled COLUMN_SCALAR Bool"); + cut_assert_equal_string( + "2", + send_command("load --table Users --columns '_key,enabled'\n" + "[\n" + " [\"mori\",true],\n" + " [\"tapo\",false]\n" + "]")); + cut_assert_equal_string("[[[2]," + "[" + "[\"_id\",\"UInt32\"]," + "[\"_key\",\"ShortText\"]," + "[\"enabled\",\"Bool\"]" + "]," + "[1,\"mori\",true]," + "[2,\"tapo\",false]" + "]]", + send_command("select Users")); +}