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

Function TestHGraphExportModel

tests/test_hgraph.cpp:1850–1890  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1848}
1849
1850static void
1851TestHGraphExportModel(const fixtures::HGraphTestIndexPtr& test_index,
1852 const fixtures::HGraphResourcePtr& resource) {
1853 using namespace fixtures;
1854 auto origin_size = vsag::Options::Instance().block_size_limit();
1855 auto size = GENERATE(1024 * 1024 * 2);
1856 auto search_param = fmt::format(fixtures::search_param_tmp, 200, false);
1857 uint64_t extra_info_size = 64;
1858
1859 for (auto metric_type : resource->metric_types) {
1860 for (auto dim : resource->dims) {
1861 for (auto& [base_quantization_str, recall] : resource->test_cases) {
1862 INFO(fmt::format("metric_type: {}, dim: {}, base_quantization_str: {}, recall: {}",
1863 metric_type,
1864 dim,
1865 base_quantization_str,
1866 recall));
1867 if (HGraphTestIndex::IsRaBitQ(base_quantization_str) &&
1868 dim < fixtures::RABITQ_MIN_RACALL_DIM) {
1869 dim = fixtures::RABITQ_MIN_RACALL_DIM;
1870 }
1871 vsag::Options::Instance().set_block_size_limit(size);
1872 HGraphTestIndex::HGraphBuildParam build_param(
1873 metric_type, dim, base_quantization_str);
1874 build_param.extra_info_size = extra_info_size;
1875 auto param = HGraphTestIndex::GenerateHGraphBuildParametersString(build_param);
1876 auto index = TestIndex::TestFactory(test_index->name, param, true);
1877 auto index2 = TestIndex::TestFactory(test_index->name, param, true);
1878 auto dataset = HGraphTestIndex::pool.GetDatasetAndCreate(dim,
1879 resource->base_count,
1880 metric_type,
1881 false /*with_path*/,
1882 0.8 /*valid_ratio*/,
1883 extra_info_size);
1884 TestIndex::TestBuildIndex(index, dataset, true);
1885 TestIndex::TestExportModel(index, index2, dataset, search_param);
1886 vsag::Options::Instance().set_block_size_limit(origin_size);
1887 }
1888 }
1889 }
1890}
1891
1892TEST_CASE("(PR) HGraph Export Model", "[ft][hgraph][pr]") {
1893 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