From 00f048d44f7dd40a0a4e80e40787a930db0f18f0 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Tue, 17 Feb 2015 09:54:40 -0800 Subject: Added support for tensor concatenation as lvalue --- unsupported/test/cxx11_tensor_concatenation.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'unsupported/test/cxx11_tensor_concatenation.cpp') diff --git a/unsupported/test/cxx11_tensor_concatenation.cpp b/unsupported/test/cxx11_tensor_concatenation.cpp index 9fdf33c16..cc9dfb769 100644 --- a/unsupported/test/cxx11_tensor_concatenation.cpp +++ b/unsupported/test/cxx11_tensor_concatenation.cpp @@ -103,6 +103,25 @@ static void test_simple_concatenation() // TODO(phli): Add test once we have a real vectorized implementation. // static void test_vectorized_concatenation() {} +static void test_concatenation_as_lvalue() +{ + Tensor t1(2, 3); + Tensor t2(2, 3); + t1.setRandom(); + t2.setRandom(); + + Tensor result(4, 3); + result.setRandom(); + t1.concatenate(t2, 0) = result; + + for (int i = 0; i < 2; ++i) { + for (int j = 0; j < 3; ++j) { + VERIFY_IS_EQUAL(t1(i, j), result(i, j)); + VERIFY_IS_EQUAL(t2(i, j), result(i+2, j)); + } + } +} + void test_cxx11_tensor_concatenation() { @@ -113,4 +132,6 @@ void test_cxx11_tensor_concatenation() CALL_SUBTEST(test_simple_concatenation()); CALL_SUBTEST(test_simple_concatenation()); // CALL_SUBTEST(test_vectorized_concatenation()); + CALL_SUBTEST(test_concatenation_as_lvalue()); + } -- cgit v1.2.3