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

Function TestHGraphTrainAndAddTest

tests/test_hgraph.cpp:618–650  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

616}
617
618void
619TestHGraphTrainAndAddTest(const fixtures::HGraphTestIndexPtr& test_index,
620 const fixtures::HGraphResourcePtr& resource) {
621 using namespace fixtures;
622 auto origin_size = vsag::Options::Instance().block_size_limit();
623 auto size = GENERATE(1024 * 1024 * 2);
624 auto search_param = fmt::format(fixtures::search_param_tmp, 200, false);
625 for (auto metric_type : resource->metric_types) {
626 for (auto dim : resource->dims) {
627 for (auto& [base_quantization_str, recall] : resource->test_cases) {
628 INFO(fmt::format("metric_type: {}, dim: {}, base_quantization_str: {}, recall: {}",
629 metric_type,
630 dim,
631 base_quantization_str,
632 recall));
633 if (HGraphTestIndex::IsRaBitQ(base_quantization_str) &&
634 dim < fixtures::RABITQ_MIN_RACALL_DIM) {
635 dim = fixtures::RABITQ_MIN_RACALL_DIM;
636 }
637 vsag::Options::Instance().set_block_size_limit(size);
638 HGraphTestIndex::HGraphBuildParam build_param(
639 metric_type, dim, base_quantization_str);
640 auto param = HGraphTestIndex::GenerateHGraphBuildParametersString(build_param);
641 auto index = TestIndex::TestFactory(test_index->name, param, true);
642 auto dataset = HGraphTestIndex::pool.GetDatasetAndCreate(
643 dim, resource->base_count, metric_type);
644 TestIndex::TestTrainAndAdd(index, dataset, true);
645 HGraphTestIndex::TestGeneral(index, dataset, search_param, recall);
646 vsag::Options::Instance().set_block_size_limit(origin_size);
647 }
648 }
649 }
650}
651
652TEST_CASE("(PR) HGraph Train & Add Test", "[ft][hgraph][pr]") {
653 auto test_index = std::make_shared<fixtures::HGraphTestIndex>();

Callers 1

test_hgraph.cppFile · 0.85

Calls 3

block_size_limitMethod · 0.80
set_block_size_limitMethod · 0.80
GetDatasetAndCreateMethod · 0.80

Tested by

no test coverage detected