[Groonga-commit] groonga/grnxx at 93d4894 [master] Add a test for DoubleArray.

Back to archive index

susumu.yata null+****@clear*****
Tue Jun 11 13:10:14 JST 2013


susumu.yata	2013-06-11 13:10:14 +0900 (Tue, 11 Jun 2013)

  New Revision: 93d48945b9fb74ae6d3808cd144bdfa92f583b9a
  https://github.com/groonga/grnxx/commit/93d48945b9fb74ae6d3808cd144bdfa92f583b9a

  Message:
    Add a test for DoubleArray.

  Modified files:
    test/test_map.cpp

  Modified: test/test_map.cpp (+20 -21)
===================================================================
--- test/test_map.cpp    2013-06-11 13:09:03 +0900 (70edac0)
+++ test/test_map.cpp    2013-06-11 13:10:14 +0900 (4708dfa)
@@ -688,13 +688,17 @@ void test_map_truncate(grnxx::MapType map_type) {
   std::vector<T> keys;
   generate_random_keys(MAP_NUM_KEYS, &keys);
 
-  for (std::uint64_t i = 0; i < (MAP_NUM_KEYS / 2); ++i) {
+  for (std::uint64_t i = 0; i < MAP_NUM_KEYS; ++i) {
     assert(map->add(keys[i]));
   }
   assert(map->truncate());
   assert(map->max_key_id() == (grnxx::MAP_MIN_KEY_ID - 1));
   assert(map->num_keys() == 0);
-  for (std::uint64_t i = 0; i < (MAP_NUM_KEYS / 2); ++i) {
+  for (std::uint64_t i = 0; i < MAP_NUM_KEYS; ++i) {
+    assert(!map->get(i));
+    assert(!map->find(keys[i]));
+  }
+  for (std::uint64_t i = 0; i < MAP_NUM_KEYS; ++i) {
     assert(map->add(keys[i]));
   }
 }
@@ -924,6 +928,7 @@ void test_map_create_scanner<grnxx::Bytes>(grnxx::MapType map_type) {
 
 template <typename T>
 void test_map(grnxx::MapType map_type) {
+  GRNXX_NOTICE() << __PRETTY_FUNCTION__ << ": map_type = " << map_type;
   test_map_create<T>(map_type);
   test_map_open<T>(map_type);
   test_map_unlink<T>(map_type);
@@ -952,18 +957,11 @@ void test_map(grnxx::MapType map_type) {
 }
 
 template <typename T>
-void test_map(T) {
-  GRNXX_NOTICE() << __PRETTY_FUNCTION__;
+void test_map() {
   test_map<T>(grnxx::MAP_ARRAY);
   test_map<T>(grnxx::MAP_HASH_TABLE);
 }
 
-template <typename T, typename... U>
-void test_map(T, U... args) {
-  test_map(T());
-  test_map(args...);
-}
-
 void test_bytes_store() {
   test_bytes_store_create();
   test_bytes_store_open();
@@ -986,17 +984,18 @@ void test_bytes_array() {
 }
 
 void test_map() {
-  test_map(std::int8_t(),
-           std::uint8_t(),
-           std::int16_t(),
-           std::uint16_t(),
-           std::int32_t(),
-           std::uint32_t(),
-           std::int64_t(),
-           std::uint64_t(),
-           double(),
-           grnxx::GeoPoint(),
-           grnxx::Bytes());
+  test_map<std::int8_t>();
+  test_map<std::uint8_t>();
+  test_map<std::int16_t>();
+  test_map<std::uint16_t>();
+  test_map<std::int32_t>();
+  test_map<std::uint32_t>();
+  test_map<std::int64_t>();
+  test_map<std::uint64_t>();
+  test_map<double>();
+  test_map<grnxx::GeoPoint>();
+  test_map<grnxx::Bytes>();
+  test_map<grnxx::Bytes>(grnxx::MAP_DOUBLE_ARRAY);
 }
 
 }  // namespace
-------------- next part --------------
HTML����������������������������...
Download 



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