Added another test for resize preserving storage order.

[SVN r33238]
This commit is contained in:
Ronald Garcia 2006-03-06 20:57:23 +00:00
parent ecf3435632
commit 150fcf9a59

View File

@ -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;
}