[Groonga-commit] groonga/grnxx at 3a8b843 [new_data_types] Enable a test for Column<Bool>.

Back to archive index

susumu.yata null+****@clear*****
Thu Nov 6 11:24:14 JST 2014


susumu.yata	2014-11-06 11:24:14 +0900 (Thu, 06 Nov 2014)

  New Revision: 3a8b843624303620304843c2faa9838b77d67f43
  https://github.com/groonga/grnxx/commit/3a8b843624303620304843c2faa9838b77d67f43

  Message:
    Enable a test for Column<Bool>.

  Modified files:
    test/Makefile.am
    test/test_column.cpp

  Modified: test/Makefile.am (+4 -4)
===================================================================
--- test/Makefile.am    2014-11-06 11:24:04 +0900 (0bb6481)
+++ test/Makefile.am    2014-11-06 11:24:14 +0900 (0df50fc)
@@ -3,9 +3,9 @@ TESTS =				\
 	test_data_types		\
 	test_string		\
 	test_db			\
-	test_table
+	test_table		\
+	test_column
 
-#	test_column		\
 #	test_index		\
 #	test_expression		\
 #	test_merger		\
@@ -30,8 +30,8 @@ test_db_LDADD = $(top_srcdir)/lib/grnxx/libgrnxx.la
 test_table_SOURCES = test_table.cpp
 test_table_LDADD = $(top_srcdir)/lib/grnxx/libgrnxx.la
 
-#test_column_SOURCES = test_column.cpp
-#test_column_LDADD = $(top_srcdir)/lib/grnxx/libgrnxx.la
+test_column_SOURCES = test_column.cpp
+test_column_LDADD = $(top_srcdir)/lib/grnxx/libgrnxx.la
 
 #test_index_SOURCES = test_index.cpp
 #test_index_LDADD = $(top_srcdir)/lib/grnxx/libgrnxx.la

  Modified: test/test_column.cpp (+260 -268)
===================================================================
--- test/test_column.cpp    2014-11-06 11:24:04 +0900 (fef344b)
+++ test/test_column.cpp    2014-11-06 11:24:14 +0900 (7801f37)
@@ -19,305 +19,297 @@
 #include <iostream>
 
 #include "grnxx/column.hpp"
