diff --git a/test/resize.cpp b/test/resize.cpp index 866511c..a3bcb57 100644 --- a/test/resize.cpp +++ b/test/resize.cpp @@ -69,5 +69,43 @@ int test_main(int,char*[]) { BOOST_CHECK(std::accumulate(defaultA.data(), defaultA.data()+(2*3*4),0) == 0); } + + + + // verify the preservation of storage order + { + int tiling_graph_storage_order[] = {2, 0, 1}; + bool tiling_graph_index_order[] = {true, true, true}; + + marray A(boost::extents[3][4][2], + boost::general_storage_order<3>(tiling_graph_storage_order, + tiling_graph_index_order)); + + + int value = 0; + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 4; j++) { + for (int k = 0; k < 2; k++) { + *(A.data() + value) = value; + ++value; + } + } + } + + // "Resize" to the same size + A.resize(boost::extents[3][4][2]); + + int check = 0; + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 4; j++) { + for (int k = 0; k < 2; k++) { + BOOST_CHECK(*(A.data() + check) == check); + ++check; + } + } + } + } + + return boost::exit_success; }