Skip to content

Commit

Permalink
STYLE: Remove backslash + indent from literals in tests
Browse files Browse the repository at this point in the history
Removed unwanted (unintentional) spaces from test output messages, which were
caused by an indentation after a backslash continuation character, inside a
string literal. Using Notepad++ v8.4.5 Regular Expressions:

- Find what: `^([^"\r\n]*"[^"\r\n]* )\\\r\n[ ]+`
- Replace with: `$1`

- Find what: `^([^"\r\n]*"[^"\r\n]*)\\\r\n[ ]+`
- Replace with: `$1 `

Follow-up to pull request #3713
commit 69151c3
"STYLE: Remove backslash + indent from literals, to avoid unwanted spaces"
  • Loading branch information
N-Dekker authored and dzenanz committed Nov 7, 2022
1 parent c86fd78 commit e46ceaf
Show file tree
Hide file tree
Showing 23 changed files with 90 additions and 167 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ itkOtsuThresholdCalculatorVersusOtsuMultipleThresholdsCalculatorTest(int argc, c
if (itk::Math::NotAlmostEquals(otsuCalculator->GetThreshold(), otsuMultipleCalculator->GetOutput()[0]))
{
std::cerr << "Test failed!" << std::endl;
std::cerr << "Error in itk::OtsuThresholdCalculator::GetThreshold() or \
itk::OtsuMultipleThresholdsCalculator::GetOutput()"
<< std::endl;
std::cerr
<< "Error in itk::OtsuThresholdCalculator::GetThreshold() or itk::OtsuMultipleThresholdsCalculator::GetOutput()"
<< std::endl;
std::cout << "Computed Otsu threshold: " << otsuCalculator->GetThreshold()
<< " is different from computed Otsu multiple threshold: " << otsuMultipleCalculator->GetOutput()[0]
<< std::endl;
Expand Down
6 changes: 3 additions & 3 deletions Modules/IO/BMP/test/itkBMPImageIOTest3.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ itkBMPImageIOTest3(int argc, char * argv[])
if (it1.Value() != it2.Value())
{
std::cout << "Test failed!" << std::endl;
std::cout << "An image stored in a lower-left bitmap is different than \
the same image stored in an upper-left bitmap."
<< std::endl;
std::cout
<< "An image stored in a lower-left bitmap is different than the same image stored in an upper-left bitmap."
<< std::endl;
return EXIT_FAILURE;
}

Expand Down
6 changes: 3 additions & 3 deletions Modules/IO/BMP/test/itkBMPImageIOTest4.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ itkBMPImageIOTest4(int argc, char * argv[])
if (!(it1.Value() == it2.Value()))
{
std::cout << "Test failed!" << std::endl;
std::cout << "An image stored in a lower-left bitmap is different than \
the same image stored in an upper-left bitmap."
<< std::endl;
std::cout
<< "An image stored in a lower-left bitmap is different than the same image stored in an upper-left bitmap."
<< std::endl;
return EXIT_FAILURE;
}

Expand Down
6 changes: 3 additions & 3 deletions Modules/IO/BMP/test/itkBMPImageIOTest5.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ itkBMPImageIOTest5(int argc, char * argv[])
if (it1.Value() != it2.Value())
{
std::cout << "Test failed!" << std::endl;
std::cout << "An image stored in a lower-left bitmap is different than \
the same image stored in an upper-left bitmap."
<< std::endl;
std::cout
<< "An image stored in a lower-left bitmap is different than the same image stored in an upper-left bitmap."
<< std::endl;
return EXIT_FAILURE;
}

Expand Down
19 changes: 7 additions & 12 deletions Modules/Numerics/Statistics/test/itkCovarianceSampleFilterTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ itkCovarianceSampleFilterTest(int, char *[])
try
{
covarianceFilter->Update();
std::cerr << "Exception should have been thrown since \
Update() is invoked without setting an input "
<< std::endl;
std::cerr << "Exception should have been thrown since Update() is invoked without setting an input " << std::endl;
return EXIT_FAILURE;
}
catch (const itk::ExceptionObject & excp)
Expand All @@ -107,9 +105,7 @@ itkCovarianceSampleFilterTest(int, char *[])

if (covarianceFilter->GetInput() != nullptr)
{
std::cerr << "GetInput() should return nullptr if the input \
has not been set"
<< std::endl;
std::cerr << "GetInput() should return nullptr if the input has not been set" << std::endl;
return EXIT_FAILURE;
}

Expand Down Expand Up @@ -138,9 +134,8 @@ itkCovarianceSampleFilterTest(int, char *[])
if ((itk::Math::abs(mean[0] - mean2[0]) > epsilon) || (itk::Math::abs(mean[1] - mean2[1]) > epsilon) ||
(itk::Math::abs(mean[2] - mean2[2]) > epsilon))
{
std::cerr << "Mean parameter value retrieved using GetMean() and the decorator\
are not the same:: "
<< mean << "," << mean2 << std::endl;
std::cerr << "Mean parameter value retrieved using GetMean() and the decorator are not the same:: " << mean << ","
<< mean2 << std::endl;
return EXIT_FAILURE;
}

Expand Down Expand Up @@ -170,9 +165,9 @@ itkCovarianceSampleFilterTest(int, char *[])
(itk::Math::abs(meanCalculatedUsingMeanSampleFilter[1] - mean[1]) > epsilon) ||
(itk::Math::abs(meanCalculatedUsingMeanSampleFilter[2] - mean[2]) > epsilon))
{
std::cerr << "Mean calculated using the MeanSampleFilter is different from\
the one calculated using the covariance filter "
<< std::endl;
std::cerr
<< "Mean calculated using the MeanSampleFilter is different from the one calculated using the covariance filter "
<< std::endl;
std::cerr << "Mean computed with covariance filter = " << mean << std::endl;
std::cerr << "Mean computed with mean filter = " << meanCalculatedUsingMeanSampleFilter << std::endl;
return EXIT_FAILURE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,14 @@ itkDenseFrequencyContainer2Test(int, char *[])

if (container->SetFrequency(binOutOfBound, frequency))
{
std::cerr << "SetFrequency() method should have returned false boolean\
since the bin index is out of bound \n"
std::cerr << "SetFrequency() method should have returned false boolean since the bin index is out of bound \n"
<< std::endl;
return EXIT_FAILURE;
}

if (container->GetFrequency(binOutOfBound) != itk::NumericTraits<AbsoluteFrequencyType>::ZeroValue())
{
std::cerr << "GetFrequency() method should have returned zero frequency\
since the bin index is out of bound \n"
std::cerr << "GetFrequency() method should have returned zero frequency since the bin index is out of bound \n"
<< std::endl;
return EXIT_FAILURE;
}
Expand Down Expand Up @@ -125,9 +123,9 @@ itkDenseFrequencyContainer2Test(int, char *[])

if (container->IncreaseFrequency(binOutOfBound, frequency))
{
std::cerr << "IncreaseFrequency() method should have returned a false boolean\
since the bin index is out of bound \n"
<< std::endl;
std::cerr
<< "IncreaseFrequency() method should have returned a false boolean since the bin index is out of bound \n"
<< std::endl;
return EXIT_FAILURE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ itkDistanceToCentroidMembershipFunctionTest(int, char *[])
{
MeasurementVectorSizeType measurementVector2 = MeasurementVectorSize + 1;
function->SetMeasurementVectorSize(measurementVector2);
std::cerr << "Exception should have been thrown since we are trying to resize\
non-resizeable measurement vector type "
<< std::endl;
std::cerr
<< "Exception should have been thrown since we are trying to resize non-resizeable measurement vector type "
<< std::endl;
return EXIT_FAILURE;
}
catch (const itk::ExceptionObject & excp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ itkImageToListSampleAdaptorTestTemplate()
{
// purposely call Size() method prematurely in order to trigger an exception.
sample->Size();
std::cerr << "Exception should have been thrown since the input image \
is not set yet"
<< std::endl;
std::cerr << "Exception should have been thrown since the input image is not set yet" << std::endl;
}
catch (const itk::ExceptionObject & excp)
{
Expand All @@ -71,9 +69,7 @@ itkImageToListSampleAdaptorTestTemplate()
{
// purposely call GetTotalFrequency() method prematurely in order to trigger an exception.
sample->GetTotalFrequency();
std::cerr << "Exception should have been thrown since the input image \
is not set yet"
<< std::endl;
std::cerr << "Exception should have been thrown since the input image is not set yet" << std::endl;
}
catch (const itk::ExceptionObject & excp)
{
Expand All @@ -83,9 +79,7 @@ itkImageToListSampleAdaptorTestTemplate()
try
{
typename ImageToListSampleAdaptorType::MeasurementVectorType m = sample->GetMeasurementVector(0);
std::cerr << "Exception should have been thrown since the input image \
is not set yet "
<< m << std::endl;
std::cerr << "Exception should have been thrown since the input image is not set yet " << m << std::endl;
}
catch (const itk::ExceptionObject & excp)
{
Expand All @@ -95,9 +89,7 @@ itkImageToListSampleAdaptorTestTemplate()
try
{
typename ImageToListSampleAdaptorType::ImageConstPointer image = sample->GetImage();
std::cerr << "Exception should have been thrown since the input image \
is not set yet"
<< std::endl;
std::cerr << "Exception should have been thrown since the input image is not set yet" << std::endl;
}
catch (const itk::ExceptionObject & excp)
{
Expand All @@ -108,9 +100,7 @@ itkImageToListSampleAdaptorTestTemplate()
{
// purposely call GetFrequency() method prematurely in order to trigger an exception.
sample->GetFrequency(0);
std::cerr << "Exception should have been thrown since the input image \
is not set yet"
<< std::endl;
std::cerr << "Exception should have been thrown since the input image is not set yet" << std::endl;
}
catch (const itk::ExceptionObject & excp)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ itkImageToListSampleFilterTest(int, char *[])
try
{
filter->Update();
failureMeassage = "Exception should have been thrown since \
Update() is invoked without setting an input ";
failureMeassage = "Exception should have been thrown since Update() is invoked without setting an input ";
pass = false;
}
catch (const itk::ExceptionObject & excp)
Expand All @@ -152,15 +151,13 @@ itkImageToListSampleFilterTest(int, char *[])
if (filter->GetInput() != nullptr)
{
pass = false;
failureMeassage = "GetInput() should return nullptr if the input \
has not been set";
failureMeassage = "GetInput() should return nullptr if the input has not been set";
}

if (filter->GetMaskImage() != nullptr)
{
pass = false;
failureMeassage = "GetMaskImage() should return nullptr if mask image \
has not been set";
failureMeassage = "GetMaskImage() should return nullptr if mask image has not been set";
}


Expand Down Expand Up @@ -213,9 +210,7 @@ itkImageToListSampleFilterTest(int, char *[])
try
{
filter->Update();
std::cerr << "Exception should have been thrown since \
the mask has a different LargestPossibleRegion."
<< std::endl;
std::cerr << "Exception should have been thrown since the mask has a different LargestPossibleRegion." << std::endl;
return EXIT_FAILURE;
}
catch (const itk::ExceptionObject & excp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ itkJointDomainImageToListSampleAdaptorTest(int, char *[])
{
// calling Size() method prematurely in order to trigger an exception.
adaptor->Size();
std::cerr << "Exception should have been thrown since the input image \
is not set yet"
<< std::endl;
std::cerr << "Exception should have been thrown since the input image is not set yet" << std::endl;
}
catch (const itk::ExceptionObject & excp)
{
Expand All @@ -82,9 +80,7 @@ itkJointDomainImageToListSampleAdaptorTest(int, char *[])
{
// calling GetTotalFrequency() method prematurely in order to trigger an exception.
adaptor->GetTotalFrequency();
std::cerr << "Exception should have been thrown since the input image \
is not set yet"
<< std::endl;
std::cerr << "Exception should have been thrown since the input image is not set yet" << std::endl;
}
catch (const itk::ExceptionObject & excp)
{
Expand All @@ -95,9 +91,7 @@ itkJointDomainImageToListSampleAdaptorTest(int, char *[])
{
// calling GetMeasurementVector() method prematurely in order to trigger an exception.
adaptor->GetMeasurementVector(0);
std::cerr << "Exception should have been thrown since the input image \
is not set yet"
<< std::endl;
std::cerr << "Exception should have been thrown since the input image is not set yet" << std::endl;
}
catch (const itk::ExceptionObject & excp)
{
Expand All @@ -108,9 +102,7 @@ itkJointDomainImageToListSampleAdaptorTest(int, char *[])
{
// calling GetImage() method prematurely in order to trigger an exception.
adaptor->GetImage();
std::cerr << "Exception should have been thrown since the input image \
is not set yet"
<< std::endl;
std::cerr << "Exception should have been thrown since the input image is not set yet" << std::endl;
}
catch (const itk::ExceptionObject & excp)
{
Expand All @@ -121,9 +113,7 @@ itkJointDomainImageToListSampleAdaptorTest(int, char *[])
{
// calling GetFrequency() method prematurely in order to trigger an exception.
adaptor->GetFrequency(0);
std::cerr << "Exception should have been thrown since the input image \
is not set yet"
<< std::endl;
std::cerr << "Exception should have been thrown since the input image is not set yet" << std::endl;
}
catch (const itk::ExceptionObject & excp)
{
Expand Down Expand Up @@ -225,9 +215,7 @@ itkJointDomainImageToListSampleAdaptorTest(int, char *[])
{
if (!itk::Math::FloatAlmostEqual(v1[m], v2[m], 4, epsilon))
{
std::cerr << "Accessing the measurement vector using the two method produced different \
result "
<< std::endl;
std::cerr << "Accessing the measurement vector using the two method produced different result " << std::endl;
return EXIT_FAILURE;
}
}
Expand Down
6 changes: 3 additions & 3 deletions Modules/Numerics/Statistics/test/itkListSampleTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ itkListSampleTest(int argc, char * argv[])
try
{
sample->PushBack(mvLargerSize);
std::cerr << "Exception was expected since the vector that was\
added to the list has size different from what is set"
<< std::endl;
std::cerr
<< "Exception was expected since the vector that was added to the list has size different from what is set"
<< std::endl;
return EXIT_FAILURE;
}
catch (const itk::ExceptionObject & excp)
Expand Down
6 changes: 2 additions & 4 deletions Modules/Numerics/Statistics/test/itkMeanSampleFilterTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ itkMeanSampleFilterTest(int, char *[])
try
{
filter->Update();
failureMeassage = "Exception should have been thrown since \
Update() is invoked without setting an input ";
failureMeassage = "Exception should have been thrown since Update() is invoked without setting an input ";
pass = false;
}
catch (const itk::ExceptionObject & excp)
Expand All @@ -76,8 +75,7 @@ itkMeanSampleFilterTest(int, char *[])
if (filter->GetInput() != nullptr)
{
pass = false;
failureMeassage = "GetInput() should return nullptr if the input \
has not been set";
failureMeassage = "GetInput() should return nullptr if the input has not been set";
}

filter->ResetPipeline();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ itkMembershipFunctionBaseTest(int, char *[])
try
{
function->SetMeasurementVectorSize(MeasurementVectorSize + 1);
std::cerr << "Exception should have been thrown since we are trying to resize\
non-resizeable measurement vector type "
<< std::endl;
std::cerr
<< "Exception should have been thrown since we are trying to resize non-resizeable measurement vector type "
<< std::endl;
return EXIT_FAILURE;
}
catch (const itk::ExceptionObject & excp)
Expand Down
Loading

0 comments on commit e46ceaf

Please sign in to comment.