Skip to content

Commit

Permalink
workspace: Upgrade fmt to latest release 7.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jwnimmer-tri committed Nov 2, 2020
1 parent 135e429 commit 7825b94
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bindings/pydrake/systems/test/analysis_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def test_simulator_status(self):
status = simulator.AdvanceTo(1.)
self.assertEqual(
status.FormatMessage(),
"Simulator successfully reached the boundary time (1.0).")
"Simulator successfully reached the boundary time (1).")
self.assertTrue(status.succeeded())
self.assertEqual(status.boundary_time(), 1.)
self.assertEqual(status.return_time(), 1.)
Expand Down
2 changes: 1 addition & 1 deletion common/test/text_logging_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ GTEST_TEST(TextLoggingTest, SmokeTest) {
// Check that floating point values format sensibly. We'll just test fmt
// directly, since we know that spdlog uses it internally.
GTEST_TEST(TextLoggingTest, FloatingPoint) {
EXPECT_EQ(fmt::format("{}", 1.0), "1.0");
EXPECT_EQ(fmt::format("{:#}", 1.0), "1.0");
// This number is particularly challenging.
EXPECT_EQ(fmt::format("{}", 0.009), "0.009");
}
Expand Down
2 changes: 1 addition & 1 deletion common/text_logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ not be compiled if debugging is turned off (-DNDEBUG is set):
DRAKE_LOGGER_DEBUG("message: {}", something_conditionally_compiled);
</pre>
The format string syntax is fmtlib; see https://fmt.dev/7.0.3/syntax.html.
The format string syntax is fmtlib; see https://fmt.dev/7.1.0/syntax.html.
In particular, any class that overloads `operator<<` for `ostream` can be
printed without any special handling.
*/
Expand Down
4 changes: 2 additions & 2 deletions common/trajectories/test/discrete_time_trajectory_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ GTEST_TEST(DiscreteTimeTrajectoryTest, ValueThrowsTest) {
DiscreteTimeTrajectory<double> traj(times, values);

DRAKE_EXPECT_THROWS_MESSAGE(traj.value(-1), std::runtime_error,
"Value requested at time -1.0 does not match .*");
"Value requested at time -1 does not match .*");
DRAKE_EXPECT_THROWS_MESSAGE(traj.value(0.4), std::runtime_error,
"Value requested at time 0.4 does not match .*");
DRAKE_EXPECT_THROWS_MESSAGE(traj.value(1), std::runtime_error,
"Value requested at time 1.0 does not match .*");
"Value requested at time 1 does not match .*");

const double kLooseTolerance = 0.1;
DiscreteTimeTrajectory<double> traj_w_loose_tol(times, values,
Expand Down
7 changes: 6 additions & 1 deletion common/yaml/yaml_write_archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <optional>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <utility>
#include <variant>
Expand Down Expand Up @@ -249,7 +250,11 @@ class YamlWriteArchive final {
void VisitScalar(const NVP& nvp) {
using T = typename NVP::value_type;
const T& value = *nvp.value();
root_[nvp.name()] = fmt::format("{}", value);
if constexpr (std::is_floating_point_v<T>) {
root_[nvp.name()] = fmt::format("{:#}", value);
} else {
root_[nvp.name()] = fmt::format("{}", value);
}
}

template <typename NVP>
Expand Down
2 changes: 1 addition & 1 deletion multibody/parsing/test/detail_scene_graph_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ GTEST_TEST(SceneGraphParserDetail, ParseVisualMaterial) {
MakeVisualPropertiesFromSdfVisual(*sdf_visual, NoopResolveFilename),
std::runtime_error,
"All values must be within the range \\[0, 1\\]. Values provided: "
"\\(r=0.0, g=1.0, b=255.0, a=1.0\\)");
"\\(r=0, g=1, b=255, a=1\\)");
}
}

Expand Down
4 changes: 2 additions & 2 deletions tools/workspace/fmt/repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def fmt_repository(
repository = "fmtlib/fmt",
# When changing the fmt version, also update the URL in the file
# overview docstring of drake/common/text_logging.h.
commit = "7.0.3",
sha256 = "b4b51bc16288e2281cddc59c28f0b4f84fed58d016fb038273a09f05f8473297", # noqa
commit = "7.1.0",
sha256 = "a53bce7e3b7ee8c7374723262a43356afff176b1684b86061748409e6f8b56c5", # noqa
build_file = "@drake//tools/workspace/fmt:package.BUILD.bazel",
mirrors = mirrors,
)

0 comments on commit 7825b94

Please sign in to comment.