[Groonga-commit] groonga/grnxx at 9f62e01 [master] Add a test for Column<Vector<Int>>. (#110)

Back to archive index

susumu.yata null+****@clear*****
Tue Dec 16 10:53:50 JST 2014


susumu.yata	2014-11-17 17:32:18 +0900 (Mon, 17 Nov 2014)

  New Revision: 9f62e0188819d510e54ed074b58e3677fd1deba5
  https://github.com/groonga/grnxx/commit/9f62e0188819d510e54ed074b58e3677fd1deba5

  Message:
    Add a test for Column<Vector<Int>>. (#110)

  Modified files:
    test/test_column.cpp

  Modified: test/test_column.cpp (+23 -13)
===================================================================
--- test/test_column.cpp    2014-11-17 17:31:49 +0900 (a24aef1)
+++ test/test_column.cpp    2014-11-17 17:32:18 +0900 (76e7676)
@@ -100,16 +100,15 @@ void test_column() {
   assert(!bool_vector_column->is_key());
 //  assert(bool_vector_column->num_indexes() == 0);
 
-//  // Create a column named "IntVectorColumn".
-//  // The column stores Text values.
-//  auto int_vector_column = table->create_column(&error, "IntVectorColumn",
-//                                                 grnxx::INT_VECTOR_DATA);
-//  assert(int_vector_column);
-//  assert(int_vector_column->table() == table);
-//  assert(int_vector_column->name() == "IntVectorColumn");
-//  assert(int_vector_column->data_type() == grnxx::INT_VECTOR_DATA);
-//  assert(!int_vector_column->ref_table());
-//  assert(!int_vector_column->has_key_attribute());
+  // Create a column named "IntVector".
+  // The column stores Text values.
+  auto int_vector_column =
+      table->create_column("IntVector", grnxx::INT_VECTOR_DATA);
+  assert(int_vector_column->table() == table);
+  assert(int_vector_column->name() == "IntVector");
+  assert(int_vector_column->data_type() == grnxx::INT_VECTOR_DATA);
+  assert(!int_vector_column->reference_table());
+  assert(!int_vector_column->is_key());
 //  assert(int_vector_column->num_indexes() == 0);
 
 //  // Create a column named "FloatVectorColumn".
@@ -193,9 +192,9 @@ void test_column() {
   assert(datum.type() == grnxx::BOOL_VECTOR_DATA);
   assert(datum.as_bool_vector().is_na());
 
-//  assert(int_vector_column->get(&error, 1, &datum));
-//  assert(datum.type() == grnxx::INT_VECTOR_DATA);
-//  assert(datum.force_int_vector() == grnxx::IntVector(nullptr, 0));
+  int_vector_column->get(row_id, &datum);
+  assert(datum.type() == grnxx::INT_VECTOR_DATA);
+  assert(datum.as_int_vector().is_na());
 
 //  assert(float_vector_column->get(&error, 1, &datum));
 //  assert(datum.type() == grnxx::FLOAT_VECTOR_DATA);
@@ -258,6 +257,17 @@ void test_column() {
   assert(datum.type() == grnxx::BOOL_VECTOR_DATA);
   assert((datum.as_bool_vector() == bool_vector).is_true());
 
+  grnxx::Int int_vector_value[] = {
+    grnxx::Int(123),
+    grnxx::Int(-456),
+    grnxx::Int(789)
+  };
+  grnxx::IntVector int_vector(int_vector_value, 3);
+  int_vector_column->set(row_id, int_vector);
+  int_vector_column->get(row_id, &datum);
+  assert(datum.type() == grnxx::INT_VECTOR_DATA);
+  assert((datum.as_int_vector() == int_vector).is_true());
+
 //  // Set and get values.
 //  grnxx::Int int_vector_value[] = { 123, -456, 789 };
 //  assert(int_vector_column->set(&error, 1,
-------------- next part --------------
HTML����������������������������...
下载 



More information about the Groonga-commit mailing list
Back to archive index