Skip to content

Commit

Permalink
Refs #4980 add test for events
Browse files Browse the repository at this point in the history
  • Loading branch information
VickieLynch committed Mar 26, 2012
1 parent 5589a17 commit 4c075d3
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Code/Mantid/Framework/MPIAlgorithms/test/GatherWorkspacesTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,31 @@ class GatherWorkspacesTest : public CxxTest::TestSuite
TS_ASSERT_EQUALS( inWS->getInstrument()->baseInstrument(), outWS->getInstrument()->baseInstrument() );
}

void testEvents()
{
MPIAlgorithms::GatherWorkspaces gatherer;
TS_ASSERT_THROWS_NOTHING( gatherer.initialize() );
// Create a small workspace
DataObjects::EventWorkspace_sptr inWS = WorkspaceCreationHelper::createEventWorkspaceWithFullInstrument(1,5, true);

TS_ASSERT_THROWS_NOTHING( gatherer.setProperty("InputWorkspace",inWS) );
TS_ASSERT_THROWS_NOTHING( gatherer.setProperty("PreserveEvents",true) );
gatherer.setChild(true); // Make a child algorithm to keep the result out of the ADS

TS_ASSERT( gatherer.execute() );
API::MatrixWorkspace_const_sptr outWS = gatherer.getProperty("OutputWorkspace");
TS_ASSERT_EQUALS( inWS->size(), outWS->size() );
for (int i=0; i < 5; ++i)
{
TS_ASSERT_EQUALS( inWS->readX(0)[i], outWS->readX(0)[i] );
TS_ASSERT_EQUALS( inWS->readY(0)[i], outWS->readY(0)[i] );
TS_ASSERT_EQUALS( inWS->readE(0)[i], outWS->readE(0)[i] );
//TODO: Check spectrum numbers and detector IDs are copied correctly (perhaps?)
}

TS_ASSERT_EQUALS( inWS->getInstrument()->baseInstrument(), outWS->getInstrument()->baseInstrument() );
}

// TODO: Work out a way of testing under MPI because absent that the test is not very interesting
};

Expand Down

0 comments on commit 4c075d3

Please sign in to comment.