From 5313d943d32996374c6632bd004923d6c5847dc8 Mon Sep 17 00:00:00 2001 From: Wenduo Zhou Date: Mon, 24 Feb 2014 11:55:02 -0500 Subject: [PATCH] Added a unit test to expose the problem. Refs #9034. --- .../test/SaveGSASInstrumentFileTest.h | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Code/Mantid/Framework/Algorithms/test/SaveGSASInstrumentFileTest.h b/Code/Mantid/Framework/Algorithms/test/SaveGSASInstrumentFileTest.h index f23296261a8b..1830665796b1 100644 --- a/Code/Mantid/Framework/Algorithms/test/SaveGSASInstrumentFileTest.h +++ b/Code/Mantid/Framework/Algorithms/test/SaveGSASInstrumentFileTest.h @@ -82,6 +82,42 @@ class SaveGSASInstrumentFileTest : public CxxTest::TestSuite return; } + //---------------------------------------------------------------------------------------------- + void test_SaveGSSInstrumentFile_LoadFile() + { + Mantid::API::FrameworkManager::Instance(); + + // Set up the algorithm + SaveGSASInstrumentFile saver; + saver.initialize(); + TS_ASSERT(saver.isInitialized()); + + saver.setProperty("InputFileName", "2011B_HR60b2.irf"); + saver.setProperty("OutputFilename", "PG3_Bank2.iparm"); + saver.setProperty("Instrument", "powgen"); + saver.setPropertyValue("ChopperFrequency", "60"); + saver.setProperty("IDLine", "PG60_2011B"); + saver.setProperty("Sample", "LaB6"); + saver.setProperty("L1", 60.0); + saver.setProperty("TwoTheta", 90.0); + + // Execute the algorithm + saver.execute(); + TS_ASSERT(saver.isExecuted()); + + // Check the output file's existence and size + std::string filename = saver.getProperty("OutputFilename"); // get full pathname + TS_ASSERT(Poco::File(filename).exists()); + + // Clean + AnalysisDataService::Instance().remove("PG3ProfileTable"); + Poco::File(filename).remove(); + + return; + } + + + //---------------------------------------------------------------------------------------------- /** Test on import FP .irf file and import multiple banks */