MCPcopy Create free account
hub / github.com/antgroup/vsag / TestHGraphAdd

Function TestHGraphAdd

tests/test_hgraph.cpp:1278–1313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1276}
1277
1278static void
1279TestHGraphAdd(const fixtures::HGraphTestIndexPtr& test_index,
1280 const fixtures::HGraphResourcePtr& resource) {
1281 using namespace fixtures;
1282 auto origin_size = vsag::Options::Instance().block_size_limit();
1283 auto size = GENERATE(1024 * 1024 * 2);
1284 auto search_param = fmt::format(fixtures::search_param_tmp, 200, false);
1285
1286 for (auto metric_type : resource->metric_types) {
1287 for (auto dim : resource->dims) {
1288 for (auto& [base_quantization_str, recall] : resource->test_cases) {
1289 INFO(fmt::format("metric_type: {}, dim: {}, base_quantization_str: {}, recall: {}",
1290 metric_type,
1291 dim,
1292 base_quantization_str,
1293 recall));
1294 if (HGraphTestIndex::IsRaBitQ(base_quantization_str) &&
1295 dim < fixtures::RABITQ_MIN_RACALL_DIM) {
1296 dim = fixtures::RABITQ_MIN_RACALL_DIM;
1297 }
1298 vsag::Options::Instance().set_block_size_limit(size);
1299 HGraphTestIndex::HGraphBuildParam build_param(
1300 metric_type, dim, base_quantization_str);
1301 auto param = HGraphTestIndex::GenerateHGraphBuildParametersString(build_param);
1302 auto index = TestIndex::TestFactory(test_index->name, param, true);
1303 auto dataset = HGraphTestIndex::pool.GetDatasetAndCreate(
1304 dim, resource->base_count, metric_type);
1305 TestIndex::TestAddIndex(index, dataset, true);
1306 if (index->CheckFeature(vsag::SUPPORT_ADD_FROM_EMPTY)) {
1307 HGraphTestIndex::TestGeneral(index, dataset, search_param, recall);
1308 }
1309 vsag::Options::Instance().set_block_size_limit(origin_size);
1310 }
1311 }
1312 }
1313}
1314
1315TEST_CASE("(PR) HGraph Add", "[ft][hgraph][pr]") {
1316 auto test_index = std::make_shared<fixtures::HGraphTestIndex>();

Callers 1

test_hgraph.cppFile · 0.85

Calls 4

block_size_limitMethod · 0.80
set_block_size_limitMethod · 0.80
GetDatasetAndCreateMethod · 0.80
CheckFeatureMethod · 0.45

Tested by

no test coverage detected