diff --git a/tests/ut/test_cluster.cc b/tests/ut/test_cluster.cc index 68dfe209b..bcb84e046 100644 --- a/tests/ut/test_cluster.cc +++ b/tests/ut/test_cluster.cc @@ -40,7 +40,7 @@ TEST_CASE("Test Kmeans With Float Vector", "[float metrics]") { const std::string NUM_CLUSTERS = "num_clusters"; auto topk = 1; - auto base_gen = [&]() { + auto base_gen = [=]() { knowhere::Json json; json[NUM_CLUSTERS] = num_clusters; return json; diff --git a/tests/ut/test_diskann.cc b/tests/ut/test_diskann.cc index a03b2d847..fc82bd392 100644 --- a/tests/ut/test_diskann.cc +++ b/tests/ut/test_diskann.cc @@ -342,7 +342,7 @@ TEST_CASE("Test DiskANN GetVectorByIds", "[diskann]") { fs::remove(kDir); REQUIRE_NOTHROW(fs::create_directories(kL2IndexDir)); - auto base_gen = [&] { + auto base_gen = [=] { knowhere::Json json; json[knowhere::meta::RETRIEVE_FRIENDLY] = true; json["dim"] = dim; @@ -351,7 +351,7 @@ TEST_CASE("Test DiskANN GetVectorByIds", "[diskann]") { return json; }; - auto build_gen = [&]() { + auto build_gen = [=]() { knowhere::Json json = base_gen(); json["index_prefix"] = kL2IndexPrefix; json["data_path"] = kRawDataPath; diff --git a/tests/ut/test_feder.cc b/tests/ut/test_feder.cc index 6c3b49bdd..e172d1f9a 100644 --- a/tests/ut/test_feder.cc +++ b/tests/ut/test_feder.cc @@ -144,7 +144,7 @@ TEST_CASE("Test Feder", "[feder]") { auto version = GenTestVersionList(); - auto base_gen = [&]() { + auto base_gen = [=]() { knowhere::Json json; json[knowhere::meta::DIM] = dim; json[knowhere::meta::METRIC_TYPE] = knowhere::metric::L2; @@ -153,14 +153,14 @@ TEST_CASE("Test Feder", "[feder]") { return json; }; - auto ivfflat_gen = [&base_gen]() { + auto ivfflat_gen = [base_gen]() { knowhere::Json json = base_gen(); json[knowhere::indexparam::NLIST] = 16; json[knowhere::indexparam::NPROBE] = 4; return json; }; - auto hnsw_gen = [&base_gen]() { + auto hnsw_gen = [base_gen]() { knowhere::Json json = base_gen(); json[knowhere::indexparam::HNSW_M] = 8; json[knowhere::indexparam::EFCONSTRUCTION] = 200; diff --git a/tests/ut/test_gpu_search.cc b/tests/ut/test_gpu_search.cc index 9243ff3b4..01bf5a276 100644 --- a/tests/ut/test_gpu_search.cc +++ b/tests/ut/test_gpu_search.cc @@ -30,7 +30,7 @@ TEST_CASE("Test All GPU Index", "[search]") { auto version = GenTestVersionList(); - auto base_gen = [&]() { + auto base_gen = [=]() { knowhere::Json json; json[knowhere::meta::DIM] = dim; json[knowhere::meta::METRIC_TYPE] = knowhere::metric::L2; @@ -42,21 +42,21 @@ TEST_CASE("Test All GPU Index", "[search]") { auto bruteforce_gen = base_gen; - auto ivfflat_gen = [&base_gen]() { + auto ivfflat_gen = [base_gen]() { knowhere::Json json = base_gen(); json[knowhere::indexparam::NLIST] = 16; json[knowhere::indexparam::NPROBE] = 16; return json; }; - auto ivfpq_gen = [&ivfflat_gen]() { + auto ivfpq_gen = [ivfflat_gen]() { knowhere::Json json = ivfflat_gen(); json[knowhere::indexparam::M] = 0; json[knowhere::indexparam::NBITS] = 8; return json; }; - auto cagra_gen = [&base_gen]() { + auto cagra_gen = [base_gen]() { knowhere::Json json = base_gen(); json[knowhere::indexparam::INTERMEDIATE_GRAPH_DEGREE] = 128; json[knowhere::indexparam::GRAPH_DEGREE] = 64; diff --git a/tests/ut/test_iterator.cc b/tests/ut/test_iterator.cc index 9ddebbe08..71c918841 100644 --- a/tests/ut/test_iterator.cc +++ b/tests/ut/test_iterator.cc @@ -97,7 +97,7 @@ TEST_CASE("Test Iterator Mem Index With Float Vector", "[float metrics]") { auto metric = GENERATE(as{}, knowhere::metric::L2, knowhere::metric::COSINE, knowhere::metric::IP); auto version = GenTestVersionList(); - auto base_gen = [&]() { + auto base_gen = [=]() { knowhere::Json json; json[knowhere::meta::DIM] = dim; json[knowhere::meta::METRIC_TYPE] = metric; @@ -105,7 +105,7 @@ TEST_CASE("Test Iterator Mem Index With Float Vector", "[float metrics]") { return json; }; - auto hnsw_gen = [&base_gen]() { + auto hnsw_gen = [base_gen]() { knowhere::Json json = base_gen(); json[knowhere::indexparam::HNSW_M] = 128; json[knowhere::indexparam::EFCONSTRUCTION] = 200; @@ -113,14 +113,14 @@ TEST_CASE("Test Iterator Mem Index With Float Vector", "[float metrics]") { return json; }; - auto ivfflat_gen = [&base_gen]() { + auto ivfflat_gen = [base_gen]() { knowhere::Json json = base_gen(); json[knowhere::indexparam::NPROBE] = 16; json[knowhere::indexparam::NLIST] = 24; return json; }; - auto ivfflatcc_gen = [&base_gen]() { + auto ivfflatcc_gen = [base_gen]() { knowhere::Json json = base_gen(); json[knowhere::indexparam::NPROBE] = 16; json[knowhere::indexparam::NLIST] = 24; @@ -252,7 +252,7 @@ TEST_CASE("Test Iterator IVFFlatCC With Newly Insert Vectors", "[float metrics] auto metric = GENERATE(as{}, knowhere::metric::L2, knowhere::metric::COSINE, knowhere::metric::IP); auto version = GenTestVersionList(); - auto base_gen = [&]() { + auto base_gen = [=]() { knowhere::Json json; json[knowhere::meta::DIM] = dim; json[knowhere::meta::METRIC_TYPE] = metric; @@ -260,7 +260,7 @@ TEST_CASE("Test Iterator IVFFlatCC With Newly Insert Vectors", "[float metrics] return json; }; - auto ivfflatcc_gen = [&base_gen]() { + auto ivfflatcc_gen = [base_gen]() { knowhere::Json json = base_gen(); json[knowhere::indexparam::NPROBE] = 16; json[knowhere::indexparam::NLIST] = 24; @@ -332,7 +332,7 @@ TEST_CASE("Test Iterator Mem Index With Binary Metrics", "[binary metrics]") { auto metric = GENERATE(as{}, knowhere::metric::HAMMING, knowhere::metric::JACCARD); auto version = GenTestVersionList(); - auto base_gen = [&]() { + auto base_gen = [=]() { knowhere::Json json; json[knowhere::meta::DIM] = dim; json[knowhere::meta::METRIC_TYPE] = metric; @@ -340,7 +340,7 @@ TEST_CASE("Test Iterator Mem Index With Binary Metrics", "[binary metrics]") { return json; }; - auto hnsw_gen = [&base_gen]() { + auto hnsw_gen = [base_gen]() { knowhere::Json json = base_gen(); json[knowhere::indexparam::HNSW_M] = 128; json[knowhere::indexparam::EFCONSTRUCTION] = 200; diff --git a/tests/ut/test_ivfflat_cc.cc b/tests/ut/test_ivfflat_cc.cc index 39525c38a..84569d044 100644 --- a/tests/ut/test_ivfflat_cc.cc +++ b/tests/ut/test_ivfflat_cc.cc @@ -35,7 +35,7 @@ TEST_CASE("Test Build Search Concurrency", "[Concurrency]") { int64_t build_task_num = 1; int64_t search_task_num = 10; - auto base_gen = [&]() { + auto base_gen = [=]() { knowhere::Json json; json[knowhere::meta::DIM] = dim; json[knowhere::meta::METRIC_TYPE] = metric; @@ -45,7 +45,7 @@ TEST_CASE("Test Build Search Concurrency", "[Concurrency]") { return json; }; - auto ivf_gen = [&base_gen]() { + auto ivf_gen = [base_gen]() { knowhere::Json json = base_gen(); json[knowhere::indexparam::NLIST] = 128; json[knowhere::indexparam::NPROBE] = 16; @@ -53,14 +53,14 @@ TEST_CASE("Test Build Search Concurrency", "[Concurrency]") { return json; }; - auto ivf_cc_gen = [&ivf_gen]() { + auto ivf_cc_gen = [ivf_gen]() { knowhere::Json json = ivf_gen(); json[knowhere::meta::NUM_BUILD_THREAD] = 1; json[knowhere::indexparam::SSIZE] = 48; return json; }; - auto ivf_sq_8_cc_gen = [&ivf_cc_gen]() { + auto ivf_sq_8_cc_gen = [ivf_cc_gen]() { knowhere::Json json = ivf_cc_gen(); json[knowhere::indexparam::CODE_SIZE] = 8; return json; diff --git a/tests/ut/test_search.cc b/tests/ut/test_search.cc index e74643972..775f95a30 100644 --- a/tests/ut/test_search.cc +++ b/tests/ut/test_search.cc @@ -378,7 +378,7 @@ TEST_CASE("Test Mem Index With Float Vector", "[float metrics]") { .value(); uint32_t nb = 1000; uint32_t dim = 128; - auto ivf_pq_gen = [&]() { + auto ivf_pq_gen = [=]() { knowhere::Json json; json[knowhere::meta::DIM] = dim; json[knowhere::meta::METRIC_TYPE] = knowhere::metric::L2; @@ -398,7 +398,7 @@ TEST_CASE("Test Mem Index With Float Vector", "[float metrics]") { .value(); uint32_t nb = 1000; uint32_t dim = 128; - auto ivf_pq_gen = [&]() { + auto ivf_pq_gen = [=]() { knowhere::Json json; json[knowhere::meta::DIM] = dim; json[knowhere::meta::METRIC_TYPE] = knowhere::metric::L2;