Skip to content

Commit

Permalink
BUG: Remove unintended << concatenation of literals in test output
Browse files Browse the repository at this point in the history
Avoided unintended concatenations, like "zeroMemory", "outputbackground",
"inputImageFilemaskImageFile", etc., which appeared on standard output when
inserting multiple literal strings consecutively into the output stream.
Separated those concatenated words either by a single space character, or by a
period _and_ a space (whichever is appropriate).
  • Loading branch information
N-Dekker authored and dzenanz committed Oct 20, 2022
1 parent ab62a8e commit 49150c8
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 33 deletions.
4 changes: 2 additions & 2 deletions Modules/Core/Common/test/itkMemoryProbesCollecterBaseTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ itkMemoryProbesCollecterBaseTest(int, char *[])
std::cout << " Total Value " << probe.GetTotal() << std::endl;
if (total == 0)
{
std::cout << "WARNING: Total memory usage should be greater than zero"
<< "Memory Probes do not work on this platform" << std::endl;
std::cout << "WARNING: Total memory usage should be greater than zero. Memory Probes do not work on this platform"
<< std::endl;
delete[] buf;
return EXIT_SUCCESS;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,8 @@ itkResampleImageTest2Streaming(int argc, char * argv[])
{
std::cerr << "Missing parameters." << std::endl;
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv);
std::cerr << "inputImage referenceImage "
<< "resampledImageLinear resampledImageNonLinear "
<< "resampledImageLinearNearestExtrapolate"
<< "resampledImageNonLinearNearestExtrapolate";
std::cerr << "inputImage referenceImage resampledImageLinear resampledImageNonLinear "
"resampledImageLinearNearestExtrapolate resampledImageNonLinearNearestExtrapolate";
std::cerr << std::endl;
return EXIT_FAILURE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ itkStatisticsRelabelLabelMapFilterTest1(int argc, char * argv[])
if (argc < 6)
{
std::cerr << "Missing Parameters." << std::endl;
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " input feature output"
<< "background reverseOrdering attribute" << std::endl;
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv)
<< " input feature output background reverseOrdering attribute" << std::endl;
return EXIT_FAILURE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,8 @@ itkRenyiEntropyMaskedThresholdImageFilterTest(int argc, char * argv[])
{
std::cerr << "Missing parameters." << std::endl;
std::cerr << "Usage:" << std::endl;
std::cerr << itkNameOfTestExecutableMacro(argv) << " inputImageFile"
<< " maskImageFile"
<< " outputImageFile"
<< " maskOutput"
<< " maskValue"
<< "expectedThreshold" << std::endl;
std::cerr << itkNameOfTestExecutableMacro(argv)
<< " inputImageFile maskImageFile outputImageFile maskOutput maskValue expectedThreshold" << std::endl;
return EXIT_FAILURE;
}

Expand Down
3 changes: 1 addition & 2 deletions Modules/IO/CSV/test/itkCSVArray2DFileReaderTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ itkCSVArray2DFileReaderTest(int argc, char * argv[])
}
if (!caught)
{
std::cerr << "An exception should have been caught here as the filename does"
<< "not exist! Test fails." << std::endl;
std::cerr << "An exception should have been caught here as the filename does not exist! Test fails." << std::endl;
return EXIT_FAILURE;
}

Expand Down
11 changes: 5 additions & 6 deletions Modules/IO/CSV/test/itkCSVNumericObjectFileWriterTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,13 @@ itkCSVNumericObjectFileWriterTest(int argc, char * argv[])
{
caught = true;
std::cerr << "Exception caught!" << std::endl;
std::cerr << "This is an expected exception as there is no input"
<< "file provided." << std::endl;
std::cerr << "This is an expected exception as there is no input file provided." << std::endl;
std::cerr << exp << std::endl;
}
if (!caught)
{
std::cerr << "An exception should have been caught here as there"
<< "is no input file provided. Test fails." << std::endl;
std::cerr << "An exception should have been caught here as there is no input file provided. Test fails."
<< std::endl;
return EXIT_FAILURE;
}

Expand All @@ -104,8 +103,8 @@ itkCSVNumericObjectFileWriterTest(int argc, char * argv[])
}
if (!caught)
{
std::cerr << "An exception should have been caught here as there is no"
<< "input object to write out. Test fails." << std::endl;
std::cerr << "An exception should have been caught here as there is no input object to write out. Test fails."
<< std::endl;
return EXIT_FAILURE;
}

Expand Down
4 changes: 1 addition & 3 deletions Modules/IO/TIFF/test/itkTIFFImageIOCompressionTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,7 @@ itkTIFFImageIOCompressionTest(int argc, char * argv[])
if (argc < 4)
{
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " inputFile"
<< " outputFile"
<< "compression"
<< "[JPEGQuality]" << std::endl;
<< " outputFile compression [JPEGQuality]" << std::endl;
return EXIT_FAILURE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,9 @@ itkMahalanobisDistanceMetricTest(int, char *[])
try
{
distance->Evaluate(measurementSingleComponent, measurementSingleComponent3);
std::cerr << "Attempting to compute distance between unequal size measurement vectors"
<< "Exception should have been thrown: " << std::endl;
std::cerr
<< "Attempting to compute distance between unequal size measurement vectors. Exception should have been thrown: "
<< std::endl;
return EXIT_FAILURE;
}
catch (const itk::ExceptionObject & excpt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ itkImageClassifierFilterTest(int argc, char * argv[])
try
{
filter->Update();
std::cerr << "Attempting to run a classification without setting"
<< "decision rule, should throw an exception" << std::endl;
std::cerr << "Attempting to run a classification without setting decision rule, should throw an exception"
<< std::endl;
return EXIT_FAILURE;
}
catch (const itk::ExceptionObject & excp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ itkSampleClassifierFilterTest1(int, char *[])
try
{
filter->Update();
std::cerr << "Attempting to run a classification without setting"
<< "decision rule, should throw an exception" << std::endl;
std::cerr << "Attempting to run a classification without setting decision rule, should throw an exception"
<< std::endl;
return EXIT_FAILURE;
}
catch (const itk::ExceptionObject & excp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ itkSampleClassifierFilterTest3(int, char *[])
try
{
filter->Update();
std::cerr << "Exception should be thrown since weight array has size different"
<< "from the number of classes set" << std::endl;
std::cerr << "Exception should be thrown since weight array has size different from the number of classes set"
<< std::endl;
return EXIT_FAILURE;
}
catch (const itk::ExceptionObject & excp)
Expand Down

0 comments on commit 49150c8

Please sign in to comment.