From 74d6d518bd30481a75a980efab61f9c7cd33769f Mon Sep 17 00:00:00 2001 From: starlord Date: Wed, 11 Sep 2019 11:53:28 +0800 Subject: [PATCH] refine unittest code Former-commit-id: 07d66baee30ad9ab130ca3cbc75ca50adcb68865 --- cpp/unittest/db/db_tests.cpp | 4 ++-- cpp/unittest/db/mem_test.cpp | 6 ++---- cpp/unittest/db/mysql_db_test.cpp | 4 ++-- cpp/unittest/db/search_test.cpp | 6 +++--- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/cpp/unittest/db/db_tests.cpp b/cpp/unittest/db/db_tests.cpp index 50724edd..91b68210 100644 --- a/cpp/unittest/db/db_tests.cpp +++ b/cpp/unittest/db/db_tests.cpp @@ -25,8 +25,8 @@ namespace { static const char* TABLE_NAME = "test_group"; static constexpr int64_t TABLE_DIM = 256; - static constexpr int64_t VECTOR_COUNT = 250000; - static constexpr int64_t INSERT_LOOP = 10000; + static constexpr int64_t VECTOR_COUNT = 25000; + static constexpr int64_t INSERT_LOOP = 1000; static constexpr int64_t SECONDS_EACH_HOUR = 3600; static constexpr int64_t DAY_SECONDS = 24 * 60 * 60; diff --git a/cpp/unittest/db/mem_test.cpp b/cpp/unittest/db/mem_test.cpp index a612be2b..1429038a 100644 --- a/cpp/unittest/db/mem_test.cpp +++ b/cpp/unittest/db/mem_test.cpp @@ -24,8 +24,6 @@ namespace { static std::string TABLE_NAME = "test_group"; static constexpr int64_t TABLE_DIM = 256; -static constexpr int64_t VECTOR_COUNT = 250000; -static constexpr int64_t INSERT_LOOP = 10000; std::string GenTableName() { auto now = std::chrono::system_clock::now(); @@ -212,7 +210,7 @@ TEST_F(MemManagerTest2, SERIAL_INSERT_SEARCH_TEST) { std::map> search_vectors; { engine::IDNumbers vector_ids; - int64_t nb = 1024000; + int64_t nb = 100000; std::vector xb; BuildVectors(nb, xb); engine::Status status = db_->InsertVectors(TABLE_NAME, nb, xb.data(), vector_ids); @@ -224,7 +222,7 @@ TEST_F(MemManagerTest2, SERIAL_INSERT_SEARCH_TEST) { std::mt19937 gen(rd()); std::uniform_int_distribution dis(0, nb - 1); - int64_t num_query = 20; + int64_t num_query = 10; for (int64_t i = 0; i < num_query; ++i) { int64_t index = dis(gen); std::vector search; diff --git a/cpp/unittest/db/mysql_db_test.cpp b/cpp/unittest/db/mysql_db_test.cpp index a98959ed..677b310a 100644 --- a/cpp/unittest/db/mysql_db_test.cpp +++ b/cpp/unittest/db/mysql_db_test.cpp @@ -22,8 +22,8 @@ namespace { static const char* TABLE_NAME = "test_group"; static constexpr int64_t TABLE_DIM = 256; - static constexpr int64_t VECTOR_COUNT = 250000; - static constexpr int64_t INSERT_LOOP = 10000; + static constexpr int64_t VECTOR_COUNT = 25000; + static constexpr int64_t INSERT_LOOP = 1000; engine::meta::TableSchema BuildTableSchema() { engine::meta::TableSchema table_info; diff --git a/cpp/unittest/db/search_test.cpp b/cpp/unittest/db/search_test.cpp index b8e0ffaf..2eb3300b 100644 --- a/cpp/unittest/db/search_test.cpp +++ b/cpp/unittest/db/search_test.cpp @@ -288,7 +288,7 @@ TEST(DBSearchTest, PARALLEL_TOPK_TEST) { DoTopk(5, 10, 4, false); DoTopk(20005, 998, 123, true); - DoTopk(9987, 12, 10, false); - DoTopk(77777, 1000, 1, false); - DoTopk(5432, 8899, 8899, true); +// DoTopk(9987, 12, 10, false); +// DoTopk(77777, 1000, 1, false); +// DoTopk(5432, 8899, 8899, true); } \ No newline at end of file -- GitLab