Skip to content

Commit 6549049

Browse files
committed
math_opt: Fix derived_data_test on macOS
trace: ``` [ RUN ] FormatAttrValueTest.FormatsDouble /Users/runner/work/or-tools/or-tools/ortools/math_opt/elemental/derived_data_test.cc:168: Failure Expected equality of these values: FormatAttrValue(4.2) Which is: "4.2000000000000002" "4.2" Stack trace: 0x10b8bf8f4: operations_research::math_opt::(anonymous namespace)::FormatAttrValueTest_FormatsDouble_Test::TestBody() 0x10c7fa88b: testing::internal::HandleExceptionsInMethodIfSupported<>() 0x10c7fa7b2: testing::Test::Run() 0x10c7fb8e0: testing::TestInfo::Run() ... Google Test internal frames ... [ FAILED ] FormatAttrValueTest.FormatsDouble (0 ms) ``` ref: https://github.com/google/or-tools/actions/runs/14709142545/job/41276791732
1 parent 3a9137d commit 6549049

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

ortools/math_opt/elemental/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ cc_test(
129129
":symmetry",
130130
"//ortools/base:gmock_main",
131131
"//ortools/math_opt/testing:stream",
132+
"@abseil-cpp//absl/strings",
132133
],
133134
)
134135

ortools/math_opt/elemental/derived_data_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ TEST(FormatAttrValueTest, FormatsInt64) {
165165
}
166166

167167
TEST(FormatAttrValueTest, FormatsDouble) {
168-
EXPECT_EQ(FormatAttrValue(4.2), "4.2");
168+
EXPECT_EQ(FormatAttrValue(absl::SixDigits(4.2)), "4.2");
169169
}
170170

171171
} // namespace

0 commit comments

Comments
 (0)