Skip to content

Commit

Permalink
Re #9030. Added a unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Feb 20, 2014
1 parent 390e802 commit 18b7c64
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions Code/Mantid/Framework/CurveFitting/test/FitMWTest.h
Expand Up @@ -11,13 +11,15 @@
#include "MantidCurveFitting/SeqDomain.h"
#include "MantidCurveFitting/Convolution.h"
#include "MantidCurveFitting/Gaussian.h"
#include "MantidCurveFitting/Polynomial.h"

#include "MantidAPI/CompositeFunction.h"
#include "MantidAPI/FrameworkManager.h"
#include "MantidAPI/AlgorithmManager.h"
#include "MantidAPI/ITableWorkspace.h"
#include "MantidAPI/FunctionDomain1D.h"
#include "MantidAPI/WorkspaceProperty.h"
#include "MantidAPI/AnalysisDataService.h"

#include "MantidKernel/PropertyManager.h"
#include "MantidGeometry/Instrument.h"
Expand Down Expand Up @@ -191,6 +193,40 @@ class FitMWTest : public CxxTest::TestSuite

}

// test that errors of the calculated output are reasonable
void test_output_errors()
{
const bool histogram(true);
auto ws2 = createTestWorkspace(histogram);

API::IFunction_sptr fun(new Polynomial);
fun->setAttributeValue("n",5);

Fit fit;
fit.initialize();

fit.setProperty("Function",fun);
fit.setProperty("InputWorkspace",ws2);
fit.setProperty("WorkspaceIndex",0);
fit.setProperty("Output","out");

fit.execute();

TS_ASSERT(fit.isExecuted());

Mantid::API::MatrixWorkspace_sptr out_ws = Mantid::API::AnalysisDataService::Instance().retrieveWS<Mantid::API::MatrixWorkspace>("out_Workspace");
TS_ASSERT(out_ws);
TS_ASSERT_EQUALS(out_ws->getNumberHistograms(), 3);
auto &e = out_ws->readE(1);
for(size_t i = 0; i < e.size(); ++i)
{
TS_ASSERT( e[i] < 1.0 );
}

Mantid::API::AnalysisDataService::Instance().clear();

}

void test_create_SeqDomain()
{
MatrixWorkspace_sptr ws2(new WorkspaceTester);
Expand Down

0 comments on commit 18b7c64

Please sign in to comment.