Skip to content

test: fix ut random float#182

Merged
iaojnh merged 8 commits intomainfrom
fix/ut-ramdon-float
Feb 28, 2026
Merged

test: fix ut random float#182
iaojnh merged 8 commits intomainfrom
fix/ut-ramdon-float

Conversation

@iaojnh
Copy link
Collaborator

@iaojnh iaojnh commented Feb 27, 2026

No description provided.

@greptile-apps
Copy link

greptile-apps bot commented Feb 27, 2026

Greptile Summary

Fixed flaky unit tests caused by floating point precision issues by replacing exact equality assertions with appropriate floating point comparison macros.

  • Replaced EXPECT_EQ and ASSERT_EQ with EXPECT_FLOAT_EQ, ASSERT_FLOAT_EQ, and EXPECT_DOUBLE_EQ for float/double comparisons across test files
  • Widened tolerance in ASSERT_NEAR calls for quantized integer metric tests to account for precision variability in quantized data
  • Renamed hnsw_sparse_searcher_test.cc to hnsw_sparse_searcher_test.cpp for consistency

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • All changes are test-only fixes that properly address floating point comparison issues using standard GoogleTest macros, no production code affected
  • No files require special attention

Important Files Changed

Filename Overview
tests/core/algorithm/flat/flat_streamer_test.cc Changed multiple ASSERT_EQ to ASSERT_FLOAT_EQ for vector data comparisons
tests/core/algorithm/hnsw/hnsw_streamer_test.cc Changed multiple ASSERT_EQ to ASSERT_FLOAT_EQ for HNSW vector data comparisons
tests/core/algorithm/ivf/ivf_searcher_test.cc Changed 69 instances of EXPECT_EQ to EXPECT_FLOAT_EQ for score comparisons across multiple test cases
tests/core/metric/quantized_integer_metric_test.cc Widened ASSERT_NEAR tolerances for quantized integer metric comparisons to handle precision variability

Last reviewed commit: e7830a8

@iaojnh iaojnh requested a review from richyreachy February 27, 2026 13:57
richyreachy
richyreachy previously approved these changes Feb 28, 2026
@iaojnh
Copy link
Collaborator Author

iaojnh commented Feb 28, 2026

@greptile

@iaojnh
Copy link
Collaborator Author

iaojnh commented Feb 28, 2026

@greptile

@iaojnh iaojnh requested a review from richyreachy February 28, 2026 08:02
@iaojnh iaojnh merged commit 596d579 into main Feb 28, 2026
7 checks passed
@iaojnh iaojnh deleted the fix/ut-ramdon-float branch February 28, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants