Skip to content

Commit

Permalink
Unit test checks that Output file can be parsed as XML file re #7617
Browse files Browse the repository at this point in the history
Also some unnecessary includes were removed from the ConvertFullprofToXML.cpp.

Signed-off-by: Karl Palmen <karl.palmen@stfc.ac.uk>
  • Loading branch information
KarlPalmen committed Sep 23, 2013
1 parent 83e0b74 commit 7704157
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ Convert the initial fitting parameters in a Fullprof file to XML format in an [[
#include <Poco/DOM/Document.h>
#include <Poco/DOM/DOMWriter.h>
#include <Poco/DOM/Element.h>
#include <Poco/DOM/Text.h>
#include <Poco/DOM/DOMParser.h>
#include <Poco/DOM/Document.h>
#include <Poco/DOM/NodeList.h>
#include <Poco/DOM/NodeIterator.h>
#include <Poco/DOM/NodeFilter.h>

#include <boost/lexical_cast.hpp>

Expand Down
11 changes: 11 additions & 0 deletions Code/Mantid/Framework/DataHandling/test/ConvertFullprofToXMLTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
#include <fstream>
#include <Poco/File.h>

#include <Poco/DOM/Document.h>
#include <Poco/DOM/DOMParser.h>
#include <Poco/DOM/Element.h>

using Mantid::DataHandling::ConvertFullprofToXML;

using namespace Mantid;
Expand Down Expand Up @@ -62,6 +66,13 @@ class ConvertFullprofToXMLTest : public CxxTest::TestSuite
outputFilename = alg.getPropertyValue("outputFilename"); //Get absolute path
TS_ASSERT( Poco::File(outputFilename).exists() );

// Check output file
std::string xmlText = Strings::loadFile(outputFilename);
Poco::XML::DOMParser pParser;
Poco::XML::Document* doc;
TS_ASSERT_THROWS_NOTHING(doc = pParser.parseString(xmlText));
TS_ASSERT(doc);

//Clean up
Poco::File(inputFilename).remove();
Poco::File(outputFilename).remove();
Expand Down

0 comments on commit 7704157

Please sign in to comment.