diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2015-09-17 09:40:21 -0700 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2015-09-17 09:40:21 -0700 |
commit | 31afdcb4c2954f7b8c01b0f27fb39f607e94feca (patch) | |
tree | 28041e5c650a802eb1978947340c7c0660749ecc /unsupported/test/cxx11_tensor_morphing.cpp | |
parent | 9d993c709b5edf8b7eeabe2de60be9f3b28bf373 (diff) |
Fix return type for TensorEvaluator<TensorSlicingOp>::data
Diffstat (limited to 'unsupported/test/cxx11_tensor_morphing.cpp')
-rw-r--r-- | unsupported/test/cxx11_tensor_morphing.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/unsupported/test/cxx11_tensor_morphing.cpp b/unsupported/test/cxx11_tensor_morphing.cpp index 733154543..eb3b891fd 100644 --- a/unsupported/test/cxx11_tensor_morphing.cpp +++ b/unsupported/test/cxx11_tensor_morphing.cpp @@ -114,6 +114,16 @@ static void test_simple_slice() } } +static void test_const_slice() +{ + const float b[1] = {42}; + TensorMap<Tensor<const float, 1> > m(b, 1); + DSizes<DenseIndex, 1> offsets; + offsets[0] = 0; + TensorRef<Tensor<const float, 1> > slice_ref(m.slice(offsets, m.dimensions())); + VERIFY_IS_EQUAL(slice_ref(0), 42); +} + template<int DataLayout> static void test_slice_in_expr() { typedef Matrix<float, Dynamic, Dynamic, DataLayout> Mtx; @@ -333,6 +343,7 @@ void test_cxx11_tensor_morphing() CALL_SUBTEST(test_simple_slice<ColMajor>()); CALL_SUBTEST(test_simple_slice<RowMajor>()); + CALL_SUBTEST(test_const_slice()); CALL_SUBTEST(test_slice_in_expr<ColMajor>()); CALL_SUBTEST(test_slice_in_expr<RowMajor>()); CALL_SUBTEST(test_slice_as_lvalue<ColMajor>()); |