diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-06-20 10:46:45 -0700 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-06-20 10:46:45 -0700 |
commit | de32f8d656c3ea7855ced77457ea661e43d417b7 (patch) | |
tree | 747902dd5ac134ae9b7522d37e7ef4992d997524 /unsupported/test/cxx11_tensor_io.cpp | |
parent | b055590e9135ffe762775ec919e490513b6974fa (diff) |
Fixed the printing of rank-0 tensors
Diffstat (limited to 'unsupported/test/cxx11_tensor_io.cpp')
-rw-r--r-- | unsupported/test/cxx11_tensor_io.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/unsupported/test/cxx11_tensor_io.cpp b/unsupported/test/cxx11_tensor_io.cpp index 8bbcf7089..8267dcadd 100644 --- a/unsupported/test/cxx11_tensor_io.cpp +++ b/unsupported/test/cxx11_tensor_io.cpp @@ -14,6 +14,20 @@ template<int DataLayout> +static void test_output_0d() +{ + Tensor<int, 0, DataLayout> tensor; + tensor() = 123; + + std::stringstream os; + os << tensor; + + std::string expected("123"); + VERIFY_IS_EQUAL(std::string(os.str()), expected); +} + + +template<int DataLayout> static void test_output_1d() { Tensor<int, 1, DataLayout> tensor(5); @@ -101,6 +115,8 @@ static void test_output_const() void test_cxx11_tensor_io() { + CALL_SUBTEST(test_output_0d<ColMajor>()); + CALL_SUBTEST(test_output_0d<RowMajor>()); CALL_SUBTEST(test_output_1d<ColMajor>()); CALL_SUBTEST(test_output_1d<RowMajor>()); CALL_SUBTEST(test_output_2d<ColMajor>()); |