From 44b54fa4a3618922e06abdca9c555b8697698237 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 20 Feb 2019 14:43:05 +0100 Subject: Protect c++11 type alias with Eigen's macro, and add respective unit test. --- test/type_alias.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 test/type_alias.cpp (limited to 'test/type_alias.cpp') diff --git a/test/type_alias.cpp b/test/type_alias.cpp new file mode 100644 index 000000000..f9b0efc5d --- /dev/null +++ b/test/type_alias.cpp @@ -0,0 +1,43 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2019 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "main.h" + +EIGEN_DECLARE_TEST(type_alias) +{ + using namespace internal; + + // To warm up, some basic checks: + STATIC_CHECK((is_same >::value)); + STATIC_CHECK((is_same >::value)); + STATIC_CHECK((is_same >::value)); + +#if EIGEN_HAS_CXX11 + + STATIC_CHECK((is_same, MatrixXd>::value)); + STATIC_CHECK((is_same, MatrixXi>::value)); + STATIC_CHECK((is_same, Matrix2i>::value)); + STATIC_CHECK((is_same, Matrix2Xf>::value)); + STATIC_CHECK((is_same, MatrixX4d>::value)); + STATIC_CHECK((is_same, VectorXi>::value)); + STATIC_CHECK((is_same, Vector2f>::value)); + STATIC_CHECK((is_same, RowVectorXi>::value)); + STATIC_CHECK((is_same, RowVector2f>::value)); + + STATIC_CHECK((is_same, ArrayXXf>::value)); + STATIC_CHECK((is_same, Array33i>::value)); + STATIC_CHECK((is_same, Array2Xf>::value)); + STATIC_CHECK((is_same, ArrayX4d>::value)); + STATIC_CHECK((is_same, ArrayXd>::value)); + STATIC_CHECK((is_same, Array4d>::value)); + +#else + std::cerr << "WARNING: c++11 type aliases not tested.\n"; +#endif +} -- cgit v1.2.3