mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Added support for dereferencing in mock::equal
This commit is contained in:
parent
a2d36e961a
commit
5d11db0f52
10 changed files with 117 additions and 12 deletions
|
|
@ -15,6 +15,7 @@ Not yet released
|
|||
* Added [@https://github.com/philsquared/Catch Catch] integration
|
||||
* Fixed move-only type argument in actions
|
||||
* Fixed move-only type support in constraints
|
||||
* Added support for dereferencing in mock::equal
|
||||
|
||||
[endsect]
|
||||
|
||||
|
|
|
|||
|
|
@ -18,10 +18,11 @@ namespace
|
|||
{
|
||||
public:
|
||||
explicit my_class( int data )
|
||||
: data_( data )
|
||||
: data_( data )
|
||||
{}
|
||||
int data_;
|
||||
};
|
||||
|
||||
std::ostream& operator<<( std::ostream& os, const my_class& c ) // my_class is serializable to an std::ostream
|
||||
{
|
||||
return os << "my_class( " << c.data_ << " )";
|
||||
|
|
@ -37,7 +38,7 @@ namespace
|
|||
//[ quick_constraint_solution
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace mock // it could also be in the namespace of 'my_class'
|
||||
namespace // in the same namespace as 'my_class'
|
||||
{
|
||||
bool operator==( const my_class& actual, const std::string& expected ) // the first part of the trick is to compare to a string
|
||||
{
|
||||
|
|
|
|||
|
|
@ -384,7 +384,11 @@ Constraints :
|
|||
calls ['expected] as a functor returning a ['bool], throws std::invalid_argument if ! ['expected]
|
||||
|
||||
compares ['actual] to ['expected] using operator ==]]
|
||||
[[mock::equal( ['expected] )] [['actual] == ['expected]] [compares ['actual] to ['expected] using operator ==]]
|
||||
[[mock::equal( ['expected] )] [['actual] == ['expected]
|
||||
|
||||
['actual] && *['actual] == ['expected]] [compares ['actual] to ['expected] using operator ==
|
||||
|
||||
compares ['actual] content to ['expected] using operator ==]]
|
||||
[[mock::less( ['expected] )] [['actual] < ['expected]] [compares ['actual] to ['expected] using operator <]]
|
||||
[[mock::greater( ['expected] )] [['actual] > ['expected]] [compares ['actual] to ['expected] using operator >]]
|
||||
[[mock::less_equal( ['expected] )] [['actual] <= ['expected]] [compares ['actual] to ['expected] using operator <=]]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue