Skip to content

Commit

Permalink
Re #6198. Fix usages of mapping methods in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
RussellTaylor committed Sep 18, 2013
1 parent f09ccaf commit b6cad41
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
22 changes: 10 additions & 12 deletions Code/Mantid/Framework/Algorithms/test/GeneratePeaksTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,12 @@ class GeneratePeaksTest : public CxxTest::TestSuite
TS_ASSERT_DELTA(p1_y[400], 20.0, 1.0E-4);

// 7. Spectrum map
spec2index_map *themap = peaksws->getSpectrumToWorkspaceIndexMap();
size_t index0 = (*themap)[0];
size_t index2 = (*themap)[2];
spec2index_map themap = peaksws->getSpectrumToWorkspaceIndexMap();
size_t index0 = themap[0];
size_t index2 = themap[2];
TS_ASSERT_EQUALS(index0, 0);
TS_ASSERT_EQUALS(index2, 1)

// 8. Clean
delete themap;
AnalysisDataService::Instance().remove("Test01WS");

return;
Expand Down Expand Up @@ -170,10 +168,10 @@ class GeneratePeaksTest : public CxxTest::TestSuite
TS_ASSERT_DELTA(p1_y[150], 20.0, 1.0E-4);

// 7. Spectrum map
spec2index_map *themap = peaksws->getSpectrumToWorkspaceIndexMap();
TS_ASSERT_EQUALS(themap->size(), 5);
size_t index0 = (*themap)[0];
size_t index2 = (*themap)[2];
spec2index_map themap = peaksws->getSpectrumToWorkspaceIndexMap();
TS_ASSERT_EQUALS(themap.size(), 5);
size_t index0 = themap[0];
size_t index2 = themap[2];
TS_ASSERT_EQUALS(index0, 0);
TS_ASSERT_EQUALS(index2, 1)

Expand Down Expand Up @@ -228,9 +226,9 @@ class GeneratePeaksTest : public CxxTest::TestSuite
TS_ASSERT_DELTA(p1_y[400], 24.0, 1.0E-4);

// 7. Spectrum map
spec2index_map *themap = peaksws->getSpectrumToWorkspaceIndexMap();
size_t index0 = (*themap)[0];
size_t index2 = (*themap)[2];
spec2index_map themap = peaksws->getSpectrumToWorkspaceIndexMap();
size_t index0 = themap[0];
size_t index2 = themap[2];
TS_ASSERT_EQUALS(index0, 0);
TS_ASSERT_EQUALS(index2, 1)

Expand Down
5 changes: 2 additions & 3 deletions Code/Mantid/Framework/Algorithms/test/GhostCorrectionTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,8 @@ class GhostCorrectionTest : public CxxTest::TestSuite
//Checks on the workspace
EventWorkspace_const_sptr inputW = AnalysisDataService::Instance().retrieveWS<const EventWorkspace>(wsName);
TS_ASSERT_EQUALS( inputW->getNumberHistograms(), NUMPIXELS);
detid2index_map * m;
m = inputW->getDetectorIDToWorkspaceIndexMap(true);
TS_ASSERT_EQUALS( m->size(), NUMPIXELS);
detid2index_map m = inputW->getDetectorIDToWorkspaceIndexMap(true);
TS_ASSERT_EQUALS( m.size(), NUMPIXELS);
//2 events per bin
TS_ASSERT_EQUALS( inputW->dataY(0)[0], 2);
//Make the units in X to be TOF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ class IntegratePeakTimeSlicesTest: public CxxTest::TestSuite

double TotIntensity = 0;

detid2index_map * map = wsPtr->getDetectorIDToWorkspaceIndexMap(true);
const detid2index_map map = wsPtr->getDetectorIDToWorkspaceIndexMap(true);

for (int row = 0; row < NRC; row++)
for (int col = 0; col < NRC; col++)
{

boost::shared_ptr<Detector> detP = bankR->getAtXY(col, row);

detid2index_map::iterator it = map->find(detP->getID());
detid2index_map::const_iterator it = map.find(detP->getID());
size_t wsIndex = (*it).second;

double MaxR = max<double> (0.0, MaxPeakIntensity * (1 - abs(row - PeakRow) / MaxPeakRCSpan));
Expand Down Expand Up @@ -165,7 +165,6 @@ class IntegratePeakTimeSlicesTest: public CxxTest::TestSuite
wsPtr->setData(wsIndex, dataY, dataE);

}
delete map;

PeaksWorkspace_sptr pks(new PeaksWorkspace());

Expand Down

0 comments on commit b6cad41

Please sign in to comment.