Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef MANTID_MDALGORITHMS_FITRESOLUTIONCONVOLVEDMODELTEST_H_
#define MANTID_MDALGORITHMS_FITRESOLUTIONCONVOLVEDMODELTEST_H_
#include <cxxtest/TestSuite.h>
#include "MantidMDAlgorithms/Quantification/FitResolutionConvolvedModel.h"
#include "MantidTestHelpers/WorkspaceCreationHelper.h"
using Mantid::MDAlgorithms::FitResolutionConvolvedModel;
class FitResolutionConvolvedModelTest : public CxxTest::TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static FitResolutionConvolvedModelTest *createSuite() { return new FitResolutionConvolvedModelTest(); }
static void destroySuite( FitResolutionConvolvedModelTest *suite ) { delete suite; }
FitResolutionConvolvedModelTest() :
m_inputName("FitResolutionConvolvedModelTest")
{
}
void test_Init_Does_Not_Throw()
{
Mantid::API::IAlgorithm_sptr alg;
TS_ASSERT_THROWS_NOTHING(alg = createAlgorithm());
TS_ASSERT(alg->isInitialized());
}
void test_Algorithm_Does_Not_Allow_Standard_MatrixWorkspaces()
{
using namespace Mantid::API;
IAlgorithm_sptr alg = createAlgorithm();
MatrixWorkspace_sptr testMatrixWS = WorkspaceCreationHelper::Create2DWorkspace(1,10);
Mantid::API::AnalysisDataService::Instance().addOrReplace(m_inputName, testMatrixWS);
TS_ASSERT_THROWS(alg->setPropertyValue("InputWorkspace", m_inputName), std::invalid_argument);
Mantid::API::AnalysisDataService::Instance().remove(m_inputName);
}
private:
Mantid::API::IAlgorithm_sptr createAlgorithm()
{
auto alg = boost::make_shared<FitResolutionConvolvedModel>();
alg->initialize();
return alg;
}
std::string m_inputName;
};
#endif /* MANTID_MDALGORITHMS_FITRESOLUTIONCONVOLVEDMODELTEST_H_ */