Skip to content

Commit

Permalink
Extend unit test to test the original failure case
Browse files Browse the repository at this point in the history
Adds an output parameter set by the algorithm which would have
previously been added to the script output.

Refs #11128
  • Loading branch information
DanNixon committed Feb 20, 2015
1 parent 2178ddf commit 77a79f6
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions Code/Mantid/Framework/API/test/ScriptBuilderTest.h
Expand Up @@ -27,7 +27,7 @@ class ScriptBuilderTest : public CxxTest::TestSuite
const std::string workspaceMethodName() const { return "methodname"; }
const std::string workspaceMethodOnTypes() const { return "MatrixWorkspace;ITableWorkspace"; }
const std::string workspaceMethodInputProperty() const { return "InputWorkspace"; }

void init()
{
declareProperty("PropertyA", "Hello");
Expand All @@ -52,11 +52,12 @@ class ScriptBuilderTest : public CxxTest::TestSuite
const std::string workspaceMethodName() const { return "methodname"; }
const std::string workspaceMethodOnTypes() const { return "MatrixWorkspace;ITableWorkspace"; }
const std::string workspaceMethodInputProperty() const { return "InputWorkspace"; }

void init()
{
declareProperty("PropertyA", "Hello");
declareProperty("PropertyB", "World");
declareProperty("PropertyC", "", Direction::Output);
}
void exec()
{
Expand All @@ -65,6 +66,7 @@ class ScriptBuilderTest : public CxxTest::TestSuite
alg->initialize();
alg->setProperty("PropertyA", "I Don't exist!");
alg->execute();
setProperty("PropertyC", "I have been set!");
}
};

Expand All @@ -81,7 +83,7 @@ class ScriptBuilderTest : public CxxTest::TestSuite
const std::string workspaceMethodName() const { return "methodname"; }
const std::string workspaceMethodOnTypes() const { return "MatrixWorkspace;ITableWorkspace"; }
const std::string workspaceMethodInputProperty() const { return "InputWorkspace"; }

void init()
{
declareProperty("PropertyA", 13);
Expand Down Expand Up @@ -115,7 +117,7 @@ class ScriptBuilderTest : public CxxTest::TestSuite
const std::string workspaceMethodName() const { return "methodname"; }
const std::string workspaceMethodOnTypes() const { return "Workspace;MatrixWorkspace;ITableWorkspace"; }
const std::string workspaceMethodInputProperty() const { return "InputWorkspace"; }

void init()
{
declareProperty(new WorkspaceProperty<MatrixWorkspace>("InputWorkspace", "", Direction::Input));
Expand All @@ -137,7 +139,7 @@ class ScriptBuilderTest : public CxxTest::TestSuite
};

private:

public:

void setUp()
Expand All @@ -155,7 +157,7 @@ class ScriptBuilderTest : public CxxTest::TestSuite
Mantid::API::AlgorithmFactory::Instance().unsubscribe("BasicAlgorithm",1);
Mantid::API::AlgorithmFactory::Instance().unsubscribe("SubAlgorithm",1);
}

void test_Build_Simple()
{
std::string result[] = {
Expand Down Expand Up @@ -220,7 +222,7 @@ class ScriptBuilderTest : public CxxTest::TestSuite
alg->setRethrows(true);
alg->setProperty("InputWorkspace", input);
alg->setPropertyValue("OutputWorkspace", "test_output_workspace");
alg->execute();
alg->execute();

auto ws = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>("test_output_workspace");
auto wsHist = ws->getHistory();
Expand Down Expand Up @@ -280,7 +282,7 @@ class ScriptBuilderTest : public CxxTest::TestSuite
alg->setProperty("InputWorkspace", "test_output_workspace");
alg->setPropertyValue("OutputWorkspace", "test_output_workspace");
alg->execute();

auto ws = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>("test_output_workspace");
auto wsHist = ws->getHistory();
auto view = wsHist.createView();
Expand All @@ -305,7 +307,7 @@ class ScriptBuilderTest : public CxxTest::TestSuite
AnalysisDataService::Instance().remove("test_input_workspace");
}


void test_Build_Simple_with_backslash()
{
//checks that property values with \ get prefixed with r, eg. filename=r'c:\test\data.txt'
Expand Down

0 comments on commit 77a79f6

Please sign in to comment.