-#include "grnxx/cursor.hpp"
 #include "grnxx/db.hpp"
 #include "grnxx/table.hpp"
 
 void test_column() {
-  grnxx::Error error;
-
   // Create a database with the default options.
-  auto db = grnxx::open_db(&error, "");
-  assert(db);
+  auto db = grnxx::open_db("");
 
   // Create a table with the default options.
-  auto table = db->create_table(&error, "Table");
-  assert(table);
+  auto table = db->create_table("Table");
 
   // Append the first row.
-  grnxx::Int row_id;
-  assert(table->insert_row(&error, grnxx::NULL_ROW_ID,
-                           grnxx::Datum(), &row_id));
+  grnxx::Int row_id = table->insert_row();
 
-  // Create a column named "BoolColumn".
+  // Create a column named "Bool".
   // The column stores Bool values.
-  auto bool_column = table->create_column(&error, "BoolColumn",
-                                          grnxx::BOOL_DATA);
-  assert(bool_column);
+  auto bool_column = table->create_column("Bool", grnxx::BOOL_DATA);
   assert(bool_column->table() == table);
-  assert(bool_column->name() == "BoolColumn");
+  assert(bool_column->name() == "Bool");
   assert(bool_column->data_type() == grnxx::BOOL_DATA);
-  assert(!bool_column->ref_table());
-  assert(!bool_column->has_key_attribute());
-  assert(bool_column->num_indexes() == 0);
-
-  // Create a column named "IntColumn".
-  // The column stores Int values.
-  auto int_column = table->create_column(&error, "IntColumn",
-                                         grnxx::INT_DATA);
-  assert(int_column);
-  assert(int_column->table() == table);
-  assert(int_column->name() == "IntColumn");
-  assert(int_column->data_type() == grnxx::INT_DATA);
-  assert(!int_column->ref_table());
-  assert(!int_column->has_key_attribute());
-  assert(int_column->num_indexes() == 0);
-
-  // Create a column named "FloatColumn".
-  // The column stores Float values.
-  auto float_column = table->create_column(&error, "FloatColumn",
-                                           grnxx::FLOAT_DATA);
-  assert(float_column);
-  assert(float_column->table() == table);
-  assert(float_column->name() == "FloatColumn");
-  assert(float_column->data_type() == grnxx::FLOAT_DATA);
-  assert(!float_column->ref_table());
-  assert(!float_column->has_key_attribute());
-  assert(float_column->num_indexes() == 0);
-
-  // Create a column named "GeoPointColumn".
-  // The column stores GeoPoint values.
-  auto geo_point_column = table->create_column(&error, "GeoPointColumn",
-                                               grnxx::GEO_POINT_DATA);
-  assert(geo_point_column);
-  assert(geo_point_column->table() == table);
-  assert(geo_point_column->name() == "GeoPointColumn");
-  assert(geo_point_column->data_type() == grnxx::GEO_POINT_DATA);
-  assert(!geo_point_column->ref_table());
-  assert(!geo_point_column->has_key_attribute());
-  assert(geo_point_column->num_indexes() == 0);
-
-  // Create a column named "TextColumn".
-  // The column stores Text values.
-  auto text_column = table->create_column(&error, "TextColumn",
-                                           grnxx::TEXT_DATA);
-  assert(text_column);
-  assert(text_column->table() == table);
-  assert(text_column->name() == "TextColumn");
-  assert(text_column->data_type() == grnxx::TEXT_DATA);
-  assert(!text_column->ref_table());
-  assert(!text_column->has_key_attribute());
-  assert(text_column->num_indexes() == 0);
-
-  // Create a column named "BoolVectorColumn".
-  // The column stores Text values.
-  auto bool_vector_column = table->create_column(&error, "BoolVectorColumn",
-                                                 grnxx::BOOL_VECTOR_DATA);
-  assert(bool_vector_column);
-  assert(bool_vector_column->table() == table);
-  assert(bool_vector_column->name() == "BoolVectorColumn");
-  assert(bool_vector_column->data_type() == grnxx::BOOL_VECTOR_DATA);
-  assert(!bool_vector_column->ref_table());
-  assert(!bool_vector_column->has_key_attribute());
-  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());
-  assert(int_vector_column->num_indexes() == 0);
-
-  // Create a column named "FloatVectorColumn".
-  // The column stores Text values.
-  auto float_vector_column = table->create_column(&error, "FloatVectorColumn",
-                                                  grnxx::FLOAT_VECTOR_DATA);
-  assert(float_vector_column);
-  assert(float_vector_column->table() == table);
-  assert(float_vector_column->name() == "FloatVectorColumn");
-  assert(float_vector_column->data_type() == grnxx::FLOAT_VECTOR_DATA);
-  assert(!float_vector_column->ref_table());
-  assert(!float_vector_column->has_key_attribute());
-  assert(float_vector_column->num_indexes() == 0);
-
-  // Create a column named "GeoPointVectorColumn".
-  // The column stores Text values.
-  auto geo_point_vector_column = table->create_column(
-      &error, "GeoPointVectorColumn", grnxx::GEO_POINT_VECTOR_DATA);
-  assert(geo_point_vector_column);
-  assert(geo_point_vector_column->table() == table);
-  assert(geo_point_vector_column->name() == "GeoPointVectorColumn");
-  assert(geo_point_vector_column->data_type() == grnxx::GEO_POINT_VECTOR_DATA);
-  assert(!geo_point_vector_column->ref_table());
-  assert(!geo_point_vector_column->has_key_attribute());
-  assert(geo_point_vector_column->num_indexes() == 0);
-
-  // Create a column named "TextVectorColumn".
-  // The column stores Text values.
-  auto text_vector_column = table->create_column(&error, "TextVectorColumn",
-                                                 grnxx::TEXT_VECTOR_DATA);
-  assert(text_vector_column);
-  assert(text_vector_column->table() == table);
-  assert(text_vector_column->name() == "TextVectorColumn");
-  assert(text_vector_column->data_type() == grnxx::TEXT_VECTOR_DATA);
-  assert(!text_vector_column->ref_table());
-  assert(!text_vector_column->has_key_attribute());
-  assert(text_vector_column->num_indexes() == 0);
-
-  // Create a column named "RefColumn".
-  // The column stores Int values.
-  grnxx::ColumnOptions options;
-  options.ref_table_name = "Table";
-  auto ref_column = table->create_column(&error, "RefColumn",
-                                         grnxx::INT_DATA, options);
-  assert(ref_column);
-  assert(ref_column->table() == table);
-  assert(ref_column->name() == "RefColumn");
-  assert(ref_column->data_type() == grnxx::INT_DATA);
-  assert(ref_column->ref_table());
-  assert(!ref_column->has_key_attribute());
-  assert(ref_column->num_indexes() == 0);
-
-  // Create a column named "RefVectorColumn".
-  // The column stores Int values.
-  options.ref_table_name = "Table";
-  auto ref_vector_column =
-      table->create_column(&error, "RefVectorColumn",
-                           grnxx::INT_VECTOR_DATA, options);
-  assert(ref_vector_column);
-  assert(ref_vector_column->table() == table);
-  assert(ref_vector_column->name() == "RefVectorColumn");
-  assert(ref_vector_column->data_type() == grnxx::INT_VECTOR_DATA);
-  assert(ref_vector_column->ref_table());
-  assert(!ref_vector_column->has_key_attribute());
-  assert(ref_vector_column->num_indexes() == 0);
+  assert(!bool_column->reference_table());
+  assert(!bool_column->is_key());
+//  assert(bool_column->num_indexes() == 0);
+
+//  // Create a column named "IntColumn".
+//  // The column stores Int values.
+//  auto int_column = table->create_column(&error, "IntColumn",
+//                                         grnxx::INT_DATA);
+//  assert(int_column);
+//  assert(int_column->table() == table);
+//  assert(int_column->name() == "IntColumn");
+//  assert(int_column->data_type() == grnxx::INT_DATA);
+//  assert(!int_column->ref_table());
+//  assert(!int_column->has_key_attribute());
+//  assert(int_column->num_indexes() == 0);
+
+//  // Create a column named "FloatColumn".
+//  // The column stores Float values.
+//  auto float_column = table->create_column(&error, "FloatColumn",
+//                                           grnxx::FLOAT_DATA);
+//  assert(float_column);
+//  assert(float_column->table() == table);
+//  assert(float_column->name() == "FloatColumn");
+//  assert(float_column->data_type() == grnxx::FLOAT_DATA);
+//  assert(!float_column->ref_table());
+//  assert(!float_column->has_key_attribute());
+//  assert(float_column->num_indexes() == 0);
+
+//  // Create a column named "GeoPointColumn".
+//  // The column stores GeoPoint values.
+//  auto geo_point_column = table->create_column(&error, "GeoPointColumn",
+//                                               grnxx::GEO_POINT_DATA);
+//  assert(geo_point_column);
+//  assert(geo_point_column->table() == table);
+//  assert(geo_point_column->name() == "GeoPointColumn");
+//  assert(geo_point_column->data_type() == grnxx::GEO_POINT_DATA);
+//  assert(!geo_point_column->ref_table());
+//  assert(!geo_point_column->has_key_attribute());
+//  assert(geo_point_column->num_indexes() == 0);
+
+//  // Create a column named "TextColumn".
+//  // The column stores Text values.
+//  auto text_column = table->create_column(&error, "TextColumn",
+//                                           grnxx::TEXT_DATA);
+//  assert(text_column);
+//  assert(text_column->table() == table);
+//  assert(text_column->name() == "TextColumn");
+//  assert(text_column->data_type() == grnxx::TEXT_DATA);
+//  assert(!text_column->ref_table());
+//  assert(!text_column->has_key_attribute());
+//  assert(text_column->num_indexes() == 0);
+
+//  // Create a column named "BoolVectorColumn".
+//  // The column stores Text values.
+//  auto bool_vector_column = table->create_column(&error, "BoolVectorColumn",
+//                                                 grnxx::BOOL_VECTOR_DATA);
+//  assert(bool_vector_column);
+//  assert(bool_vector_column->table() == table);
+//  assert(bool_vector_column->name() == "BoolVectorColumn");
+//  assert(bool_vector_column->data_type() == grnxx::BOOL_VECTOR_DATA);
+//  assert(!bool_vector_column->ref_table());
+//  assert(!bool_vector_column->has_key_attribute());
+//  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());
+//  assert(int_vector_column->num_indexes() == 0);
+
+//  // Create a column named "FloatVectorColumn".
+//  // The column stores Text values.
+//  auto float_vector_column = table->create_column(&error, "FloatVectorColumn",
+//                                                  grnxx::FLOAT_VECTOR_DATA);
+//  assert(float_vector_column);
+//  assert(float_vector_column->table() == table);
+//  assert(float_vector_column->name() == "FloatVectorColumn");
+//  assert(float_vector_column->data_type() == grnxx::FLOAT_VECTOR_DATA);
+//  assert(!float_vector_column->ref_table());
+//  assert(!float_vector_column->has_key_attribute());
+//  assert(float_vector_column->num_indexes() == 0);
+
+//  // Create a column named "GeoPointVectorColumn".
+//  // The column stores Text values.
+//  auto geo_point_vector_column = table->create_column(
+//      &error, "GeoPointVectorColumn", grnxx::GEO_POINT_VECTOR_DATA);
+//  assert(geo_point_vector_column);
+//  assert(geo_point_vector_column->table() == table);
+//  assert(geo_point_vector_column->name() == "GeoPointVectorColumn");
+//  assert(geo_point_vector_column->data_type() == grnxx::GEO_POINT_VECTOR_DATA);
+//  assert(!geo_point_vector_column->ref_table());
+//  assert(!geo_point_vector_column->has_key_attribute());
+//  assert(geo_point_vector_column->num_indexes() == 0);
+
+//  // Create a column named "TextVectorColumn".
+//  // The column stores Text values.
+//  auto text_vector_column = table->create_column(&error, "TextVectorColumn",
+//                                                 grnxx::TEXT_VECTOR_DATA);
+//  assert(text_vector_column);
+//  assert(text_vector_column->table() == table);
+//  assert(text_vector_column->name() == "TextVectorColumn");
+//  assert(text_vector_column->data_type() == grnxx::TEXT_VECTOR_DATA);
+//  assert(!text_vector_column->ref_table());
+//  assert(!text_vector_column->has_key_attribute());
+//  assert(text_vector_column->num_indexes() == 0);
+
+//  // Create a column named "RefColumn".
+//  // The column stores Int values.
+//  grnxx::ColumnOptions options;
+//  options.ref_table_name = "Table";
+//  auto ref_column = table->create_column(&error, "RefColumn",
+//                                         grnxx::INT_DATA, options);
+//  assert(ref_column);
+//  assert(ref_column->table() == table);
+//  assert(ref_column->name() == "RefColumn");
+//  assert(ref_column->data_type() == grnxx::INT_DATA);
+//  assert(ref_column->ref_table());
+//  assert(!ref_column->has_key_attribute());
+//  assert(ref_column->num_indexes() == 0);
+
+//  // Create a column named "RefVectorColumn".
+//  // The column stores Int values.
+//  options.ref_table_name = "Table";
+//  auto ref_vector_column =
+//      table->create_column(&error, "RefVectorColumn",
+//                           grnxx::INT_VECTOR_DATA, options);
+//  assert(ref_vector_column);
+//  assert(ref_vector_column->table() == table);
+//  assert(ref_vector_column->name() == "RefVectorColumn");
+//  assert(ref_vector_column->data_type() == grnxx::INT_VECTOR_DATA);
+//  assert(ref_vector_column->ref_table());
+//  assert(!ref_vector_column->has_key_attribute());
+//  assert(ref_vector_column->num_indexes() == 0);
 
+  // Check that the default values are stored.
   grnxx::Datum datum;
 
-  // Check that the default values are stored.
-  assert(bool_column->get(&error, 1, &datum));
+  bool_column->get(row_id, &datum);
   assert(datum.type() == grnxx::BOOL_DATA);
-  assert(!datum.force_bool());
+  assert(datum.as_bool().is_na());
 
-  assert(int_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::INT_DATA);
-  assert(datum.force_int() == 0);
+//  assert(int_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::INT_DATA);
+//  assert(datum.force_int() == 0);
 
-  assert(float_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::FLOAT_DATA);
-  assert(datum.force_float() == 0.0);
+//  assert(float_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::FLOAT_DATA);
+//  assert(datum.force_float() == 0.0);
 
-  assert(geo_point_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::GEO_POINT_DATA);
-  assert(datum.force_geo_point() == grnxx::GeoPoint(0, 0));
+//  assert(geo_point_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::GEO_POINT_DATA);
+//  assert(datum.force_geo_point() == grnxx::GeoPoint(0, 0));
 
-  assert(text_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::TEXT_DATA);
-  assert(datum.force_text() == "");
+//  assert(text_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::TEXT_DATA);
+//  assert(datum.force_text() == "");
 
-  assert(bool_vector_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::BOOL_VECTOR_DATA);
-  assert(datum.force_bool_vector() == grnxx::BoolVector{});
+//  assert(bool_vector_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::BOOL_VECTOR_DATA);
+//  assert(datum.force_bool_vector() == grnxx::BoolVector{});
 
