aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--test/smallvectors.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/smallvectors.cpp b/test/smallvectors.cpp
index 144944162..4c09d4ec6 100644
--- a/test/smallvectors.cpp
+++ b/test/smallvectors.cpp
@@ -22,6 +22,7 @@
// License and a copy of the GNU General Public License along with
// Eigen. If not, see <http://www.gnu.org/licenses/>.
+#define EIGEN_NO_STATIC_ASSERT
#include "main.h"
template<typename Scalar> void smallVectors()
@@ -29,6 +30,7 @@ template<typename Scalar> void smallVectors()
typedef Matrix<Scalar, 1, 2> V2;
typedef Matrix<Scalar, 3, 1> V3;
typedef Matrix<Scalar, 1, 4> V4;
+ typedef Matrix<Scalar, Dynamic, 1> VX;
Scalar x1 = internal::random<Scalar>(),
x2 = internal::random<Scalar>(),
x3 = internal::random<Scalar>(),
@@ -45,6 +47,29 @@ template<typename Scalar> void smallVectors()
VERIFY_IS_APPROX(x3, v3.z());
VERIFY_IS_APPROX(x3, v4.z());
VERIFY_IS_APPROX(x4, v4.w());
+
+ if (!NumTraits<Scalar>::IsInteger)
+ {
+ VERIFY_RAISES_ASSERT(V3(2, 1))
+ VERIFY_RAISES_ASSERT(V3(3, 2))
+ VERIFY_RAISES_ASSERT(V3(Scalar(3), 1))
+ VERIFY_RAISES_ASSERT(V3(3, Scalar(1)))
+ VERIFY_RAISES_ASSERT(V3(Scalar(3), Scalar(1)))
+ VERIFY_RAISES_ASSERT(V3(Scalar(123), Scalar(123)))
+
+ VERIFY_RAISES_ASSERT(V4(1, 3))
+ VERIFY_RAISES_ASSERT(V4(2, 4))
+ VERIFY_RAISES_ASSERT(V4(1, Scalar(4)))
+ VERIFY_RAISES_ASSERT(V4(Scalar(1), 4))
+ VERIFY_RAISES_ASSERT(V4(Scalar(1), Scalar(4)))
+ VERIFY_RAISES_ASSERT(V4(Scalar(123), Scalar(123)))
+
+ VERIFY_RAISES_ASSERT(VX(3, 2))
+ VERIFY_RAISES_ASSERT(VX(Scalar(3), 1))
+ VERIFY_RAISES_ASSERT(VX(3, Scalar(1)))
+ VERIFY_RAISES_ASSERT(VX(Scalar(3), Scalar(1)))
+ VERIFY_RAISES_ASSERT(VX(Scalar(123), Scalar(123)))
+ }
}
void test_smallvectors()