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

Function TestHGraphGetRawVector

tests/test_hgraph.cpp:829–876  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

827}
828
829static void
830TestHGraphGetRawVector(const fixtures::HGraphTestIndexPtr& test_index,
831 const fixtures::HGraphResourcePtr& resource) {
832 using namespace fixtures;
833 auto origin_size = vsag::Options::Instance().block_size_limit();
834 auto size = GENERATE(1024 * 1024 * 2);
835 const std::vector<std::pair<std::string, float>> test_cases = {
836 {"fp32", 0.99}, {"sq8", 0.99}, {"sq4_uniform,fp32", 0.95}};
837 auto search_param = fmt::format(fixtures::search_param_tmp, 200, false);
838 for (auto metric_type : resource->metric_types) {
839 for (auto dim : resource->dims) {
840 for (auto& [base_quantization_str, recall] : test_cases) {
841 INFO(fmt::format("metric_type: {}, dim: {}, base_quantization_str: {}, recall: {}",
842 metric_type,
843 dim,
844 base_quantization_str,
845 recall));
846 if (HGraphTestIndex::IsRaBitQ(base_quantization_str) &&
847 dim < fixtures::RABITQ_MIN_RACALL_DIM) {
848 dim = fixtures::RABITQ_MIN_RACALL_DIM;
849 }
850
851 // Set block size limit for current test iteration
852 vsag::Options::Instance().set_block_size_limit(size);
853
854 // Generate index parameters with attribute support enabled
855 HGraphTestIndex::HGraphBuildParam build_param(
856 metric_type, dim, base_quantization_str);
857 build_param.store_raw_vector = true;
858 auto param = HGraphTestIndex::GenerateHGraphBuildParametersString(build_param);
859
860 // Create index and dataset
861 auto index = TestIndex::TestFactory(test_index->name, param, true);
862
863 auto dataset = HGraphTestIndex::pool.GetDatasetAndCreate(
864 dim, resource->base_count, metric_type);
865
866 TestIndex::TestBuildIndex(index, dataset, true);
867
868 // Execute attribute-aware build test
869 HGraphTestIndex::TestGeneral(index, dataset, search_param, recall);
870
871 // Restore original block size limit
872 vsag::Options::Instance().set_block_size_limit(origin_size);
873 }
874 }
875 }
876}
877
878TEST_CASE("(PR) HGraph Support Get Raw Vector", "[ft][hgraph][pr]") {
879 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