Skip to content

Commit

Permalink
Refs #4606 separate mock objects that require gmock
Browse files Browse the repository at this point in the history
which I don't have on LENS
  • Loading branch information
Janik Zikovsky committed Jan 22, 2012
1 parent da81456 commit 4ac9da2
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/API/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ set ( TEST_FILES
test/ImplicitFunctionParserFactoryTest.h
test/InstrumentDataServiceTest.h
test/MDGeometryTest.h
test/MatrixWorkspaceTest.h
test/MemoryManagerTest.h
test/MultipleExperimentInfosTest.h
test/MultipleFilePropertyTest.h
Expand All @@ -255,6 +254,7 @@ set ( TEST_FILES
set ( GMOCK_TEST_FILES
test/ImplicitFunctionFactoryTest.h
test/ImplicitFunctionParameterParserFactoryTest.h
test/MatrixWorkspaceTest.h
)


Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/Framework/API/test/MatrixWorkspaceTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define WORKSPACETEST_H_

#include "MantidTestHelpers/FakeObjects.h"
#include "MantidTestHelpers/FakeGmockObjects.h"
#include "MantidAPI/ISpectrum.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidAPI/NumericAxis.h"
Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/Framework/Geometry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ if (NOT NO_OPENCASCADE)
find_package ( OpenCascade REQUIRED )
include_directories ( ${OPENCASCADE_INCLUDE_DIR} )
set (SRC_FILES ${SRC_FILES} ${OPENCASCADE_SRC} )
else ()
add_definitions ( -DNO_OPENCASCADE )
endif ()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#ifndef FAKEGMOCKOBJECTS_H_
#define FAKEGMOCKOBJECTS_H_

/*
* FakeObjects.h: Fake Tester objects for APITest
*
* Created on: Jul 5, 2011
* Author: Janik Zikovsky
*/

#include "MantidAPI/ISpectrum.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidKernel/cow_ptr.h"
#include "MantidAPI/NumericAxis.h"
#include "MantidGeometry/Instrument.h"
#include "MantidGeometry/ISpectraDetectorMap.h"
#include "MantidGeometry/Instrument/DetectorGroup.h"
#include "MantidGeometry/Instrument/INearestNeighbours.h"
#include "gmock/gmock.h"
#include <iostream>
#include <fstream>
#include <map>

using namespace Mantid::API;
using namespace Mantid::Kernel;
using namespace Mantid;


//Helper and typedef for mocking NearestNeighbourFactory usage
class MockNearestNeighboursFactory : public Mantid::Geometry::INearestNeighboursFactory
{
public:
MOCK_METHOD3(create, Mantid::Geometry::INearestNeighbours*(boost::shared_ptr<const Mantid::Geometry::Instrument>,const Mantid::Geometry::ISpectraDetectorMap&, bool));
virtual ~MockNearestNeighboursFactory()
{
}
};

//Helper typedef and type for mocking NearestNeighbour map usage.
typedef std::map<Mantid::specid_t, Mantid::Kernel::V3D> SpectrumDistanceMap;
class MockNearestNeighbours : public Mantid::Geometry::INearestNeighbours {
public:
MOCK_CONST_METHOD2(neighbours, SpectrumDistanceMap(const specid_t spectrum, const double radius));
MOCK_CONST_METHOD3(neighbours, SpectrumDistanceMap(const specid_t spectrum, bool force, const int numberofneighbours));
MOCK_METHOD0(die, void());
virtual ~MockNearestNeighbours()
{
die();
}
};




#endif /* FAKEOBJECTS_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "MantidGeometry/ISpectraDetectorMap.h"
#include "MantidGeometry/Instrument/DetectorGroup.h"
#include "MantidGeometry/Instrument/INearestNeighbours.h"
#include "gmock/gmock.h"
#include <iostream>
#include <fstream>
#include <map>
Expand Down Expand Up @@ -111,30 +110,6 @@ class WorkspaceTester : public MatrixWorkspace
size_t spec;
};

//Helper and typedef for mocking NearestNeighbourFactory usage
class MockNearestNeighboursFactory : public Mantid::Geometry::INearestNeighboursFactory
{
public:
MOCK_METHOD3(create, Mantid::Geometry::INearestNeighbours*(boost::shared_ptr<const Mantid::Geometry::Instrument>,const Mantid::Geometry::ISpectraDetectorMap&, bool));
virtual ~MockNearestNeighboursFactory()
{
}
};

//Helper typedef and type for mocking NearestNeighbour map usage.
typedef std::map<Mantid::specid_t, Mantid::Kernel::V3D> SpectrumDistanceMap;
class MockNearestNeighbours : public Mantid::Geometry::INearestNeighbours {
public:
MOCK_CONST_METHOD2(neighbours, SpectrumDistanceMap(const specid_t spectrum, const double radius));
MOCK_CONST_METHOD3(neighbours, SpectrumDistanceMap(const specid_t spectrum, bool force, const int numberofneighbours));
MOCK_METHOD0(die, void());
virtual ~MockNearestNeighbours()
{
die();
}
};




#endif /* FAKEOBJECTS_H_ */

0 comments on commit 4ac9da2

Please sign in to comment.