MCPcopy Create free account
hub / github.com/MITK/MITK / TestClear

Function TestClear

Modules/ContourModel/Testing/mitkContourModelTest.cpp:435–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

433}
434
435static void TestClear()
436{
437 mitk::ContourModel::Pointer contour = mitk::ContourModel::New();
438 contour->Expand(3);
439
440 contour->Expand(3);
441 mitk::Point3D p;
442 p[0] = p[1] = p[2] = 0;
443 contour->AddVertex(p);
444 p[0] = p[1] = p[2] = 1;
445 contour->AddVertex(p, mitk::TimeStepType(1));
446 p[0] = p[1] = p[2] = 2;
447 contour->AddVertex(p, mitk::TimeStepType(2));
448
449 contour->Clear(1);
450
451 MITK_TEST_CONDITION(contour->GetTimeSteps() == 3, "Check time step count stays 3.");
452 MITK_TEST_CONDITION(!contour->IsEmpty(0), "Check time step 0 is not empty.");
453 MITK_TEST_CONDITION(contour->IsEmpty(1), "Check time step 1 is empty.");
454 MITK_TEST_CONDITION(!contour->IsEmpty(2), "Check time step 2 is not empty.");
455 MITK_TEST_CONDITION(contour->GetVertexAt(0, 2)->Coordinates == p, "compare if vertex at t == 2 is still the same");
456
457 contour->Clear();
458 MITK_TEST_CONDITION(contour->GetTimeSteps() == 1, "Check time step count stays 1.");
459 MITK_TEST_CONDITION(contour->IsEmpty(0), "Check time step 0 is empty.");
460}
461
462int mitkContourModelTest(int /*argc*/, char * /*argv*/ [])
463{

Callers 1

mitkContourModelTestFunction · 0.85

Calls 7

GetTimeStepsMethod · 0.80
NewFunction · 0.50
ExpandMethod · 0.45
AddVertexMethod · 0.45
ClearMethod · 0.45
IsEmptyMethod · 0.45
GetVertexAtMethod · 0.45

Tested by

no test coverage detected