-  assert(int_vector_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::INT_VECTOR_DATA);
-  assert(datum.force_int_vector() == grnxx::IntVector(nullptr, 0));
+//  assert(int_vector_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::INT_VECTOR_DATA);
+//  assert(datum.force_int_vector() == grnxx::IntVector(nullptr, 0));
 
-  assert(float_vector_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::FLOAT_VECTOR_DATA);
-  assert(datum.force_float_vector() == grnxx::FloatVector(nullptr, 0));
+//  assert(float_vector_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::FLOAT_VECTOR_DATA);
+//  assert(datum.force_float_vector() == grnxx::FloatVector(nullptr, 0));
 
-  assert(geo_point_vector_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::GEO_POINT_VECTOR_DATA);
-  assert(datum.force_geo_point_vector() == grnxx::GeoPointVector(nullptr, 0));
+//  assert(geo_point_vector_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::GEO_POINT_VECTOR_DATA);
+//  assert(datum.force_geo_point_vector() == grnxx::GeoPointVector(nullptr, 0));
 
-  assert(text_vector_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::TEXT_VECTOR_DATA);
-  assert(datum.force_text_vector() == grnxx::TextVector(nullptr, 0));
+//  assert(text_vector_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::TEXT_VECTOR_DATA);
+//  assert(datum.force_text_vector() == grnxx::TextVector(nullptr, 0));
 
