Skip to content

Commit

Permalink
Refs #8394 Added test and validator creation.
Browse files Browse the repository at this point in the history
Added commented out BoundedValidator creation to NumSteps property of PeakIntensityVsRadius.
  • Loading branch information
gemmaguest committed Jul 17, 2017
1 parent 3750b70 commit f556671
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions Framework/Crystal/src/PeakIntensityVsRadius.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include "MantidAPI/TextAxis.h"
#include "MantidAPI/WorkspaceFactory.h"

#include "MantidKernel/ListValidator.h"
#include "MantidKernel/BoundedValidator.h"

#include "MantidKernel/Strings.h"

using namespace Mantid::Kernel;
Expand Down Expand Up @@ -49,8 +50,10 @@ void PeakIntensityVsRadius::init() {

declareProperty("RadiusStart", 0.0, "Radius at which to start integrating.");
declareProperty("RadiusEnd", 1.0, "Radius at which to stop integrating.");
// auto mustBePositive = boost::make_shared<BoundedValidator<int>>();
// mustBePositive->setLower(0);
declareProperty(
"NumSteps", 10,
"NumSteps", 10, // mustBePositive,
"Number of steps, between start and end, to calculate radius.");

declareProperty(
Expand Down
7 changes: 5 additions & 2 deletions Framework/Crystal/test/PeakIntensityVsRadiusTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class PeakIntensityVsRadiusTest : public CxxTest::TestSuite {
/** Check the validateInputs() calls */
void doTestValid(bool pass, double BackgroundInnerFactor,
double BackgroundOuterFactor, double BackgroundInnerRadius,
double BackgroundOuterRadius) {
double BackgroundOuterRadius, int NumSteps = 16) {
PeakIntensityVsRadius alg;
TS_ASSERT_THROWS_NOTHING(alg.initialize())
TS_ASSERT(alg.isInitialized())
Expand All @@ -82,7 +82,7 @@ class PeakIntensityVsRadiusTest : public CxxTest::TestSuite {
"OutputWorkspace", "PeakIntensityVsRadiusTest_OutputWS"));
TS_ASSERT_THROWS_NOTHING(alg.setProperty("RadiusStart", 0.0));
TS_ASSERT_THROWS_NOTHING(alg.setProperty("RadiusEnd", 1.5));
TS_ASSERT_THROWS_NOTHING(alg.setProperty("NumSteps", 16));
TS_ASSERT_THROWS_NOTHING(alg.setProperty("NumSteps", NumSteps));
TS_ASSERT_THROWS_NOTHING(
alg.setProperty("BackgroundInnerFactor", BackgroundInnerFactor));
TS_ASSERT_THROWS_NOTHING(
Expand All @@ -108,6 +108,7 @@ class PeakIntensityVsRadiusTest : public CxxTest::TestSuite {
doTestValid(false, 0, 1.0, 0, 0.15);
doTestValid(false, 1.0, 0, 0.15, 0);
doTestValid(false, 1.0, 1.0, 0.12, 0.15);
doTestValid(true, 1.0, 2.0, 0, 0, -8);
}

MatrixWorkspace_sptr doTest(double BackgroundInnerFactor,
Expand Down Expand Up @@ -192,6 +193,8 @@ class PeakIntensityVsRadiusTest : public CxxTest::TestSuite {
TSM_ASSERT_DELTA("After 1.0, the signal is flat", ws->y(0)[12], 1000, 1e-6);
TSM_ASSERT_DELTA("After 1.0, the signal is flat", ws->y(0)[15], 1000, 1e-6);
}

void test
};

#endif /* MANTID_CRYSTAL_PEAKINTENSITYVSRADIUSTEST_H_ */

0 comments on commit f556671

Please sign in to comment.