Skip to content

Commit

Permalink
Test header of Output file re #6896
Browse files Browse the repository at this point in the history
Signed-off-by: Karl Palmen <karl.palmen@stfc.ac.uk>
  • Loading branch information
KarlPalmen committed Jul 22, 2013
1 parent 55a8cfa commit 3e3ede1
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,21 @@ class ModifyDetectorDotDatFileTest : public CxxTest::TestSuite
// Check output file
std::string fullFilename = alg.getPropertyValue("OutputFilename"); //Get absolute path
// has the algorithm written the output file to disk?
TS_ASSERT( Poco::File(fullFilename).exists() );

bool OutputFileExists = Poco::File(fullFilename).exists();
TS_ASSERT( OutputFileExists );
// If output file exists do some tests on its contents
if( OutputFileExists) {
std::ifstream in(fullFilename.c_str());
std::string header;

// Check header has name of algorithm in it
getline( in, header);
bool headerHasNameOfAlgorithmInIt = header.find("ModifyDetectorDotDatFile") != std::string::npos;
TS_ASSERT( headerHasNameOfAlgorithmInIt );
in.close();

}

// Remove output file
Poco::File(fullFilename).remove();
}
Expand Down

0 comments on commit 3e3ede1

Please sign in to comment.