@@ -1288,7 +1288,7 @@ TEST_F(HNSWLibTest, preferAdHocOptimization) {
12881288}
12891289
12901290TEST_F (HNSWLibTest, testCosine) {
1291- size_t dim = 128 ;
1291+ size_t dim = 4 ;
12921292 size_t n = 100 ;
12931293
12941294 VecSimParams params{.algo = VecSimAlgo_HNSWLIB,
@@ -1321,7 +1321,7 @@ TEST_F(HNSWLibTest, testCosine) {
13211321 ((first_coordinate + (float )dim - 1 .0f ) /
13221322 (sqrtf ((float )dim) * sqrtf ((float )(dim - 1 ) + first_coordinate * first_coordinate)));
13231323 // Verify that abs difference between the actual and expected score is at most 1/10^6.
1324- ASSERT_NEAR (score, expected_score, 1e-6 );
1324+ ASSERT_NEAR (score, expected_score, 1e-5 );
13251325 };
13261326 runTopKSearchTest (index, query, 10 , verify_res);
13271327
@@ -1344,7 +1344,7 @@ TEST_F(HNSWLibTest, testCosine) {
13441344 (sqrtf ((float )dim) *
13451345 sqrtf ((float )(dim - 1 ) + first_coordinate * first_coordinate)));
13461346 // Verify that abs difference between the actual and expected score is at most 1/10^6.
1347- ASSERT_NEAR (score, expected_score, 1e-6 );
1347+ ASSERT_NEAR (score, expected_score, 1e-5 );
13481348 };
13491349 runBatchIteratorSearchTest (batchIterator, n_res, verify_res_batch);
13501350 iteration_num++;
0 commit comments