mirror of
https://github.com/unittest-cpp/unittest-cpp
synced 2026-09-26 16:19:30 +03:00
parent
510903c880
commit
21589e5612
2 changed files with 29 additions and 1 deletions
|
|
@ -9,7 +9,7 @@ namespace UnitTest {
|
|||
|
||||
|
||||
template< typename Value >
|
||||
bool Check(Value const value)
|
||||
bool Check(Value const& value)
|
||||
{
|
||||
return !!value; // doing double negative to avoid silly VS warnings
|
||||
}
|
||||
|
|
|
|||
|
|
@ -315,4 +315,32 @@ namespace {
|
|||
CHECK_EQUAL(1234, reporter.lastFailedLine);
|
||||
}
|
||||
|
||||
TEST(CheckProperlyDealsWithOperatorBoolOverrides)
|
||||
{
|
||||
class TruthyUnlessCopied
|
||||
{
|
||||
public:
|
||||
TruthyUnlessCopied()
|
||||
: truthy_(true)
|
||||
{
|
||||
}
|
||||
|
||||
TruthyUnlessCopied(const TruthyUnlessCopied& orig)
|
||||
: truthy_(false)
|
||||
{
|
||||
}
|
||||
|
||||
operator bool() const
|
||||
{
|
||||
return truthy_;
|
||||
}
|
||||
|
||||
private:
|
||||
bool truthy_;
|
||||
};
|
||||
|
||||
TruthyUnlessCopied objectThatShouldBeTruthy;
|
||||
CHECK(objectThatShouldBeTruthy);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue