From 43ec346bfb879310ef7e3e4cc1c66752725c5085 Mon Sep 17 00:00:00 2001 From: Anders Markvardsen <anders.markvardsen@stfc.ac.uk> Date: Fri, 18 Mar 2011 09:28:05 +0000 Subject: [PATCH] Fix: bug in MuonRemoveExpDecay plus added additional test. re #2671 --- .../Algorithms/src/MuonRemoveExpDecay.cpp | 3 +-- .../Algorithms/test/MuonRemoveExpDecayTest.h | 27 ++++++++++++++----- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/Code/Mantid/Framework/Algorithms/src/MuonRemoveExpDecay.cpp b/Code/Mantid/Framework/Algorithms/src/MuonRemoveExpDecay.cpp index b2a99bda773..f685ad9f315 100644 --- a/Code/Mantid/Framework/Algorithms/src/MuonRemoveExpDecay.cpp +++ b/Code/Mantid/Framework/Algorithms/src/MuonRemoveExpDecay.cpp @@ -38,8 +38,7 @@ void MuonRemoveExpDecay::init() declareProperty(new API::WorkspaceProperty<API::MatrixWorkspace>("OutputWorkspace", "", Direction::Output), "The name of the workspace to be created as the output of the algorithm"); std::vector<int> empty; - declareProperty(new Kernel::ArrayProperty<int>("Spectra", empty, new MandatoryValidator<std::vector< - int> > ), "Spectra to remove the exponential decay from"); + declareProperty(new Kernel::ArrayProperty<int>("Spectra", empty), "Spectra to remove the exponential decay from"); } /** Executes the algorithm diff --git a/Code/Mantid/Framework/Algorithms/test/MuonRemoveExpDecayTest.h b/Code/Mantid/Framework/Algorithms/test/MuonRemoveExpDecayTest.h index ea1efd54edc..34250a847a5 100644 --- a/Code/Mantid/Framework/Algorithms/test/MuonRemoveExpDecayTest.h +++ b/Code/Mantid/Framework/Algorithms/test/MuonRemoveExpDecayTest.h @@ -37,7 +37,6 @@ public: void testLoadNexusAndSetProperties() { //This test does not run on Windows64 as is does not support HDF4 files -#ifndef _WIN64 loader.initialize(); loader.setPropertyValue("Filename", "emu00006473.nxs"); @@ -48,21 +47,17 @@ public: alg.setPropertyValue("InputWorkspace", "EMU6473"); alg.setPropertyValue("OutputWorkspace", "Result"); alg.setPropertyValue("Spectra", "0"); -#endif /*_WIN64*/ } void testProperties() { //This test does not run on Windows64 as is does not support HDF4 files -#ifndef _WIN64 TS_ASSERT_EQUALS( alg.getPropertyValue("Spectra"), "0"); -#endif /*_WIN64*/ } void testExecute() { //This test does not run on Windows64 as is does not support HDF4 files -#ifndef _WIN64 try { TS_ASSERT_EQUALS(alg.execute(),true); @@ -73,9 +68,29 @@ public: } Workspace_const_sptr outputWS = AnalysisDataService::Instance().retrieve("Result"); -#endif /*_WIN64*/ } + void testWhereOptional3rdArgNotSet() + { + //This test does not run on Windows64 as is does not support HDF4 files + + MuonRemoveExpDecay alg2; + alg2.initialize(); + + alg2.setPropertyValue("InputWorkspace", "EMU6473"); + alg2.setPropertyValue("OutputWorkspace", "MuonRemoveExpDecayResult"); + + try + { + TS_ASSERT_EQUALS(alg2.execute(),true); + } + catch(std::runtime_error e) + { + TS_FAIL(e.what()); + } + } + + private: MuonRemoveExpDecay alg; Mantid::NeXus::LoadMuonNexus loader; -- GitLab