We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I tried to write a constraint for my custom type MyType:
MyType
class IsRange { Time _timeIn; Duration _duration; public: IsRange(Time timeIn, Duration duration) : _timeIn(timeIn), _duration(duration) { } inline bool Matches(const MyType *actual) const { return actual && actual->timeIn() == _timeIn && actual->duration() == _duration; } friend std::ostream& operator <<(std::ostream &stm, const IsRange&); }; template <>struct snowhouse::Stringizer<MyType> { static std::string ToString(const MyType *obj) { return obj->description().toStdString(); } };
Since the stringizer doesn't work for pointer so when the test fails, it display the pointer adress for the actual value.
I converted my code to handle reference:
class IsRange { Time _timeIn; Duration _duration; public: IsRange(Time timeIn, Duration duration) : _timeIn(timeIn), _duration(duration) { } inline bool Matches(const MyType &actual) const { return actual.timeIn() == _timeIn && actual.duration() == _duration; } friend std::ostream& operator <<(std::ostream &stm, const IsRange&); }; template <> struct snowhouse::Stringizer<MyType> { static std::string ToString(const MyType &obj) { return obj.description().toStdString(); } };
I now need to do two checks in my tests:
MyType *a = ... AssertThat(a, Is().Not().Null()); AssertThat(*a, Fulfills(IsRange(2111, 889)));
Do you think using pointer would be possible ?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I tried to write a constraint for my custom type
MyType
:Since the stringizer doesn't work for pointer so when the test fails, it display the pointer adress for the actual value.
I converted my code to handle reference:
I now need to do two checks in my tests:
Do you think using pointer would be possible ?
The text was updated successfully, but these errors were encountered: