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
#ifndef MANTID_MDALGORITHMS_TOBYFITRESOLUTIONMODELTEST_H_
#define MANTID_MDALGORITHMS_TOBYFITRESOLUTIONMODELTEST_H_
#include "MantidMDAlgorithms/Quantification/Resolution/TobyFitResolutionModel.h"
#include "MantidMDAlgorithms/Quantification/ForegroundModel.h"
#include "MantidMDAlgorithms/Quantification/ResolutionConvolvedCrossSection.h"
#include "MDFittingTestHelpers.h"
#include <cxxtest/TestSuite.h>
class TobyFitResolutionModelTest : 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 TobyFitResolutionModelTest *createSuite() { return new TobyFitResolutionModelTest(); }
static void destroySuite( TobyFitResolutionModelTest *suite ) { delete suite; }
TobyFitResolutionModelTest()
{
using namespace Mantid::MDAlgorithms;
ForegroundModelFactory::Instance().subscribe<FakeForegroundModel>("FakeForegroundModel");
}
~TobyFitResolutionModelTest()
{
using namespace Mantid::MDAlgorithms;
ForegroundModelFactory::Instance().unsubscribe("FakeForegroundModel");
}
void test_Construction_With_Unknown_Model_Throws_Invalid_Argument()
{
using namespace Mantid::MDAlgorithms;
ResolutionConvolvedCrossSection * conv = new ResolutionConvolvedCrossSection;
TS_ASSERT_THROWS(TobyFitResolutionModel(*conv, "_NotAKnownModel"), std::invalid_argument);
delete conv;
}
void test_Construction_With_Valid_Arguments_Creates_Object()
{
using namespace Mantid::MDAlgorithms;
ResolutionConvolvedCrossSection * conv = new ResolutionConvolvedCrossSection;
TS_ASSERT_THROWS_NOTHING(TobyFitResolutionModel(*conv, "FakeForegroundModel"));
delete conv;
}
void test_uninitialized_object_has_no_attributes()
{
using namespace Mantid::MDAlgorithms;
TobyFitResolutionModel mdconvolution;
TS_ASSERT_EQUALS(mdconvolution.nAttributes(), 0);
}
void test_initialized_object_has_expected_number_of_attributes()
{
using namespace Mantid::MDAlgorithms;
TobyFitResolutionModel mdconvolution;
mdconvolution.initialize();
TS_ASSERT_EQUALS(mdconvolution.nAttributes(), 14);
}
void test_crossSection_Returns_Expected_Value_For_Specific_Parameters()
{
using namespace Mantid::MDAlgorithms;
ResolutionConvolvedCrossSection * conv = new ResolutionConvolvedCrossSection;
TobyFitResolutionModel mcResConvoution(*conv, "FakeForegroundModel");
delete conv;
}
};
#endif /* MANTID_MDALGORITHMS_TOBYFITRESOLUTIONMODELTEST_H_ */