mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Clang-format tests, examples, libraries, benchmarks, etc.
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
3252ecc7a4
commit
46e9cdb7fe
@@ -19,22 +19,22 @@ EIGEN_DECLARE_TEST(constexpr) {
|
||||
constexpr Matrix3i mat({{1, 2, 3}, {4, 5, 6}, {7, 8, 9}});
|
||||
VERIFY_IS_EQUAL(mat.size(), 9);
|
||||
VERIFY_IS_EQUAL(mat(0, 0), 1);
|
||||
static_assert(mat.coeff(0,1) == 2);
|
||||
static_assert(mat.coeff(0, 1) == 2);
|
||||
constexpr Array33i arr({{1, 2, 3}, {4, 5, 6}, {7, 8, 9}});
|
||||
VERIFY_IS_EQUAL(arr(0, 0), 1);
|
||||
VERIFY_IS_EQUAL(arr.size(), 9);
|
||||
static_assert(arr.coeff(0,1) == 2);
|
||||
static_assert(arr.coeff(0, 1) == 2);
|
||||
// Also check dynamic size arrays/matrices with fixed-size storage (currently
|
||||
// only works if all elements are initialized, since otherwise the compiler
|
||||
// complains about uninitialized trailing elements.
|
||||
constexpr Matrix<int, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3> dyn_mat({{1, 2, 3}, {4, 5, 6}, {7, 8, 9}});
|
||||
VERIFY_IS_EQUAL(dyn_mat.size(), 9);
|
||||
VERIFY_IS_EQUAL(dyn_mat(0, 0), 1);
|
||||
static_assert(dyn_mat.coeff(0,1) == 2);
|
||||
static_assert(dyn_mat.coeff(0, 1) == 2);
|
||||
constexpr Array<int, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3> dyn_arr({{1, 2, 3}, {4, 5, 6}, {7, 8, 9}});
|
||||
VERIFY_IS_EQUAL(dyn_arr(0, 0), 1);
|
||||
VERIFY_IS_EQUAL(dyn_arr.size(), 9);
|
||||
static_assert(dyn_arr.coeff(0,1) == 2);
|
||||
static_assert(dyn_arr.coeff(0, 1) == 2);
|
||||
#endif // EIGEN_COMP_CXXVER >= 20
|
||||
}
|
||||
|
||||
@@ -47,6 +47,6 @@ constexpr Matrix<int, 2, 2> global_mat({{1, 2}, {3, 4}});
|
||||
EIGEN_DECLARE_TEST(constexpr_global) {
|
||||
VERIFY_IS_EQUAL(global_mat.size(), 4);
|
||||
VERIFY_IS_EQUAL(global_mat(0, 0), 1);
|
||||
static_assert(global_mat.coeff(0,0) == 1);
|
||||
static_assert(global_mat.coeff(0, 0) == 1);
|
||||
}
|
||||
#endif // EIGEN_COMP_CXXVER >= 20
|
||||
|
||||
Reference in New Issue
Block a user