Commit 3975b450 authored by Julien Osman's avatar Julien Osman
Browse files

FIX: Write the correct message when an error is detected

When CompareMetadataDict finds a difference in the metadata map, it
displays a message with the baseline and the test values. The 2
values were flipped.
parent 51b78f73
...@@ -1478,10 +1478,10 @@ int CompareMetadataDict( const MapType & baselineMap, ...@@ -1478,10 +1478,10 @@ int CompareMetadataDict( const MapType & baselineMap,
<< " does not match between test and baseline images: " << " does not match between test and baseline images: "
<< std::endl << std::endl
<< "Baseline image: " << "Baseline image: "
<< first1->second << first2->second
<< std::endl << std::endl
<< "Test image: " << "Test image: "
<< first2->second << first1->second
<< std::endl; << std::endl;
} }
} }
...@@ -1527,7 +1527,7 @@ int TestHelper::RegressionTestMetaData(const char* testImageFilename, const char ...@@ -1527,7 +1527,7 @@ int TestHelper::RegressionTestMetaData(const char* testImageFilename, const char
itkGenericExceptionMacro(<< "Exception detected while reading " << baselineImageFilename << " : " << e.GetDescription()); itkGenericExceptionMacro(<< "Exception detected while reading " << baselineImageFilename << " : " << e.GetDescription());
} }
// Read the baseline file // Read the test file
ReaderType::Pointer testReader = ReaderType::New(); ReaderType::Pointer testReader = ReaderType::New();
testReader->SetFileName(testImageFilename); testReader->SetFileName(testImageFilename);
try try
...@@ -1681,9 +1681,9 @@ int TestHelper::RegressionTestMetaData(const char* testImageFilename, const char ...@@ -1681,9 +1681,9 @@ int TestHelper::RegressionTestMetaData(const char* testImageFilename, const char
// Compare string keys (strict equality) // Compare string keys (strict equality)
errcount += CompareMetadataDict(baselineImageMetadata.StringKeys, errcount += CompareMetadataDict(baselineImageMetadata.StringKeys,
testImageMetadata.StringKeys, testImageMetadata.StringKeys,
m_ReportErrors, m_ReportErrors,
{}); {});
// Compare numeric keys // Compare numeric keys
auto compareDouble = [tolerance](double lhs, double rhs) auto compareDouble = [tolerance](double lhs, double rhs)
...@@ -1693,37 +1693,37 @@ int TestHelper::RegressionTestMetaData(const char* testImageFilename, const char ...@@ -1693,37 +1693,37 @@ int TestHelper::RegressionTestMetaData(const char* testImageFilename, const char
// Don't test TileHints and datatype, as these metadata are written by gdal drivers, not otb. // Don't test TileHints and datatype, as these metadata are written by gdal drivers, not otb.
std::vector<MDNum> untestedMDNum = {MDNum::TileHintX, MDNum::TileHintY, MDNum::DataType}; std::vector<MDNum> untestedMDNum = {MDNum::TileHintX, MDNum::TileHintY, MDNum::DataType};
errcount += CompareMetadataDict(baselineImageMetadata.NumericKeys, errcount += CompareMetadataDict(baselineImageMetadata.NumericKeys,
testImageMetadata.NumericKeys, testImageMetadata.NumericKeys,
m_ReportErrors, m_ReportErrors,
untestedMDNum, untestedMDNum,
compareDouble); compareDouble);
// Compare time keys (strict equality) // Compare time keys (strict equality)
errcount += CompareMetadataDict(baselineImageMetadata.TimeKeys, errcount += CompareMetadataDict(baselineImageMetadata.TimeKeys,
testImageMetadata.TimeKeys, testImageMetadata.TimeKeys,
m_ReportErrors, m_ReportErrors,
{}); {});
// Compare LUTs (strict equality) // Compare LUTs (strict equality)
errcount += CompareMetadataDict(baselineImageMetadata.LUT1DKeys, errcount += CompareMetadataDict(baselineImageMetadata.LUT1DKeys,
testImageMetadata.LUT1DKeys, testImageMetadata.LUT1DKeys,
m_ReportErrors, m_ReportErrors,
{}); {});
errcount += CompareMetadataDict(baselineImageMetadata.LUT2DKeys, errcount += CompareMetadataDict(baselineImageMetadata.LUT2DKeys,
testImageMetadata.LUT2DKeys, testImageMetadata.LUT2DKeys,
m_ReportErrors, m_ReportErrors,
{}); {});
// Compare extra keys // Compare extra keys
// Don't test OTB_VERSION, as it change with the version of OTB used // Don't test OTB_VERSION, as it change with the version of OTB used
std::vector<std::string> untestedExtra = {"OTB_VERSION"}; std::vector<std::string> untestedExtra = {"OTB_VERSION"};
errcount += CompareMetadataDict(baselineImageMetadata.ExtraKeys, errcount += CompareMetadataDict(baselineImageMetadata.ExtraKeys,
testImageMetadata.ExtraKeys, testImageMetadata.ExtraKeys,
m_ReportErrors, m_ReportErrors,
untestedExtra); untestedExtra);
if (baselineImageMetadata.Has(MDGeom::RPC)) if (baselineImageMetadata.Has(MDGeom::RPC))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment