From 8a40dda5a6c7847b466ca4d10d177639d1646e6d Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 12 Jul 2018 09:59:00 +0200 Subject: Add some basic unit-tests --- test/symbolic_index.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/symbolic_index.cpp') diff --git a/test/symbolic_index.cpp b/test/symbolic_index.cpp index 1db85144b..4c079857b 100644 --- a/test/symbolic_index.cpp +++ b/test/symbolic_index.cpp @@ -58,6 +58,15 @@ bool is_same_symb(const T1& a, const T2& b, Index size) return a.eval(last=size-1) == b.eval(last=size-1); } +template +void check_is_symbolic(const T&) { + STATIC_CHECK(( Symbolic::is_symbolic::value )) +} + +template +void check_isnot_symbolic(const T&) { + STATIC_CHECK(( !Symbolic::is_symbolic::value )) +} #define VERIFY_EQ_INT(A,B) VERIFY_IS_APPROX(int(A),int(B)) @@ -66,6 +75,13 @@ void check_symbolic_index() using Eigen::placeholders::last; using Eigen::placeholders::end; + check_is_symbolic(last); + check_is_symbolic(end); + check_is_symbolic(last+1); + check_is_symbolic(last-end); + check_is_symbolic(2*last-end/2); + check_isnot_symbolic(fix<3>()); + Index size=100; // First, let's check FixedInt arithmetic: -- cgit v1.2.3