-  assert(ref_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::INT_DATA);
-  assert(datum.force_int() == 0);
+//  assert(ref_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::INT_DATA);
+//  assert(datum.force_int() == 0);
 
-  assert(ref_vector_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::INT_VECTOR_DATA);
-  assert(datum.force_int_vector() == grnxx::IntVector(nullptr, 0));
+//  assert(ref_vector_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::INT_VECTOR_DATA);
+//  assert(datum.force_int_vector() == grnxx::IntVector(nullptr, 0));
 
   // Set and get values.
-  assert(bool_column->set(&error, 1, grnxx::Bool(true)));
-  assert(int_column->set(&error, 1, grnxx::Int(123)));
-  assert(float_column->set(&error, 1, grnxx::Float(0.25)));
-  assert(geo_point_column->set(&error, 1, grnxx::GeoPoint(123, 456)));
-  assert(text_column->set(&error, 1, grnxx::Text("Hello, world!")));
-  assert(bool_vector_column->set(&error, 1,
-                                 grnxx::BoolVector{ true, false, true }));
-  grnxx::Int int_vector_value[] = { 123, -456, 789 };
-  assert(int_vector_column->set(&error, 1,
-                                grnxx::IntVector(int_vector_value, 3)));
-  grnxx::Float float_vector_value[] = { 1.23, -4.56, 7.89 };
-  assert(float_vector_column->set(&error, 1,
-                                  grnxx::FloatVector(float_vector_value, 3)));
-  grnxx::GeoPoint geo_point_vector_value[] = {
-    { 123, 456 }, { 789, 123 }, { 456, 789 }
-  };
-  assert(geo_point_vector_column->set(
-      &error, 1, grnxx::GeoPointVector(geo_point_vector_value, 3)));
-  grnxx::Text text_vector_value[] = { "abc", "DEF", "ghi" };
-  assert(text_vector_column->set(&error, 1,
-                                 grnxx::TextVector(text_vector_value, 3)));
-  assert(ref_column->set(&error, 1, grnxx::Int(1)));
-  grnxx::Int ref_vector_value[] = { 1, 1, 1 };
-  assert(ref_vector_column->set(&error, 1,
-                                grnxx::IntVector(ref_vector_value, 3)));
-
-  assert(bool_column->get(&error, 1, &datum));
+  bool_column->set(row_id, grnxx::Bool(true));
+  bool_column->get(row_id, &datum);
   assert(datum.type() == grnxx::BOOL_DATA);
