Line data Source code
1 : #include "doctest/doctest.h"
2 :
3 : #include <Eigen/Core>
4 : #include <sstream>
5 :
6 : namespace doctest
7 : {
8 : template <typename T, int Rows, int Cols>
9 : struct StringMaker<Eigen::Matrix<T, Rows, Cols>> {
10 0 : static String convert(const Eigen::Matrix<T, Rows, Cols>& mat)
11 : {
12 0 : std::ostringstream oss;
13 0 : Eigen::IOFormat fmt(4, 0, ", ", "\n", "[", "]");
14 0 : oss << "\n" << mat.format(fmt);
15 0 : return oss.str().c_str();
16 0 : }
17 : };
18 :
19 : template <typename T, int Rows>
20 : struct StringMaker<Eigen::Matrix<T, Rows, 1>> {
21 : static String convert(const Eigen::Matrix<T, Rows, 1>& vec)
22 : {
23 : std::ostringstream oss;
24 : Eigen::IOFormat fmt(10, 0, ", ", ", ", "", "", "[", "]");
25 : oss << "\n" << vec.format(fmt);
26 : return oss.str().c_str();
27 : }
28 : };
29 :
30 : } // namespace doctest
|