Skip to content

Commit

Permalink
Re #8837 Use detector grouping table in unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
raquelalvarezbanos committed Mar 9, 2015
1 parent a089ad6 commit 79eaaeb
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion Code/Mantid/Framework/DataHandling/test/LoadMuonNexus1Test.h
Expand Up @@ -309,6 +309,7 @@ class LoadMuonNexus1Test : public CxxTest::TestSuite
LoadMuonNexus1 alg2;

const std::string deadTimeWSName = "LoadMuonNexus1Test_DeadTimes";
const std::string groupingWSName = "LoadMuonNexus1Test_Grouping";

// Execute alg1
// It will only load some spectra
Expand All @@ -320,6 +321,7 @@ class LoadMuonNexus1Test : public CxxTest::TestSuite
alg1.setPropertyValue("SpectrumMin", "5");
alg1.setPropertyValue("SpectrumMax", "10");
alg1.setPropertyValue("DeadTimeTable", deadTimeWSName);
alg1.setPropertyValue("DetectorGroupingTable", groupingWSName);
TS_ASSERT_THROWS_NOTHING(alg1.execute());
TS_ASSERT( alg1.isExecuted() );
// Get back the saved workspace
Expand Down Expand Up @@ -376,7 +378,24 @@ class LoadMuonNexus1Test : public CxxTest::TestSuite
TS_ASSERT_DELTA( deadTimeTable->Double(6,1), 0.00254914, 0.00000001 );
AnalysisDataService::Instance().remove(deadTimeWSName);


// Check detector grouping table
TableWorkspace_sptr groupingTable;
TS_ASSERT_THROWS_NOTHING( groupingTable =
AnalysisDataService::Instance().retrieveWS<TableWorkspace>( groupingWSName ) );
TS_ASSERT( groupingTable );
// Check number of rows and columns
TS_ASSERT_EQUALS( groupingTable->columnCount(), 1);
TS_ASSERT_EQUALS( groupingTable->rowCount(), 2);
// Check grouping
std::vector<int> testVec;
for (int i=5; i<11; i++)
testVec.push_back(i);
TS_ASSERT_EQUALS( groupingTable->cell<std::vector<int>>(0,0), testVec );
testVec.clear();
testVec.push_back(29);
testVec.push_back(31);
TS_ASSERT_EQUALS( groupingTable->cell<std::vector<int>>(1,0), testVec );
AnalysisDataService::Instance().remove(groupingWSName);
}

void test_loadingDeadTimes_singlePeriod()
Expand Down

0 comments on commit 79eaaeb

Please sign in to comment.