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

Function mitkSimpleHistogramTest

Modules/AlgorithmsExt/test/mitkSimpleHistogramTest.cpp:17–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15#include <mitkTestingMacros.h>
16
17int mitkSimpleHistogramTest(int /*argc*/, char * /*argv*/ [])
18{
19 MITK_TEST_BEGIN("mitkSimpleHistogram");
20
21 auto myTestSimpleImageHistogram = new mitk::SimpleImageHistogram();
22
23 MITK_TEST_CONDITION_REQUIRED(myTestSimpleImageHistogram != nullptr, "Testing instantiation.");
24 MITK_TEST_CONDITION_REQUIRED(myTestSimpleImageHistogram->GetMax() == 1, "Testing GetMax().");
25 MITK_TEST_CONDITION_REQUIRED(myTestSimpleImageHistogram->GetMin() == 0, "Testing GetMin().");
26 MITK_TEST_CONDITION_REQUIRED(myTestSimpleImageHistogram->GetRelativeBin(1.0, 5.0) == 0, "Testing GetRelativeBin().");
27 bool success = true;
28 try
29 {
30 myTestSimpleImageHistogram->ComputeFromBaseData(nullptr);
31 myTestSimpleImageHistogram->ComputeFromBaseData(mitk::Image::New()); // an empty image
32 myTestSimpleImageHistogram->ComputeFromBaseData(mitk::Surface::New()); // an invalid value
33 }
34 catch (...)
35 {
36 success = false;
37 }
38 MITK_TEST_CONDITION_REQUIRED(success, "Testing ComputeFromBaseData() with invalid input values.");
39 MITK_TEST_CONDITION_REQUIRED(!myTestSimpleImageHistogram->GetValid(),
40 "Testing if histogram is invalid after invalid input.");
41
42 MITK_TEST_END();
43}

Callers

nothing calls this directly

Calls 6

GetRelativeBinMethod · 0.80
GetValidMethod · 0.80
NewFunction · 0.50
GetMaxMethod · 0.45
GetMinMethod · 0.45
ComputeFromBaseDataMethod · 0.45

Tested by

no test coverage detected