Skip to content

Commit

Permalink
Refs #8922 Fix unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Jackson committed May 14, 2014
1 parent 60dfa90 commit f9dc5b7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
9 changes: 7 additions & 2 deletions Code/Mantid/Framework/API/test/WorkspaceHistoryTest.h
Expand Up @@ -371,8 +371,8 @@ class WorkspaceHistoryTest : public CxxTest::TestSuite

const auto & histories = wsHistory.getAlgorithmHistories();
TS_ASSERT_EQUALS(3,histories.size());
const auto history = wsHistory.getAlgorithmHistory(1);

auto history = wsHistory.getAlgorithmHistory(1);

TS_ASSERT_EQUALS("CreateTransmissionWorkspaceAuto", history->name());
TS_ASSERT_EQUALS(1, history->version());
Expand All @@ -382,6 +382,11 @@ class WorkspaceHistoryTest : public CxxTest::TestSuite
TS_ASSERT_EQUALS("CreateTransmissionWorkspace", childHistory->name());
TS_ASSERT_EQUALS(1, childHistory->version());

history = wsHistory.getAlgorithmHistory(2);

TS_ASSERT_EQUALS("SaveNexusProcessed", history->name());
TS_ASSERT_EQUALS(1, history->version());

loadhandle->close();
}

Expand Down
24 changes: 13 additions & 11 deletions Code/Mantid/Framework/API/test/WorkspacePropertyTest.h
Expand Up @@ -191,17 +191,6 @@ class WorkspacePropertyTest : public CxxTest::TestSuite
TS_ASSERT( ! history2.isDefault() )
TS_ASSERT_EQUALS( history2.type(), wsp2->type() )
TS_ASSERT_EQUALS( history2.direction(), 1 )

wsp3->setValue("");
PropertyHistory history3 = wsp3->createHistory();
TS_ASSERT_EQUALS( history3.name(), "workspace3" )
TS_ASSERT( !history3.value().empty() )
TS_ASSERT_EQUALS( history3.value().substr(0,5), "__TMP" )
//TS_ASSERT( history3.isDefault() )
TS_ASSERT_EQUALS( history3.type(), wsp3->type() )
TS_ASSERT_EQUALS( history3.direction(), 2 )
wsp3->setValue("ws3");

}

void testStore()
Expand Down Expand Up @@ -230,6 +219,19 @@ class WorkspacePropertyTest : public CxxTest::TestSuite
TS_ASSERT( ! wsp3->operator()() )
}

void testTempName()
{
wsp4->setValue("");
// Create and assign the workspace
Workspace_sptr space;
TS_ASSERT_THROWS_NOTHING(space = WorkspaceFactory::Instance().create("WorkspacePropertyTest",1,1,1) );
*wsp4 = space;

PropertyHistory history = wsp4->createHistory();
TS_ASSERT( !history.value().empty() )
TS_ASSERT_EQUALS( history.value().substr(0,5), "__TMP" )
}

void testDirection()
{
TS_ASSERT_EQUALS( wsp1->direction(), 0 );
Expand Down
Expand Up @@ -68,6 +68,8 @@ class GeneratePythonScriptTest : public CxxTest::TestSuite
"#Python Script Generated by GeneratePythonScript Algorithm",
"######################################################################",
"ERROR: MISSING ALGORITHM: NonExistingAlgorithm with parameters Algorithm: NonExistingAlgorithm v1",
" Execution Date: 1970-Jan-01 00:00:00",
" Execution Duration: -1 seconds",
" Parameters:",
" Name: InputWorkspace, Value: [\\_A-Za-z0-9]*, Default\\?: Yes, Direction: Input",
" Name: OutputWorkspace, Value: [\\_A-Za-z0-9]*, Default\\?: Yes, Direction: Output",
Expand Down Expand Up @@ -107,7 +109,7 @@ class GeneratePythonScriptTest : public CxxTest::TestSuite
}

// Verify that if we set the content of ScriptText that it is set correctly.
alg.setPropertyValue("ScriptText", result[10]);
alg.setPropertyValue("ScriptText", result[12]);
TS_ASSERT_EQUALS(alg.getPropertyValue("ScriptText"), "CropWorkspace\\(InputWorkspace='testGeneratePython',OutputWorkspace='testGeneratePython',XMin='2',XMax='5'\\)");

file.close();
Expand Down
Binary file not shown.

0 comments on commit f9dc5b7

Please sign in to comment.