Convert to bool in suite::expect

This commit is contained in:
Vinnie Falco
2015-06-10 18:58:21 -07:00
committed by Nik Bougalis
parent 0fcd3da046
commit 237b5e704f

View File

@@ -346,11 +346,13 @@ bool
suite::expect (Condition shouldBeTrue, suite::expect (Condition shouldBeTrue,
String const& reason) String const& reason)
{ {
if (shouldBeTrue) bool const b =
static_cast<bool>(shouldBeTrue);
if (b)
pass(); pass();
else else
fail (reason); fail (reason);
return shouldBeTrue; return b;
} }
template <class Condition, class String> template <class Condition, class String>
@@ -359,11 +361,13 @@ bool
suite::unexpected (Condition shouldBeFalse, suite::unexpected (Condition shouldBeFalse,
String const& reason) String const& reason)
{ {
if (! shouldBeFalse) bool const b =
static_cast<bool>(shouldBeFalse);
if (! b)
pass(); pass();
else else
fail (reason); fail (reason);
return ! shouldBeFalse; return ! b;
} }
template <class> template <class>