MockObjects.h 5.94 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
 */

14
#pragma once
15

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

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

29
namespace {
30

Samuel Jackson's avatar
Samuel Jackson committed
31
GNU_DIAG_OFF_SUGGEST_OVERRIDE
32

33
34
35
36
37
38
39
40
/*------------------------------------------------------------
 Mock Peak Transform
 ------------------------------------------------------------*/
class MockPeakTransform : public PeakTransform {
public:
  MockPeakTransform()
      : PeakTransform("H (Lattice)", "K (Lattice)", regex("^H.*$"),
                      regex("^K.*$"), regex("^L.*$")) {}
41
  ~MockPeakTransform() override {}
42
43
44
45
46
47
48
49
50
  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());
};
51

52
53
54
55
56
57
58
59
60
/*------------------------------------------------------------
 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 &));
};
61

62
63
64
65
66
/*------------------------------------------------------------
Mock IPeak
------------------------------------------------------------*/
class MockIPeak : public Mantid::Geometry::IPeak {
public:
67
68
  MOCK_METHOD1(setInstrument,
               void(const Geometry::Instrument_const_sptr &inst));
69
70
71
72
73
  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());
74
  MOCK_CONST_METHOD0(getPeakNumber, int());
75
  MOCK_CONST_METHOD0(getIntMNP, Mantid::Kernel::V3D());
76
  MOCK_METHOD1(setRunNumber, void(int m_RunNumber));
77
  MOCK_METHOD1(setPeakNumber, void(int m_PeakNumber));
Martyn Gigg's avatar
Martyn Gigg committed
78
  MOCK_METHOD1(setIntMNP, void(const Mantid::Kernel::V3D &m_modStru));
79
80
81
82
83
84
  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());
85
  MOCK_CONST_METHOD0(isIndexed, bool());
Lynch, Vickie's avatar
Lynch, Vickie committed
86
  MOCK_CONST_METHOD0(getIntHKL, Mantid::Kernel::V3D());
Sullivan, Brendan T's avatar
Sullivan, Brendan T committed
87
  MOCK_CONST_METHOD0(getSamplePos, Mantid::Kernel::V3D());
88
89
90
91
  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
92
  MOCK_METHOD1(setHKL, void(const Mantid::Kernel::V3D &HKL));
93
  MOCK_METHOD1(setIntHKL, void(const Mantid::Kernel::V3D &HKL));
Sullivan, Brendan T's avatar
Sullivan, Brendan T committed
94
95
  MOCK_METHOD3(setSamplePos, void(double samX, double samY, double samZ));
  MOCK_METHOD1(setSamplePos, void(const Mantid::Kernel::V3D &XYZ));
96
97
98
  MOCK_CONST_METHOD0(getQLabFrame, Mantid::Kernel::V3D());
  MOCK_CONST_METHOD0(getQSampleFrame, Mantid::Kernel::V3D());
  MOCK_METHOD0(findDetector, bool());
99
100
  MOCK_METHOD1(findDetector,
               bool(const Mantid::Geometry::InstrumentRayTracer &tracer));
Hahn, Steven's avatar
Hahn, Steven committed
101
  MOCK_METHOD2(setQSampleFrame, void(const Mantid::Kernel::V3D &QSampleFrame,
102
                                     boost::optional<double> detectorDistance));
Hahn, Steven's avatar
Hahn, Steven committed
103
  MOCK_METHOD2(setQLabFrame, void(const Mantid::Kernel::V3D &QLabFrame,
104
105
106
107
                                  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
108
  MOCK_CONST_METHOD0(getAzimuthal, double());
109
110
111
112
  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
113
  MOCK_CONST_METHOD0(getEnergyTransfer, double());
114
115
116
117
  MOCK_METHOD1(setInitialEnergy, void(double m_InitialEnergy));
  MOCK_METHOD1(setFinalEnergy, void(double m_FinalEnergy));
  MOCK_CONST_METHOD0(getIntensity, double());
  MOCK_CONST_METHOD0(getSigmaIntensity, double());
118
  MOCK_CONST_METHOD0(getIntensityOverSigma, double());
119
120
121
122
123
124
  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
125
               void(const Mantid::Kernel::Matrix<double> &m_GoniometerMatrix));
126
127
128
129
130
131
132
133
134
135
  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
136
} // namespace
137
GNU_DIAG_ON_SUGGEST_OVERRIDE