-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
have_received matcher for method invocation expectations.
- Loading branch information
Adam Milligan
committed
Jan 28, 2012
1 parent
2315e30
commit 232641e
Showing
11 changed files
with
520 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#import <Foundation/Foundation.h> | ||
#import "CompareEqual.h" | ||
#import "CedarStringifiers.h" | ||
|
||
namespace Cedar { namespace Doubles { | ||
|
||
class Argument { | ||
public: | ||
virtual ~Argument() = 0; | ||
|
||
virtual const char * value_encoding() const = 0; | ||
virtual NSString * value_string() const = 0; | ||
|
||
virtual bool matches_bytes(void * expectedArgumentBytes) const = 0; | ||
}; | ||
|
||
inline /* virtual */ Argument::~Argument() {} | ||
|
||
template<typename T> | ||
class TypedArgument : public Argument { | ||
private: | ||
TypedArgument<T> & operator=(const TypedArgument<T> &); | ||
|
||
public: | ||
explicit TypedArgument(const T &); | ||
virtual ~TypedArgument(); | ||
// Allow default copy ctor. | ||
|
||
virtual const char * value_encoding() const; | ||
virtual NSString * value_string() const; | ||
|
||
virtual bool matches_bytes(void * expectedArgumentBytes) const; | ||
|
||
private: | ||
const T & value_; | ||
}; | ||
|
||
|
||
template<typename T> | ||
TypedArgument<T>::TypedArgument(const T & value) : Argument(), value_(value) {} | ||
|
||
template<typename T> | ||
/* virtual */ TypedArgument<T>::~TypedArgument() {} | ||
|
||
template<typename T> | ||
/* virtual */ const char * TypedArgument<T>::value_encoding() const { | ||
return @encode(T); | ||
} | ||
|
||
template<typename T> | ||
/* virtual */ NSString * TypedArgument<T>::value_string() const { | ||
return Matchers::Stringifiers::string_for(value_); | ||
} | ||
|
||
template<typename T> | ||
/* virtual */ bool TypedArgument<T>::matches_bytes(void * expectedArgumentBytes) const { | ||
return value_ == *(static_cast<T *>(expectedArgumentBytes)); | ||
} | ||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
#import "CDRSpy.h" | ||
#import "HaveReceived.h" |
Oops, something went wrong.