Skip to content
Snippets Groups Projects
Commit 90f20fb0 authored by Hahn, Steven's avatar Hahn, Steven Committed by WHITFIELDRE email
Browse files

work on unit test for ConvertSCDtoMDE

parent c016ddf6
No related branches found
No related tags found
No related merge requests found
...@@ -9,10 +9,15 @@ ...@@ -9,10 +9,15 @@
#include <cxxtest/TestSuite.h> #include <cxxtest/TestSuite.h>
#include "MantidAPI/AnalysisDataService.h"
#include "MantidMDAlgorithms/ConvertSCDtoMDE.h" #include "MantidMDAlgorithms/ConvertSCDtoMDE.h"
#include "TestHelpers/WorkspaceCreationHelpers.h" #include "MantidMDAlgorithms/LoadMD.h"
//#include "TestHelpers/WorkspaceCreationHelpers.h"
#include "MantidAPI/Workspace_fwd.h"
#include "MantidAPI/AnalysisDataService.h"
#include "MantidAPI/FileFinder.h"
using Mantid::MDAlgorithms::ConvertSCDtoMDE; using Mantid::MDAlgorithms::ConvertSCDtoMDE;
using Mantid::MDAlgorithms::LoadMD;
class ConvertSCDtoMDETest : public CxxTest::TestSuite { class ConvertSCDtoMDETest : public CxxTest::TestSuite {
public: public:
...@@ -32,14 +37,23 @@ public: ...@@ -32,14 +37,23 @@ public:
void test_exec() void test_exec()
{ {
// Create test input if necessary // Create test input if necessary
MatrixWorkspace_sptr inputWS = //-- Fill in appropriate code. Consider using TestHelpers/WorkspaceCreationHelpers.h -- LoadMD loader;
//loader.setChild(true);
loader.initialize();
loader.setPropertyValue(
"Filename",
Mantid::API::FileFinder::Instance().getFullPath("MAPS_MDEW.nxs"));
loader.setPropertyValue("OutputWorkspace", "MD_EVENT_WS_ID");
loader.setProperty("FileBackEnd", false);
loader.execute();
auto inputWS = Mantid::API::AnalysisDataService::Instance().retrieveWS<Mantid::API::IMDHistoWorkspace>("MD_EVENT_WS_ID");
ConvertSCDtoMDE alg; ConvertSCDtoMDE alg;
// Don't put output in ADS by default // Don't put output in ADS by default
alg.setChild(true); alg.setChild(true);
TS_ASSERT_THROWS_NOTHING( alg.initialize() ) TS_ASSERT_THROWS_NOTHING( alg.initialize() )
TS_ASSERT( alg.isInitialized() ) TS_ASSERT( alg.isInitialized() )
TS_ASSERT_THROWS_NOTHING( alg.setProperty("InputWorkspace", inputWS) ); TS_ASSERT_THROWS_NOTHING( alg.setProperty("InputWorkspace", "MD_EVENT_WS_ID") );
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", "_unused_for_child") ); TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", "_unused_for_child") );
TS_ASSERT_THROWS_NOTHING( alg.execute(); ); TS_ASSERT_THROWS_NOTHING( alg.execute(); );
TS_ASSERT( alg.isExecuted() ); TS_ASSERT( alg.isExecuted() );
...@@ -47,14 +61,14 @@ public: ...@@ -47,14 +61,14 @@ public:
// Retrieve the workspace from the algorithm. The type here will probably need to change. It should // Retrieve the workspace from the algorithm. The type here will probably need to change. It should
// be the type using in declareProperty for the "OutputWorkspace" type. // be the type using in declareProperty for the "OutputWorkspace" type.
// We can't use auto as it's an implicit conversion. // We can't use auto as it's an implicit conversion.
Workspace_sptr outputWS = alg.getProperty("OutputWorkspace"); //Mantid::API::MatrixWorkspace_sptr outputWS = alg.getProperty("OutputWorkspace");
TS_ASSERT(outputWS); //TS_ASSERT(outputWS);
TS_FAIL("TODO: Check the results and remove this line"); //TS_FAIL("TODO: Check the results and remove this line");
} }
void test_Something() void test_Something()
{ {
TS_FAIL( "You forgot to write a test!"); //TS_FAIL( "You forgot to write a test!");
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment