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

Function TestHGraphReaderIO

tests/test_hgraph.cpp:1736–1783  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1734}
1735
1736static void
1737TestHGraphReaderIO(const fixtures::HGraphTestIndexPtr& test_index,
1738 const fixtures::HGraphResourcePtr& resource) {
1739 using namespace fixtures;
1740 auto origin_size = vsag::Options::Instance().block_size_limit();
1741 auto size = GENERATE(1024 * 1024 * 2);
1742 auto search_param = fmt::format(fixtures::search_param_tmp, 200, false);
1743 uint64_t extra_info_size = 64;
1744
1745 for (auto metric_type : resource->metric_types) {
1746 for (auto dim : resource->dims) {
1747 for (auto [base_quantization_str, recall] : resource->test_cases) {
1748 INFO(fmt::format("metric_type: {}, dim: {}, base_quantization_str: {}, recall: {}",
1749 metric_type,
1750 dim,
1751 base_quantization_str,
1752 recall));
1753 if (HGraphTestIndex::IsRaBitQ(base_quantization_str) &&
1754 (metric_type != "l2" || dim < fixtures::RABITQ_MIN_RACALL_DIM)) {
1755 continue; // Skip invalid RaBitQ configurations
1756 }
1757 vsag::Options::Instance().set_block_size_limit(size);
1758 HGraphTestIndex::HGraphBuildParam build_param(
1759 metric_type, dim, base_quantization_str);
1760 build_param.extra_info_size = extra_info_size;
1761 auto param = HGraphTestIndex::GenerateHGraphBuildParametersString(build_param);
1762 auto index = TestIndex::TestFactory(test_index->name, param, true);
1763 auto dataset = HGraphTestIndex::pool.GetDatasetAndCreate(dim,
1764 resource->base_count,
1765 metric_type,
1766 false /*with_path*/,
1767 0.8 /*valid_ratio*/,
1768 extra_info_size);
1769
1770 TestIndex::TestBuildIndex(index, dataset, true);
1771 if (base_quantization_str.find(',') != std::string::npos) {
1772 build_param.quantization_str += ",reader_io";
1773 }
1774 auto reader_param =
1775 HGraphTestIndex::GenerateHGraphBuildParametersString(build_param);
1776 auto index2 = TestIndex::TestFactory(test_index->name, reader_param, true);
1777 TestIndex::TestSerializeReaderSet(
1778 index, index2, dataset, search_param, test_index->name, true);
1779 vsag::Options::Instance().set_block_size_limit(origin_size);
1780 }
1781 }
1782 }
1783}
1784
1785TEST_CASE("(PR) HGraph Reader IO", "[ft][hgraph][serialization][pr]") {
1786 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
findMethod · 0.45

Tested by

no test coverage detected