Skip to content

Commit

Permalink
Merge 1735635 into 96f193e
Browse files Browse the repository at this point in the history
  • Loading branch information
FranckRJ committed Nov 18, 2022
2 parents 96f193e + 1735635 commit 5036bb4
Show file tree
Hide file tree
Showing 24 changed files with 73 additions and 73 deletions.
4 changes: 2 additions & 2 deletions config/standalone/StandaloneFakeit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace fakeit {

struct VerificationException : public std::exception {
virtual ~VerificationException() NO_THROWS{};
virtual ~VerificationException() FAKEIT_NO_THROWS{};

VerificationException(std::string format) : //
_format(format) { //
Expand All @@ -33,7 +33,7 @@ namespace fakeit {
return _callingMethod;
}

const char* what() const NO_THROWS override{
const char* what() const FAKEIT_NO_THROWS override{
return _format.c_str();
}
private:
Expand Down
4 changes: 2 additions & 2 deletions config/tpunit/TpUnitFakeit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class TpUnitAdapter: public EventHandler {
: _msg(msg) {
}

const char* what() const NO_THROWS override{
const char* what() const FAKEIT_NO_THROWS override{
return _msg.c_str();
}

virtual ~AssertionException() NO_THROWS {}
virtual ~AssertionException() FAKEIT_NO_THROWS {}
};

virtual ~TpUnitAdapter() = default;
Expand Down
4 changes: 2 additions & 2 deletions include/fakeit/ActualInvocationsSource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ namespace fakeit {
struct ActualInvocationsContainer {
virtual void clear() = 0;

virtual ~ActualInvocationsContainer() NO_THROWS { }
virtual ~ActualInvocationsContainer() FAKEIT_NO_THROWS { }
};

struct ActualInvocationsSource {
virtual void getActualInvocations(std::unordered_set<fakeit::Invocation *> &into) const = 0;

virtual ~ActualInvocationsSource() NO_THROWS { }
virtual ~ActualInvocationsSource() FAKEIT_NO_THROWS { }
};

struct InvocationsSourceProxy : public ActualInvocationsSource {
Expand Down
2 changes: 1 addition & 1 deletion include/fakeit/DomainObjects.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace fakeit {

template<typename C>
struct MockObject {
virtual ~MockObject() THROWS { };
virtual ~MockObject() FAKEIT_THROWS { };

virtual C &get() = 0;

Expand Down
2 changes: 1 addition & 1 deletion include/fakeit/Invocation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace fakeit {

struct Matcher {

virtual ~Matcher() THROWS {
virtual ~Matcher() FAKEIT_THROWS {
}

virtual bool matches(Invocation &invocation) = 0;
Expand Down
2 changes: 1 addition & 1 deletion include/fakeit/MethodMockingContext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ namespace fakeit {
: _impl(std::move(other._impl)) {
}

virtual ~MethodMockingContext() NO_THROWS { }
virtual ~MethodMockingContext() FAKEIT_NO_THROWS { }

std::string format() const override {
return _impl->format();
Expand Down
6 changes: 3 additions & 3 deletions include/fakeit/Mock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ namespace fakeit {
impl.clear();
}

template<class DATA_TYPE, typename ... arglist,
class = typename std::enable_if<std::is_member_object_pointer<DATA_TYPE C::*>::value>::type>
DataMemberStubbingRoot<C, DATA_TYPE> Stub(DATA_TYPE C::* member, const arglist &... ctorargs) {
template<class DataType, typename ... arglist,
class = typename std::enable_if<std::is_member_object_pointer<DataType C::*>::value>::type>
DataMemberStubbingRoot<C, DataType> Stub(DataType C::* member, const arglist &... ctorargs) {
return impl.stubDataMember(member, ctorargs...);
}

Expand Down
8 changes: 4 additions & 4 deletions include/fakeit/MockImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace fakeit {
fake->getVirtualTable().setCookie(1, this);
}

virtual ~MockImpl() NO_THROWS {
virtual ~MockImpl() FAKEIT_NO_THROWS {
_proxy.detach();
}

Expand Down Expand Up @@ -83,10 +83,10 @@ namespace fakeit {
return _fakeit;
}

template<class DATA_TYPE, typename T, typename ... arglist, class = typename std::enable_if<std::is_base_of<T, C>::value>::type>
DataMemberStubbingRoot<C, DATA_TYPE> stubDataMember(DATA_TYPE T::*member, const arglist &... ctorargs) {
template<class DataType, typename T, typename ... arglist, class = typename std::enable_if<std::is_base_of<T, C>::value>::type>
DataMemberStubbingRoot<C, DataType> stubDataMember(DataType T::*member, const arglist &... ctorargs) {
_proxy.stubDataMember(member, ctorargs...);
return DataMemberStubbingRoot<T, DATA_TYPE>();
return DataMemberStubbingRoot<T, DataType>();
}

template<int id, typename R, typename T, typename ... arglist, class = typename std::enable_if<std::is_base_of<T, C>::value>::type>
Expand Down
2 changes: 1 addition & 1 deletion include/fakeit/RecordedMethodBody.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace fakeit {
RecordedMethodBody(FakeitContext &fakeit, std::string name) :
_fakeit(fakeit), _method{MethodInfo::nextMethodOrdinal(), name} { }

virtual ~RecordedMethodBody() NO_THROWS {
virtual ~RecordedMethodBody() FAKEIT_NO_THROWS {
}

MethodInfo &getMethod() {
Expand Down
2 changes: 1 addition & 1 deletion include/fakeit/Sequence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace fakeit {
Sequence() {
}

virtual ~Sequence() THROWS {
virtual ~Sequence() FAKEIT_THROWS {
}

public:
Expand Down
2 changes: 1 addition & 1 deletion include/fakeit/SequenceVerificationExpectation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace fakeit {

friend class SequenceVerificationProgress;

~SequenceVerificationExpectation() THROWS {
~SequenceVerificationExpectation() FAKEIT_THROWS {
if (UncaughtException()) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion include/fakeit/SequenceVerificationProgress.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ namespace fakeit {

public:

~SequenceVerificationProgress() THROWS { };
~SequenceVerificationProgress() FAKEIT_THROWS { };

operator bool() const {
return Terminator(_expectationPtr);
Expand Down
4 changes: 2 additions & 2 deletions include/fakeit/StubbingImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace fakeit {

template<typename C, typename DATA_TYPE>
template<typename C, typename DataType>
class DataMemberStubbingRoot {
private:
//DataMemberStubbingRoot & operator= (const DataMemberStubbingRoot & other) = delete;
Expand All @@ -30,7 +30,7 @@ namespace fakeit {

DataMemberStubbingRoot() = default;

void operator=(const DATA_TYPE&) {
void operator=(const DataType&) {
}
};

Expand Down
4 changes: 2 additions & 2 deletions include/fakeit/StubbingProgress.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace fakeit {
template<typename R, typename ... arglist>
struct MethodStubbingProgress {

virtual ~MethodStubbingProgress() THROWS {
virtual ~MethodStubbingProgress() FAKEIT_THROWS {
}

template<typename U = R>
Expand Down Expand Up @@ -229,7 +229,7 @@ namespace fakeit {
template<typename ... arglist>
struct MethodStubbingProgress<void, arglist...> {

virtual ~MethodStubbingProgress() THROWS {
virtual ~MethodStubbingProgress() FAKEIT_THROWS {
}

MethodStubbingProgress<void, arglist...> &Return() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace fakeit {

friend class VerifyNoOtherInvocationsVerificationProgress;

~VerifyNoOtherInvocationsExpectation() THROWS {
~VerifyNoOtherInvocationsExpectation() FAKEIT_THROWS {
if (UncaughtException()) {
return;
}
Expand Down Expand Up @@ -109,7 +109,7 @@ namespace fakeit {
public:


~VerifyNoOtherInvocationsVerificationProgress() THROWS {
~VerifyNoOtherInvocationsVerificationProgress() FAKEIT_THROWS {
};

VerifyNoOtherInvocationsVerificationProgress setFileInfo(const char * file, int line,
Expand Down
2 changes: 1 addition & 1 deletion include/fakeit/WhenFunctor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace fakeit {

friend class WhenFunctor;

virtual ~StubbingChange() THROWS {
virtual ~StubbingChange() FAKEIT_THROWS {

if (UncaughtException()) {
return;
Expand Down
36 changes: 18 additions & 18 deletions include/mockutils/DynamicProxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace fakeit {
_offsets(VTUtils::getVTSize<C>()),
_invocationHandlers(_methodMocks, _offsets) {
_cloneVt.copyFrom(originalVtHandle.restore());
_cloneVt.setCookie(InvocationHandlerCollection::VT_COOKIE_INDEX, &_invocationHandlers);
_cloneVt.setCookie(InvocationHandlerCollection::VtCookieIndex, &_invocationHandlers);
getFake().setVirtualTable(_cloneVt);
}

Expand Down Expand Up @@ -137,21 +137,21 @@ namespace fakeit {
return ptr.get();
}

template<typename DATA_TYPE, typename ... arglist>
void stubDataMember(DATA_TYPE C::*member, const arglist &... initargs) {
DATA_TYPE C::*theMember = (DATA_TYPE C::*) member;
template<typename DataType, typename ... arglist>
void stubDataMember(DataType C::*member, const arglist &... initargs) {
DataType C::*theMember = (DataType C::*) member;
C &mock = get();
DATA_TYPE *memberPtr = &(mock.*theMember);
DataType *memberPtr = &(mock.*theMember);
_members.push_back(
std::shared_ptr<DataMemeberWrapper < DATA_TYPE, arglist...> >
{new DataMemeberWrapper < DATA_TYPE, arglist...>(memberPtr,
std::shared_ptr<DataMemeberWrapper < DataType, arglist...> >
{new DataMemeberWrapper < DataType, arglist...>(memberPtr,
initargs...)});
}

template<typename DATA_TYPE>
void getMethodMocks(std::vector<DATA_TYPE> &into) const {
template<typename DataType>
void getMethodMocks(std::vector<DataType> &into) const {
for (std::shared_ptr<Destructible> ptr : _methodMocks) {
DATA_TYPE p = dynamic_cast<DATA_TYPE>(ptr.get());
DataType p = dynamic_cast<DataType>(ptr.get());
if (p) {
into.push_back(p);
}
Expand All @@ -165,19 +165,19 @@ namespace fakeit {

private:

template<typename DATA_TYPE, typename ... arglist>
template<typename DataType, typename ... arglist>
class DataMemeberWrapper : public Destructible {
private:
DATA_TYPE *dataMember;
DataType *dataMember;
public:
DataMemeberWrapper(DATA_TYPE *dataMem, const arglist &... initargs) :
DataMemeberWrapper(DataType *dataMem, const arglist &... initargs) :
dataMember(dataMem) {
new(dataMember) DATA_TYPE{initargs ...};
new(dataMember) DataType{initargs ...};
}

~DataMemeberWrapper() override
{
dataMember->~DATA_TYPE();
dataMember->~DataType();
}
};

Expand Down Expand Up @@ -208,10 +208,10 @@ namespace fakeit {
_offsets[methodProxy.getOffset()] = methodProxy.getId();
}

template<typename DATA_TYPE>
DATA_TYPE getMethodMock(unsigned int offset) {
template<typename DataType>
DataType getMethodMock(unsigned int offset) {
std::shared_ptr<Destructible> ptr = _methodMocks[offset];
return dynamic_cast<DATA_TYPE>(ptr.get());
return dynamic_cast<DataType>(ptr.get());
}

template<typename BaseClass>
Expand Down
8 changes: 4 additions & 4 deletions include/mockutils/Macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#pragma once

#if defined (__GNUG__) || _MSC_VER >= 1900
#define THROWS noexcept(false)
#define NO_THROWS noexcept(true)
#define FAKEIT_THROWS noexcept(false)
#define FAKEIT_NO_THROWS noexcept(true)
#elif defined (_MSC_VER)
#define THROWS throw(...)
#define NO_THROWS
#define FAKEIT_THROWS throw(...)
#define FAKEIT_NO_THROWS
#endif
4 changes: 2 additions & 2 deletions include/mockutils/MethodProxyCreator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
namespace fakeit {

struct InvocationHandlerCollection {
static const unsigned int VT_COOKIE_INDEX = 0;
static const unsigned int VtCookieIndex = 0;

virtual Destructible *getInvocatoinHandlerPtrById(unsigned int index) = 0;

static InvocationHandlerCollection *getInvocationHandlerCollection(void *instance) {
VirtualTableBase &vt = VirtualTableBase::getVTable(instance);
InvocationHandlerCollection *invocationHandlerCollection = (InvocationHandlerCollection *) vt.getCookie(
InvocationHandlerCollection::VT_COOKIE_INDEX);
InvocationHandlerCollection::VtCookieIndex);
return invocationHandlerCollection;
}
};
Expand Down
12 changes: 6 additions & 6 deletions include/mockutils/gcc/is_simple_inheritance_layout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
#include <tr2/type_traits>

namespace fakeit {
template<typename ... T1>
template<typename ... Type1>
class has_one_base {
};

template<typename T1, typename T2, typename ... types>
class has_one_base<std::tr2::__reflection_typelist<T1, T2, types...>> : public std::false_type {
template<typename Type1, typename Type2, typename ... types>
class has_one_base<std::tr2::__reflection_typelist<Type1, Type2, types...>> : public std::false_type {
};

template<typename T1>
class has_one_base<std::tr2::__reflection_typelist<T1>>
: public has_one_base<typename std::tr2::direct_bases<T1>::type> {
template<typename Type1>
class has_one_base<std::tr2::__reflection_typelist<Type1>>
: public has_one_base<typename std::tr2::direct_bases<Type1>::type> {
};

template<>
Expand Down
12 changes: 6 additions & 6 deletions include/mockutils/mscpp/VirtualTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace fakeit {
char name[8];
};

struct PMD {
struct PmdInfo {

/************************************************************************/
/* member displacement.
Expand All @@ -39,7 +39,7 @@ namespace fakeit {
int pdisp; // vtable displacement
int vdisp; //displacement inside vtable

PMD() :
PmdInfo() :
mdisp(0), pdisp(-1), vdisp(0) {
}
};
Expand All @@ -51,7 +51,7 @@ namespace fakeit {

const std::type_info *pTypeDescriptor; //type descriptor of the class
dword_ numContainedBases; //number of nested classes following in the Base Class Array
struct PMD where; //pointer-to-member displacement info
struct PmdInfo where; //pointer-to-member displacement info
dword_ attributes; //flags, usually 0
};

Expand Down Expand Up @@ -91,11 +91,11 @@ namespace fakeit {
numBaseClasses++;
}

template<typename head, typename B1, typename... tail>
template<typename head, typename Base1, typename... tail>
void addBaseClass() {
static_assert(std::is_base_of<B1, head>::value, "invalid inheritance list");
static_assert(std::is_base_of<Base1, head>::value, "invalid inheritance list");
addBaseClass<head>();
addBaseClass<B1, tail...>();
addBaseClass<Base1, tail...>();
}

};
Expand Down
2 changes: 1 addition & 1 deletion include/mockutils/smart_ptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace fakeit {
reference->AddRef();
}

~smart_ptr() THROWS {
~smart_ptr() FAKEIT_THROWS {
if (reference->Release() == 0) {
delete reference;
delete pData;
Expand Down

0 comments on commit 5036bb4

Please sign in to comment.