[Groonga-commit] groonga/groonga [master] Added tests for --filter true/false/null.

Back to archive index

null+****@clear***** null+****@clear*****
2010年 8月 3日 (火) 17:11:34 JST


Tasuku SUENAGA a.k.a. gunyarakun	2010-08-03 08:11:34 +0000 (Tue, 03 Aug 2010)

  New Revision: a1bffb0ba3e611ef5f18da26021fe54b3fe95df8

  Log:
    Added tests for --filter true/false/null.

  Modified files:
    test/unit/core/test-command-select.c

  Modified: test/unit/core/test-command-select.c (+61 -0)
===================================================================
--- test/unit/core/test-command-select.c    2010-08-03 06:24:38 +0000 (f74190a)
+++ test/unit/core/test-command-select.c    2010-08-03 08:11:34 +0000 (85447ba)
@@ -31,6 +31,9 @@ void test_vector_int32(void);
 void test_vector_text(void);
 void test_vector_reference_id(void);
 void test_nonexistent_id(void);
+void test_tautology(void);
+void test_contradiction(void);
+void test_filter_null(void);
 void test_bigram_split_symbol_tokenizer(void);
 void test_nonexistent_table(void);
 
@@ -324,6 +327,64 @@ test_nonexistent_id(void)
 }
 
 void
+test_tautology(void)
+{
+  assert_send_commands("table_create Sites TABLE_PAT_KEY ShortText\n"
+                       "column_create Sites link COLUMN_SCALAR Sites\n"
+                       "load --table Sites\n"
+                       "[\n"
+                       "[\"_key\"],\n"
+                       "[\"groonga.org\"],\n"
+                       "[\"razil.jp\"]\n"
+                       "]");
+  cut_assert_equal_string("[[[2],"
+                          "[[\"_id\",\"UInt32\"],"
+                           "[\"_key\",\"ShortText\"]],"
+                           "[1,\"groonga.org\"],[2,\"razil.jp\"]]]",
+                          send_command("select Sites "
+                                       "--output_columns '_id _key' "
+                                       "--filter true"));
+}
+
+void
+test_contradiction(void)
+{
+  assert_send_commands("table_create Sites TABLE_PAT_KEY ShortText\n"
+                       "column_create Sites link COLUMN_SCALAR Sites\n"
+                       "load --table Sites\n"
+                       "[\n"
+                       "[\"_key\"],\n"
+                       "[\"groonga.org\"],\n"
+                       "[\"razil.jp\"]\n"
+                       "]");
+  cut_assert_equal_string("[[[0],"
+                          "[[\"_id\",\"UInt32\"],"
+                           "[\"_key\",\"ShortText\"]]]]",
+                          send_command("select Sites "
+                                       "--output_columns '_id _key' "
+                                       "--filter false"));
+}
+
+void
+test_null(void)
+{
+  assert_send_commands("table_create Sites TABLE_PAT_KEY ShortText\n"
+                       "column_create Sites link COLUMN_SCALAR Sites\n"
+                       "load --table Sites\n"
+                       "[\n"
+                       "[\"_key\"],\n"
+                       "[\"groonga.org\"],\n"
+                       "[\"razil.jp\"]\n"
+                       "]");
+  cut_assert_equal_string("[[[0],"
+                          "[[\"_id\",\"UInt32\"],"
+                           "[\"_key\",\"ShortText\"]]]]",
+                          send_command("select Sites "
+                                       "--output_columns '_id _key' "
+                                       "--filter null"));
+}
+
+void
 test_bigram_split_symbol_tokenizer(void)
 {
   assert_send_commands("table_create Softwares TABLE_HASH_KEY ShortText\n"




Groonga-commit メーリングリストの案内
Back to archive index