-  assert(datum.force_bool());
-
-  assert(int_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::INT_DATA);
-  assert(datum.force_int() == 123);
-
-  assert(float_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::FLOAT_DATA);
-  assert(datum.force_float() == 0.25);
-
-  assert(geo_point_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::GEO_POINT_DATA);
-  assert(datum.force_geo_point() == grnxx::GeoPoint(123, 456));
-
-  assert(text_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::TEXT_DATA);
-  assert(datum.force_text() == "Hello, world!");
-
-  assert(bool_vector_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::BOOL_VECTOR_DATA);
-  assert(datum.force_bool_vector() ==
-         grnxx::BoolVector({ true, false, true }));
-
-  assert(int_vector_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::INT_VECTOR_DATA);
-  assert(datum.force_int_vector() ==
-         grnxx::IntVector(int_vector_value, 3));
-
-  assert(float_vector_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::FLOAT_VECTOR_DATA);
-  assert(datum.force_float_vector() ==
-         grnxx::FloatVector(float_vector_value, 3));
-
-  assert(geo_point_vector_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::GEO_POINT_VECTOR_DATA);
-  assert(datum.force_geo_point_vector() ==
-         grnxx::GeoPointVector(geo_point_vector_value, 3));
-
-  assert(text_vector_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::TEXT_VECTOR_DATA);
-  assert(datum.force_text_vector() ==
-         grnxx::TextVector(text_vector_value, 3));
-
-  assert(ref_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::INT_DATA);
-  assert(datum.force_int() == 1);
-
-  assert(ref_vector_column->get(&error, 1, &datum));
-  assert(datum.type() == grnxx::INT_VECTOR_DATA);
-  assert(datum.force_int_vector() ==
-         grnxx::IntVector(ref_vector_value, 3));
+  assert(datum.as_bool() == grnxx::Bool(true));
+
+//  // Set and get values.
+//  assert(int_column->set(&error, 1, grnxx::Int(123)));
+//  assert(float_column->set(&error, 1, grnxx::Float(0.25)));
+//  assert(geo_point_column->set(&error, 1, grnxx::GeoPoint(123, 456)));
+//  assert(text_column->set(&error, 1, grnxx::Text("Hello, world!")));
+//  assert(bool_vector_column->set(&error, 1,
+//                                 grnxx::BoolVector{ true, false, true }));
+//  grnxx::Int int_vector_value[] = { 123, -456, 789 };
+//  assert(int_vector_column->set(&error, 1,
+//                                grnxx::IntVector(int_vector_value, 3)));
+//  grnxx::Float float_vector_value[] = { 1.23, -4.56, 7.89 };
+//  assert(float_vector_column->set(&error, 1,
+//                                  grnxx::FloatVector(float_vector_value, 3)));
+//  grnxx::GeoPoint geo_point_vector_value[] = {
+//    { 123, 456 }, { 789, 123 }, { 456, 789 }
+//  };
+//  assert(geo_point_vector_column->set(
+//      &error, 1, grnxx::GeoPointVector(geo_point_vector_value, 3)));
+//  grnxx::Text text_vector_value[] = { "abc", "DEF", "ghi" };
+//  assert(text_vector_column->set(&error, 1,
+//                                 grnxx::TextVector(text_vector_value, 3)));
+//  assert(ref_column->set(&error, 1, grnxx::Int(1)));
+//  grnxx::Int ref_vector_value[] = { 1, 1, 1 };
+//  assert(ref_vector_column->set(&error, 1,
+//                                grnxx::IntVector(ref_vector_value, 3)));
+
+//  assert(int_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::INT_DATA);
+//  assert(datum.force_int() == 123);
+
+//  assert(float_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::FLOAT_DATA);
+//  assert(datum.force_float() == 0.25);
+
+//  assert(geo_point_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::GEO_POINT_DATA);
+//  assert(datum.force_geo_point() == grnxx::GeoPoint(123, 456));
+
+//  assert(text_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::TEXT_DATA);
+//  assert(datum.force_text() == "Hello, world!");
+
+//  assert(bool_vector_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::BOOL_VECTOR_DATA);
+//  assert(datum.force_bool_vector() ==
+//         grnxx::BoolVector({ true, false, true }));
+
+//  assert(int_vector_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::INT_VECTOR_DATA);
+//  assert(datum.force_int_vector() ==
+//         grnxx::IntVector(int_vector_value, 3));
+
+//  assert(float_vector_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::FLOAT_VECTOR_DATA);
+//  assert(datum.force_float_vector() ==
+//         grnxx::FloatVector(float_vector_value, 3));
+
+//  assert(geo_point_vector_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::GEO_POINT_VECTOR_DATA);
+//  assert(datum.force_geo_point_vector() ==
+//         grnxx::GeoPointVector(geo_point_vector_value, 3));
+
+//  assert(text_vector_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::TEXT_VECTOR_DATA);
+//  assert(datum.force_text_vector() ==
+//         grnxx::TextVector(text_vector_value, 3));
+
+//  assert(ref_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::INT_DATA);
+//  assert(datum.force_int() == 1);
+
+//  assert(ref_vector_column->get(&error, 1, &datum));
+//  assert(datum.type() == grnxx::INT_VECTOR_DATA);
+//  assert(datum.force_int_vector() ==
+//         grnxx::IntVector(ref_vector_value, 3));
 }
 
 int main() {
-------------- next part --------------
HTML����������������������������...
下載 



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