[Test] Add check to shrink_to_time method in grid function container

parent 7f09a2f4
......@@ -143,15 +143,41 @@ bool test_container(GV& gv)
failed |= true;
} catch (...) {}
// Try again another valid time
// try again another valid time
gf_container.setTime(1.0);
gf_container.evaluate(entity,x,y);
if (not Dune::FloatCmp::eq(y[0],1.0))
failed |= true;
// shrink to some arbitrary time
gf_container.setTime(1.5);
gf_container.shrink_to_time();
gf_container.evaluate(entity,x,y);
failed |= gf_container.size()==2;
try {
gf_container.setTime(0.5);
gf_container.setTime(1.5);
failed |= true;
} catch (...) {}
// shrink to some exact contained time
gf_container.setTime(1.);
gf_container.shrink_to_time();
gf_container.evaluate(entity,x,y);
failed |= gf_container.size()==1;
try {
gf_container.setTime(0.5);
gf_container.setTime(1.5);
failed |= true;
} catch (...) {}
// pop until container is empty
while (not gf_container.empty())
gf_container.pop();
// check that container is void
failed |= gf_container.size() == 0;
// evaluate an empty container should rise an error
try {
gf_container.evaluate(entity,x,y);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment