[Groonga-commit] groonga/grnxx at 27a304c [master] Add a test for small nodes.

Back to archive index

susumu.yata null+****@clear*****
Sat May 4 00:54:11 JST 2013


susumu.yata	2013-05-04 00:54:11 +0900 (Sat, 04 May 2013)

  New Revision: 27a304c09eb2cf1cafd66ac8a7297650a9ed62d0
  https://github.com/groonga/grnxx/commit/27a304c09eb2cf1cafd66ac8a7297650a9ed62d0

  Message:
    Add a test for small nodes.

  Modified files:
    test/test_storage.cpp

  Modified: test/test_storage.cpp (+16 -1)
===================================================================
--- test/test_storage.cpp    2013-05-04 00:53:44 +0900 (f59f4e1)
+++ test/test_storage.cpp    2013-05-04 00:54:11 +0900 (c3ed9b0)
@@ -543,7 +543,7 @@ void test_storage_sweep() {
   assert(node.is_valid());
   assert(storage->create_node(node.id(), 1 << 18).is_valid());
   assert(storage->create_node(node.id(), 1 << 18).is_valid());
-  const uint64_t total_size = storage->total_size();
+  uint64_t total_size = storage->total_size();
   for (int i = 0; i < 100; ++i) {
     assert(storage->unlink_node(node.id()));
     assert(storage->sweep(grnxx::Duration(0)));
@@ -553,6 +553,21 @@ void test_storage_sweep() {
     assert(storage->create_node(node.id(), 1 << 18).is_valid());
     assert(storage->total_size() == total_size);
   }
+
+  node = storage->create_node(grnxx::STORAGE_ROOT_NODE_ID, 0);
+  assert(node.is_valid());
+  assert(storage->create_node(node.id(), 0).is_valid());
+  assert(storage->create_node(node.id(), 0).is_valid());
+  total_size = storage->total_size();
+  for (int i = 0; i < 100; ++i) {
+    assert(storage->unlink_node(node.id()));
+    assert(storage->sweep(grnxx::Duration(0)));
+    node = storage->create_node(grnxx::STORAGE_ROOT_NODE_ID, 0);
+    assert(node.is_valid());
+    assert(storage->create_node(node.id(), 0).is_valid());
+    assert(storage->create_node(node.id(), 0).is_valid());
+    assert(storage->total_size() == total_size);
+  }
 }
 
 void test_storage_path() {
-------------- next part --------------
HTML����������������������������...
Download 



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