From 3312b4d915f2a473f6656a17d0f6c700d093f531 Mon Sep 17 00:00:00 2001 From: Matt King <matthew.king@stfc.ac.uk> Date: Thu, 8 Oct 2015 16:30:30 +0100 Subject: [PATCH] fixed comparison between min and max when min larger Refs #13508 --- Framework/MDAlgorithms/src/CompactMD.cpp | 2 +- Framework/MDAlgorithms/test/CompactMDTest.h | 32 +++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Framework/MDAlgorithms/src/CompactMD.cpp b/Framework/MDAlgorithms/src/CompactMD.cpp index a999f14dc89..e4ce3f86d3d 100644 --- a/Framework/MDAlgorithms/src/CompactMD.cpp +++ b/Framework/MDAlgorithms/src/CompactMD.cpp @@ -17,7 +17,7 @@ createPBinStringVector(std::vector<Mantid::coord_t> minVector, std::vector<std::string> pBinStrVector; for (size_t iter = 0; iter < numDims; iter++) { // creating pbin string using Min and Max Centre positions - if (minVector[iter] > maxVector[iter]) { + if (minVector[iter] >= maxVector[iter]) { throw std::invalid_argument( "Minimum extents MUST be less than Maximum extents"); } diff --git a/Framework/MDAlgorithms/test/CompactMDTest.h b/Framework/MDAlgorithms/test/CompactMDTest.h index 57f5d98cc60..fffb284b7a1 100644 --- a/Framework/MDAlgorithms/test/CompactMDTest.h +++ b/Framework/MDAlgorithms/test/CompactMDTest.h @@ -240,4 +240,36 @@ public: // Performance Tests //=================== // TODO: +using namespace Mantid::DataObjects; +class CompactMDTestPerformance : public CxxTest::TestSuite { + +private: + MDHistoWorkspace_sptr m_ws; + +public: + // This pair of boilerplate methods prevent the suite being created statically + // This means the constructor isn't called when running other tests + static CompactMDTestPerformance *createSuite() { + return new CompactMDTestPerformance(); + } + static void destroySuite(CompactMDTestPerformance *suite) { delete suite; } + + CompactMDTestPerformance() { + // Create a 4D workspace. + m_ws = MDEventsTestHelper::makeFakeMDHistoWorkspace( + 1.0 /*signal*/, 4 /*nd*/, 100 /*nbins*/, 10 /*max*/, 1.0 /*error sq*/); + } + void test_execute_4d() { + CompactMD alg; + alg.setChild(true); + alg.setRethrows(true); + alg.initialize(); + alg.setProperty("InputWorkspace", m_ws); + alg.setProperty("OutputWorkspace", "out"); + alg.execute(); + IMDHistoWorkspace_sptr outWS = alg.getProperty("OutputWorkspace"); + TS_ASSERT(outWS); + } +}; + #endif // !MANTID_MDALGORITHMS_COMPACTMDTEST_H_ -- GitLab