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
This commit is contained in:
Corentin Le Molgat
2025-04-29 19:07:41 +02:00
parent 5011c5c569
commit c918c347c4
2 changed files with 2 additions and 1 deletions

View File

@@ -129,6 +129,7 @@ cc_test(
":symmetry",
"//ortools/base:gmock_main",
"//ortools/math_opt/testing:stream",
"@abseil-cpp//absl/strings",
],
)

View File

@@ -165,7 +165,7 @@ TEST(FormatAttrValueTest, FormatsInt64) {
}
TEST(FormatAttrValueTest, FormatsDouble) {
EXPECT_EQ(FormatAttrValue(4.2), "4.2");
EXPECT_EQ(FormatAttrValue(absl::SixDigits(4.2)), "4.2");
}
} // namespace