[Groonga-commit] groonga/grnxx at 76c90e9 [master] Add tests for row reuse.

Back to archive index

susumu.yata null+****@clear*****
Tue Jul 22 13:33:51 JST 2014


susumu.yata	2014-07-22 13:33:51 +0900 (Tue, 22 Jul 2014)

  New Revision: 76c90e9de01272679587d17763e66995993e0b93
  https://github.com/groonga/grnxx/commit/76c90e9de01272679587d17763e66995993e0b93

  Message:
    Add tests for row reuse.

  Modified files:
    test/test_grnxx.cpp

  Modified: test/test_grnxx.cpp (+44 -0)
===================================================================
--- test/test_grnxx.cpp    2014-07-22 13:33:03 +0900 (28fbd11)
+++ test/test_grnxx.cpp    2014-07-22 13:33:51 +0900 (1f59edb)
@@ -227,6 +227,49 @@ void test_table() {
   assert(record_set.get(1).row_id == 1);
 }
 
+void test_bitmap() {
+  constexpr int NUM_ROWS = 1 << 14;
+
+  grnxx::Error error;
+
+  auto db = grnxx::open_db(&error, "");
+  assert(db);
+
+  auto table = db->create_table(&error, "Table");
+  assert(table);
+
+  for (int i = 0; i < NUM_ROWS; ++i) {
+    grnxx::Int row_id;
+    assert(table->insert_row(&error, grnxx::NULL_ROW_ID,
+                             grnxx::Datum(), &row_id));
+    assert(row_id == (i + 1));
+  }
+
+  for (int i = 0; i < NUM_ROWS; ++i) {
+    grnxx::Int row_id = i + 1;
+    assert(table->remove_row(&error, row_id));
+  }
+
+  for (int i = 0; i < NUM_ROWS; ++i) {
+    grnxx::Int row_id;
+    assert(table->insert_row(&error, grnxx::NULL_ROW_ID,
+                             grnxx::Datum(), &row_id));
+    assert(row_id == (i + 1));
+  }
+
+  for (int i = 0; i < NUM_ROWS; i += 2) {
+    grnxx::Int row_id = i + 1;
+    assert(table->remove_row(&error, row_id));
+  }
+
+  for (int i = 0; i < NUM_ROWS; i += 2) {
+    grnxx::Int row_id;
+    assert(table->insert_row(&error, grnxx::NULL_ROW_ID,
+                             grnxx::Datum(), &row_id));
+    assert(row_id == (i + 1));
+  }
+}
+
 void test_column() {
   grnxx::Error error;
 
@@ -609,6 +652,7 @@ void test_expression() {
 int main() {
   test_db();
   test_table();
+  test_bitmap();
   test_column();
   test_expression();
 
-------------- next part --------------
HTML����������������������������...
Download 



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