[wpimath] Generalize Eigen formatter (#5360)

This commit is contained in:
Tyler Veness
2023-05-30 23:35:15 -07:00
committed by GitHub
parent 125f6ea101
commit a94a998002
2 changed files with 25 additions and 100 deletions

View File

@@ -16,14 +16,14 @@ TEST(FormatterTest, Eigen) {
" 0.000000 1.000000\n"
" 2.000000 3.000000\n"
" 4.000000 5.000000",
fmt::format("{}", A));
fmt::format("{:f}", A));
Eigen::MatrixXd B{{0.0, 1.0}, {2.0, 3.0}, {4.0, 5.0}};
EXPECT_EQ(
" 0.000000 1.000000\n"
" 2.000000 3.000000\n"
" 4.000000 5.000000",
fmt::format("{}", B));
fmt::format("{:f}", B));
Eigen::SparseMatrix<double> C{3, 2};
std::vector<Eigen::Triplet<double>> triplets;
@@ -37,7 +37,7 @@ TEST(FormatterTest, Eigen) {
" 0.000000 1.000000\n"
" 2.000000 3.000000\n"
" 4.000000 5.000000",
fmt::format("{}", C));
fmt::format("{:f}", C));
}
TEST(FormatterTest, Units) {