Skip to content

Commit

Permalink
Re #9900. CreateChunkingFromInstrumentTest
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Aug 1, 2014
1 parent 2d95a23 commit c709d9d
Showing 1 changed file with 3 additions and 31 deletions.
Expand Up @@ -5,6 +5,7 @@

#include "MantidAPI/ITableWorkspace.h"
#include "MantidDataHandling/CreateChunkingFromInstrument.h"
#include "MantidKernel/Timer.h"

using Mantid::DataHandling::CreateChunkingFromInstrument;
using namespace Mantid::API;
Expand All @@ -25,37 +26,6 @@ class CreateChunkingFromInstrumentTest : public CxxTest::TestSuite
TS_ASSERT( alg.isInitialized() )
}

void test_snap()
{
// Name of the output workspace.
std::string outWSName("CreateChunkingFromInstrumentTest_OutputSNAP");

CreateChunkingFromInstrument alg;
TS_ASSERT_THROWS_NOTHING( alg.initialize() )
TS_ASSERT( alg.isInitialized() )
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("InstrumentName", "snap") );
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("ChunkNames", "East,West"); );
TS_ASSERT_THROWS_NOTHING( alg.setProperty("MaxBankNumber", 20) );
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", outWSName) );
TS_ASSERT_THROWS_NOTHING( alg.execute(); );
TS_ASSERT( alg.isExecuted() );

// Retrieve the workspace from data service. TODO: Change to your desired type
Workspace_sptr ws;
TS_ASSERT_THROWS_NOTHING( ws = AnalysisDataService::Instance().retrieveWS<Workspace>(outWSName) );
TS_ASSERT(ws);
if (!ws) return;

// Check the results
ITableWorkspace_sptr tws = boost::dynamic_pointer_cast<ITableWorkspace>(ws);
TS_ASSERT_EQUALS(tws->columnCount(), 1);
TS_ASSERT_EQUALS(tws->getColumnNames()[0], "BankName");
TS_ASSERT_EQUALS(tws->rowCount(), 2);

// Remove workspace from the data service.
AnalysisDataService::Instance().remove(outWSName);
}

void test_pg3()
{
// Name of the output workspace.
Expand Down Expand Up @@ -97,6 +67,7 @@ class CreateChunkingFromInstrumentTest : public CxxTest::TestSuite
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("InstrumentName", "seq") );
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("ChunkBy", "All"); );
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", outWSName) );
TS_ASSERT_THROWS_NOTHING( alg.setProperty("MaxRecursionDepth",2); );
TS_ASSERT_THROWS_NOTHING( alg.execute(); );
TS_ASSERT( alg.isExecuted() );

Expand Down Expand Up @@ -129,6 +100,7 @@ class CreateChunkingFromInstrumentTest : public CxxTest::TestSuite
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("InstrumentName", "seq") );
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("ChunkNames", "B row,C row,D row"); );
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", outWSName) );
TS_ASSERT_THROWS_NOTHING( alg.setProperty("MaxRecursionDepth",2); );
TS_ASSERT_THROWS_NOTHING( alg.execute() );//, std::runtime_error );
TS_ASSERT( !alg.isExecuted() );
}
Expand Down

0 comments on commit c709d9d

Please sign in to comment.