aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/symbolic_index.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2018-07-12 09:59:00 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2018-07-12 09:59:00 +0200
commit8a40dda5a6c7847b466ca4d10d177639d1646e6d (patch)
tree621e8e96895f54069c15fcb2921e76f61da091ed /test/symbolic_index.cpp
parent8ef267ccbd3ef04af5b725a22599ab11b9da2fbf (diff)
Add some basic unit-tests
Diffstat (limited to 'test/symbolic_index.cpp')
-rw-r--r--test/symbolic_index.cpp16
1 files changed, 16 insertions, 0 deletions
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<typename T>
+void check_is_symbolic(const T&) {
+ STATIC_CHECK(( Symbolic::is_symbolic<T>::value ))
+}
+
+template<typename T>
+void check_isnot_symbolic(const T&) {
+ STATIC_CHECK(( !Symbolic::is_symbolic<T>::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: