MockObjects.h 6.05 KB
Newer Older
1
2
3
4
5
6
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
//     NScD Oak Ridge National Laboratory, European Spallation Source
//     & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
7
8
9
10
11
12
13
/*
 * MockObjects.h
 *
 *  Created on: Apr 8, 2014
 *      Author: spu92482
 */

Owen Arnold's avatar
Owen Arnold committed
14
15
#ifndef MANTIDGEOMETRYTEST_MOCKOBJECTS_H_
#define MANTIDGEOMETRYTEST_MOCKOBJECTS_H_
16

17
#include "MantidGeometry/Crystal/IPeak.h"
Owen Arnold's avatar
Owen Arnold committed
18
19
#include "MantidGeometry/Crystal/PeakTransform.h"
#include "MantidGeometry/Crystal/PeakTransformFactory.h"
20
#include "MantidGeometry/Objects/InstrumentRayTracer.h"
Owen Arnold's avatar
Owen Arnold committed
21
#include "MantidKernel/SpecialCoordinateSystem.h"
22
#include "MantidKernel/WarningSuppressions.h"
23
24
25
#include <boost/regex.hpp>
#include <gmock/gmock.h>

Owen Arnold's avatar
Owen Arnold committed
26
using namespace Mantid::Geometry;
27
28
29
using namespace Mantid;
using boost::regex;

30
namespace {
31

Samuel Jackson's avatar
Samuel Jackson committed
32
GNU_DIAG_OFF_SUGGEST_OVERRIDE
33

34
35
36
37
38
39
40
41
/*------------------------------------------------------------
 Mock Peak Transform
 ------------------------------------------------------------*/
class MockPeakTransform : public PeakTransform {
public:
  MockPeakTransform()
      : PeakTransform("H (Lattice)", "K (Lattice)", regex("^H.*$"),
                      regex("^K.*$"), regex("^L.*$")) {}
42
  ~MockPeakTransform() override {}
43
44
45
46
47
48
49
50
51
  MOCK_CONST_METHOD0(clone, PeakTransform_sptr());
  MOCK_CONST_METHOD1(transform,
                     Mantid::Kernel::V3D(const Mantid::Kernel::V3D &));
  MOCK_CONST_METHOD1(transformPeak,
                     Mantid::Kernel::V3D(const Mantid::Geometry::IPeak &));
  MOCK_CONST_METHOD0(getFriendlyName, std::string());
  MOCK_CONST_METHOD0(getCoordinateSystem,
                     Mantid::Kernel::SpecialCoordinateSystem());
};
52

53
54
55
56
57
58
59
60
61
/*------------------------------------------------------------
 Mock Peak Transform Factory
 ------------------------------------------------------------*/
class MockPeakTransformFactory : public PeakTransformFactory {
public:
  MOCK_CONST_METHOD0(createDefaultTransform, PeakTransform_sptr());
  MOCK_CONST_METHOD2(createTransform, PeakTransform_sptr(const std::string &,
                                                         const std::string &));
};
62

63
64
65
66
67
/*------------------------------------------------------------
Mock IPeak
------------------------------------------------------------*/
class MockIPeak : public Mantid::Geometry::IPeak {
public:
68
69
  MOCK_METHOD1(setInstrument,
               void(const Geometry::Instrument_const_sptr &inst));
70
71
72
73
74
  MOCK_CONST_METHOD0(getDetectorID, int());
  MOCK_METHOD1(setDetectorID, void(int m_DetectorID));
  MOCK_CONST_METHOD0(getDetector, Geometry::IDetector_const_sptr());
  MOCK_CONST_METHOD0(getInstrument, Geometry::Instrument_const_sptr());
  MOCK_CONST_METHOD0(getRunNumber, int());
75
  MOCK_CONST_METHOD0(getPeakNumber, int());
76
  MOCK_CONST_METHOD0(getIntMNP, Mantid::Kernel::V3D());
77
  MOCK_METHOD1(setRunNumber, void(int m_RunNumber));
78
  MOCK_METHOD1(setPeakNumber, void(int m_PeakNumber));
Martyn Gigg's avatar
Martyn Gigg committed
79
  MOCK_METHOD1(setIntMNP, void(const Mantid::Kernel::V3D &m_modStru));
80
81
82
83
84
85
  MOCK_CONST_METHOD0(getMonitorCount, double());
  MOCK_METHOD1(setMonitorCount, void(double m_MonitorCount));
  MOCK_CONST_METHOD0(getH, double());
  MOCK_CONST_METHOD0(getK, double());
  MOCK_CONST_METHOD0(getL, double());
  MOCK_CONST_METHOD0(getHKL, Mantid::Kernel::V3D());
86
  MOCK_CONST_METHOD0(isIndexed, bool());
Lynch, Vickie's avatar
Lynch, Vickie committed
87
  MOCK_CONST_METHOD0(getIntHKL, Mantid::Kernel::V3D());
Sullivan, Brendan T's avatar
Sullivan, Brendan T committed
88
  MOCK_CONST_METHOD0(getSamplePos, Mantid::Kernel::V3D());
89
90
91
92
  MOCK_METHOD1(setH, void(double m_H));
  MOCK_METHOD1(setK, void(double m_K));
  MOCK_METHOD1(setL, void(double m_L));
  MOCK_METHOD3(setHKL, void(double H, double K, double L));
Hahn, Steven's avatar
Hahn, Steven committed
93
  MOCK_METHOD1(setHKL, void(const Mantid::Kernel::V3D &HKL));
94
  MOCK_METHOD1(setIntHKL, void(const Mantid::Kernel::V3D &HKL));
Sullivan, Brendan T's avatar
Sullivan, Brendan T committed
95
96
  MOCK_METHOD3(setSamplePos, void(double samX, double samY, double samZ));
  MOCK_METHOD1(setSamplePos, void(const Mantid::Kernel::V3D &XYZ));
97
98
99
  MOCK_CONST_METHOD0(getQLabFrame, Mantid::Kernel::V3D());
  MOCK_CONST_METHOD0(getQSampleFrame, Mantid::Kernel::V3D());
  MOCK_METHOD0(findDetector, bool());
100
101
  MOCK_METHOD1(findDetector,
               bool(const Mantid::Geometry::InstrumentRayTracer &tracer));
Hahn, Steven's avatar
Hahn, Steven committed
102
  MOCK_METHOD2(setQSampleFrame, void(const Mantid::Kernel::V3D &QSampleFrame,
103
                                     boost::optional<double> detectorDistance));
Hahn, Steven's avatar
Hahn, Steven committed
104
  MOCK_METHOD2(setQLabFrame, void(const Mantid::Kernel::V3D &QLabFrame,
105
106
107
108
                                  boost::optional<double> detectorDistance));
  MOCK_METHOD1(setWavelength, void(double wavelength));
  MOCK_CONST_METHOD0(getWavelength, double());
  MOCK_CONST_METHOD0(getScattering, double());
Lynch, Vickie's avatar
Lynch, Vickie committed
109
  MOCK_CONST_METHOD0(getAzimuthal, double());
110
111
112
113
  MOCK_CONST_METHOD0(getDSpacing, double());
  MOCK_CONST_METHOD0(getTOF, double());
  MOCK_CONST_METHOD0(getInitialEnergy, double());
  MOCK_CONST_METHOD0(getFinalEnergy, double());
Samuel Jackson's avatar
Samuel Jackson committed
114
  MOCK_CONST_METHOD0(getEnergyTransfer, double());
115
116
117
118
  MOCK_METHOD1(setInitialEnergy, void(double m_InitialEnergy));
  MOCK_METHOD1(setFinalEnergy, void(double m_FinalEnergy));
  MOCK_CONST_METHOD0(getIntensity, double());
  MOCK_CONST_METHOD0(getSigmaIntensity, double());
119
  MOCK_CONST_METHOD0(getIntensityOverSigma, double());
120
121
122
123
124
125
  MOCK_METHOD1(setIntensity, void(double m_Intensity));
  MOCK_METHOD1(setSigmaIntensity, void(double m_SigmaIntensity));
  MOCK_CONST_METHOD0(getBinCount, double());
  MOCK_METHOD1(setBinCount, void(double m_BinCount));
  MOCK_CONST_METHOD0(getGoniometerMatrix, Mantid::Kernel::Matrix<double>());
  MOCK_METHOD1(setGoniometerMatrix,
Hahn, Steven's avatar
Hahn, Steven committed
126
               void(const Mantid::Kernel::Matrix<double> &m_GoniometerMatrix));
127
128
129
130
131
132
133
134
135
136
  MOCK_CONST_METHOD0(getBankName, std::string());
  MOCK_CONST_METHOD0(getRow, int());
  MOCK_CONST_METHOD0(getCol, int());
  MOCK_CONST_METHOD0(getDetPos, Mantid::Kernel::V3D());
  MOCK_CONST_METHOD0(getL1, double());
  MOCK_CONST_METHOD0(getL2, double());
  MOCK_CONST_METHOD0(getDetectorPosition, Mantid::Kernel::V3D());
  MOCK_CONST_METHOD0(getDetectorPositionNoCheck, Mantid::Kernel::V3D());
  MOCK_CONST_METHOD0(getPeakShape, const Mantid::Geometry::PeakShape &());
};
LamarMoore's avatar
LamarMoore committed
137
} // namespace
Samuel Jackson's avatar
Samuel Jackson committed
138
GNU_DIAG_ON_SUGGEST_OVERRIDE
Owen Arnold's avatar
Owen Arnold committed
139
#endif /* MANTIDGEOMETRYTEST_MOCKOBJECTS_H_ */