Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STYLE: Add ITK prefix to testing macros #999

Merged
merged 1 commit into from
Jun 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion Modules/Compatibility/Deprecated/test/itkBarrierTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION BarrierSpecialTest( void *ptr )
int itkBarrierTest(int argc, char *argv[])
{
itk::Barrier::Pointer barrier = itk::Barrier::New();
EXERCISE_BASIC_OBJECT_METHODS( barrier, Barrier, LightObject );
ITK_EXERCISE_BASIC_OBJECT_METHODS( barrier, Barrier, LightObject );

itk::ThreadIdType number_of_threads = 4;
if (argc > 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int itkVectorResampleImageFilterTest( int argc, char * argv[] )

FilterType::Pointer filter = FilterType::New();

EXERCISE_BASIC_OBJECT_METHODS( filter, VectorResampleImageFilter,
ITK_EXERCISE_BASIC_OBJECT_METHODS( filter, VectorResampleImageFilter,
ImageToImageFilter );

itk::SimpleFilterWatcher watcher(filter);
Expand All @@ -53,13 +53,13 @@ int itkVectorResampleImageFilterTest( int argc, char * argv[] )
InterpolatorType::Pointer interpolator = InterpolatorType::New();

filter->SetInterpolator( interpolator );
TEST_SET_GET_VALUE( interpolator, filter->GetInterpolator() );
ITK_TEST_SET_GET_VALUE( interpolator, filter->GetInterpolator() );

using TransformType = itk::IdentityTransform< double, Dimension >;
TransformType::Pointer transform = TransformType::New();

filter->SetTransform( transform );
TEST_SET_GET_VALUE( transform, filter->GetTransform() );
ITK_TEST_SET_GET_VALUE( transform, filter->GetTransform() );

ImageType::SpacingType spacing;
spacing.Fill( 1.0 );
Expand Down Expand Up @@ -107,52 +107,52 @@ int itkVectorResampleImageFilterTest( int argc, char * argv[] )
blackValue.Fill( 0 );

filter->SetDefaultPixelValue( blackValue );
TEST_SET_GET_VALUE( blackValue, filter->GetDefaultPixelValue() );
ITK_TEST_SET_GET_VALUE( blackValue, filter->GetDefaultPixelValue() );

// Set the spacing for the resampling
spacing[0] *= 2.0;
spacing[1] *= 2.0;

filter->SetOutputSpacing( spacing );
TEST_SET_GET_VALUE( spacing, filter->GetOutputSpacing() );
ITK_TEST_SET_GET_VALUE( spacing, filter->GetOutputSpacing() );

// Keep the input image origin
filter->SetOutputOrigin( origin );
TEST_SET_GET_VALUE( origin, filter->GetOutputOrigin() );
ITK_TEST_SET_GET_VALUE( origin, filter->GetOutputOrigin() );

// Set the size
size[0] /= 2;
size[1] /= 2;

filter->SetSize( size );
TEST_SET_GET_VALUE( size, filter->GetSize() );
ITK_TEST_SET_GET_VALUE( size, filter->GetSize() );

// Set the output direction
FilterType::DirectionType outputDirection =
image->GetDirection();

filter->SetOutputDirection( outputDirection );
TEST_SET_GET_VALUE( outputDirection, filter->GetOutputDirection() );
ITK_TEST_SET_GET_VALUE( outputDirection, filter->GetOutputDirection() );

// Set the start index
FilterType::IndexType outputStartIndex =
image->GetLargestPossibleRegion().GetIndex();

filter->SetOutputStartIndex( outputStartIndex );
TEST_SET_GET_VALUE( outputStartIndex, filter->GetOutputStartIndex() );
ITK_TEST_SET_GET_VALUE( outputStartIndex, filter->GetOutputStartIndex() );


filter->SetInput( image );

TRY_EXPECT_NO_EXCEPTION( filter->Update() );
ITK_TRY_EXPECT_NO_EXCEPTION( filter->Update() );

// Write an image for regression testing
using WriterType = itk::ImageFileWriter< ImageType >;
WriterType::Pointer writer = WriterType::New();
writer->SetInput (filter->GetOutput());
writer->SetFileName( argv[1] );

TRY_EXPECT_NO_EXCEPTION( writer->Update() );
ITK_TRY_EXPECT_NO_EXCEPTION( writer->Update() );

return EXIT_SUCCESS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ int itkAtanRegularizedHeavisideStepFunctionTest1( int, char* [] )
constexpr double epsilon0 = 1.0;
const double epsilon1 = 1e-4;

TEST_SET_GET_VALUE( epsilon0, functionBase0->GetEpsilon() );
ITK_TEST_SET_GET_VALUE( epsilon0, functionBase0->GetEpsilon() );

functionBase0->SetEpsilon( epsilon1 );
TEST_SET_GET_VALUE( epsilon1, functionBase0->GetEpsilon() );
ITK_TEST_SET_GET_VALUE( epsilon1, functionBase0->GetEpsilon() );

constexpr double epsilon2 = 0.5;
functionBase0->SetEpsilon( epsilon2 );
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/test/itkColorTableTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ int itkColorTableTest( int argc, char* argv[] )
using ColorTableType = itk::ColorTable< unsigned char >;
ColorTableType::Pointer colors = ColorTableType::New();

EXERCISE_BASIC_OBJECT_METHODS( colors, ColorTable, Object );
ITK_EXERCISE_BASIC_OBJECT_METHODS( colors, ColorTable, Object );

auto numberOfColors = static_cast< unsigned int >( std::stoi( argv[1] ) );

Expand Down
36 changes: 18 additions & 18 deletions Modules/Core/Common/test/itkCommandObserverObjectTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,16 @@ int testDeleteObserverDuringEvent()

onAnyCount = 0;
o->InvokeEvent( itk::AnyEvent() );
TEST_EXPECT_TRUE( onAnyCount == 2 );
ITK_TEST_EXPECT_TRUE( onAnyCount == 2 );

onAnyCount = 0;
o->InvokeEvent( itk::UserEvent() );
TEST_EXPECT_TRUE( onAnyCount == 1 );
ITK_TEST_EXPECT_TRUE( onAnyCount == 1 );


onAnyCount = 0;
o->InvokeEvent( itk::AnyEvent() );
TEST_EXPECT_TRUE( onAnyCount == 1 );
ITK_TEST_EXPECT_TRUE( onAnyCount == 1 );

o->RemoveAllObservers();

Expand All @@ -110,16 +110,16 @@ int testDeleteObserverDuringEvent()

onAnyCount = 0;
o->InvokeEvent( itk::AnyEvent() );
TEST_EXPECT_TRUE( onAnyCount == 2 );
ITK_TEST_EXPECT_TRUE( onAnyCount == 2 );

onAnyCount = 0;
o->InvokeEvent( itk::UserEvent() );
TEST_EXPECT_TRUE( onAnyCount == 2 );
ITK_TEST_EXPECT_TRUE( onAnyCount == 2 );


onAnyCount = 0;
o->InvokeEvent( itk::AnyEvent() );
TEST_EXPECT_TRUE( onAnyCount == 1 );
ITK_TEST_EXPECT_TRUE( onAnyCount == 1 );

o->RemoveAllObservers();

Expand All @@ -131,16 +131,16 @@ int testDeleteObserverDuringEvent()

onAnyCount = 0;
o->InvokeEvent( itk::AnyEvent() );
TEST_EXPECT_TRUE( onAnyCount == 2 );
ITK_TEST_EXPECT_TRUE( onAnyCount == 2 );

onAnyCount = 0;
o->InvokeEvent( itk::UserEvent() );
TEST_EXPECT_TRUE( onAnyCount == 2 );
ITK_TEST_EXPECT_TRUE( onAnyCount == 2 );


onAnyCount = 0;
o->InvokeEvent( itk::AnyEvent() );
TEST_EXPECT_TRUE( onAnyCount == 1 );
ITK_TEST_EXPECT_TRUE( onAnyCount == 1 );

o->RemoveAllObservers();

Expand All @@ -152,16 +152,16 @@ int testDeleteObserverDuringEvent()

onAnyCount = 0;
o->InvokeEvent( itk::AnyEvent() );
TEST_EXPECT_TRUE( onAnyCount == 2 );
ITK_TEST_EXPECT_TRUE( onAnyCount == 2 );

onAnyCount = 0;
o->InvokeEvent( itk::UserEvent() );
TEST_EXPECT_TRUE( onAnyCount == 1 );
ITK_TEST_EXPECT_TRUE( onAnyCount == 1 );


onAnyCount = 0;
o->InvokeEvent( itk::AnyEvent() );
TEST_EXPECT_TRUE( onAnyCount == 1 );
ITK_TEST_EXPECT_TRUE( onAnyCount == 1 );

o->RemoveAllObservers();

Expand All @@ -185,17 +185,17 @@ int testCommandConstObject()
removeCmd->SetObjectName("Remove Command");

co->AddObserver(itk::AnyEvent(), cmd);
TEST_EXPECT_TRUE( co->HasObserver( itk::AnyEvent() ) );
ITK_TEST_EXPECT_TRUE( co->HasObserver( itk::AnyEvent() ) );

// the constant command doesn't get executed from the non-const
// invocation
onAnyCount = 0;
o->InvokeEvent( itk::AnyEvent() );
TEST_EXPECT_TRUE( onAnyCount == 0 );
ITK_TEST_EXPECT_TRUE( onAnyCount == 0 );

onAnyCount = 0;
co->InvokeEvent( itk::AnyEvent() );
TEST_EXPECT_TRUE( onAnyCount == 1 );
ITK_TEST_EXPECT_TRUE( onAnyCount == 1 );

return EXIT_SUCCESS;
}
Expand Down Expand Up @@ -232,7 +232,7 @@ int testCommandRecursiveObject()

onAnyCount = 0;
o->InvokeEvent( itk::AnyEvent() );
TEST_EXPECT_TRUE( onAnyCount == 2 );
ITK_TEST_EXPECT_TRUE( onAnyCount == 2 );

o->RemoveAllObservers();

Expand All @@ -244,7 +244,7 @@ int testCommandRecursiveObject()

onAnyCount = 0;
o->InvokeEvent( itk::AnyEvent() );
TEST_EXPECT_TRUE( onAnyCount == 2 );
ITK_TEST_EXPECT_TRUE( onAnyCount == 2 );

o->RemoveAllObservers();

Expand All @@ -256,7 +256,7 @@ int testCommandRecursiveObject()

onAnyCount = 0;
o->InvokeEvent( itk::AnyEvent() );
TEST_EXPECT_TRUE( onAnyCount == 0 );
ITK_TEST_EXPECT_TRUE( onAnyCount == 0 );

return EXIT_SUCCESS;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ int itkConicShellInteriorExteriorSpatialFunctionTest( int, char *[] )
ConicShellInteriorExteriorSpatialFunctionType::Pointer conicShellInteriorExteriorSpatialFunction =
ConicShellInteriorExteriorSpatialFunctionType::New();

EXERCISE_BASIC_OBJECT_METHODS( conicShellInteriorExteriorSpatialFunction,
ITK_EXERCISE_BASIC_OBJECT_METHODS( conicShellInteriorExteriorSpatialFunction,
ConicShellInteriorExteriorSpatialFunction,
InteriorExteriorSpatialFunction );

Expand All @@ -52,7 +52,7 @@ int itkConicShellInteriorExteriorSpatialFunctionTest( int, char *[] )
origin.Fill( 1.0 );

conicShellInteriorExteriorSpatialFunction->SetOrigin( origin );
TEST_SET_GET_VALUE( origin, conicShellInteriorExteriorSpatialFunction->GetOrigin() );
ITK_TEST_SET_GET_VALUE( origin, conicShellInteriorExteriorSpatialFunction->GetOrigin() );

ConicShellInteriorExteriorSpatialFunctionType::GradientType originGradient;
originGradient.Fill( 1.6 );
Expand All @@ -75,18 +75,18 @@ int itkConicShellInteriorExteriorSpatialFunctionTest( int, char *[] )

double distanceMin = 10.0;
conicShellInteriorExteriorSpatialFunction->SetDistanceMin( distanceMin );
TEST_SET_GET_VALUE( distanceMin, conicShellInteriorExteriorSpatialFunction->GetDistanceMin() );
ITK_TEST_SET_GET_VALUE( distanceMin, conicShellInteriorExteriorSpatialFunction->GetDistanceMin() );

double distanceMax = 50.0;
conicShellInteriorExteriorSpatialFunction->SetDistanceMax( distanceMax );
TEST_SET_GET_VALUE( distanceMax, conicShellInteriorExteriorSpatialFunction->GetDistanceMax() );
ITK_TEST_SET_GET_VALUE( distanceMax, conicShellInteriorExteriorSpatialFunction->GetDistanceMax() );

double epsilon = 1e-3;
conicShellInteriorExteriorSpatialFunction->SetEpsilon( epsilon );
TEST_SET_GET_VALUE( epsilon, conicShellInteriorExteriorSpatialFunction->GetEpsilon() );
ITK_TEST_SET_GET_VALUE( epsilon, conicShellInteriorExteriorSpatialFunction->GetEpsilon() );

bool polarity = false;
TEST_SET_GET_BOOLEAN( conicShellInteriorExteriorSpatialFunction, Polarity, polarity );
ITK_TEST_SET_GET_BOOLEAN( conicShellInteriorExteriorSpatialFunction, Polarity, polarity );


// Define two points to test the function
Expand Down Expand Up @@ -128,7 +128,7 @@ int itkConicShellInteriorExteriorSpatialFunctionTest( int, char *[] )
// Test for the opposite polarity
//
polarity = true;
TEST_SET_GET_BOOLEAN( conicShellInteriorExteriorSpatialFunction, Polarity, polarity );
ITK_TEST_SET_GET_BOOLEAN( conicShellInteriorExteriorSpatialFunction, Polarity, polarity );

insidePoint[0] = 60.0;
insidePoint[1] = 60.0;
Expand Down
Loading