Unit test nullptr C-style strings

Added unit tests for the cases of matching and serializing C-style strings (char*) that are nullptr.

(As of this revision, these new tests correctly fail, except for the test of mock::equal; fix to follow.)
This commit is contained in:
Alex Smith 2023-01-02 17:30:54 +00:00
parent 0dd0dfa15f
commit 528761b180
3 changed files with 26 additions and 1 deletions

View file

@ -80,6 +80,15 @@ BOOST_AUTO_TEST_CASE(equal_constraint_deref)
}
}
BOOST_AUTO_TEST_CASE(equal_null_c_string)
{
const char* const null_str = nullptr;
BOOST_CHECK(mock::equal(null_str).c_(null_str));
BOOST_CHECK(!mock::equal(null_str).c_("non-null string"));
BOOST_CHECK(!mock::equal("non-null-string").c_(null_str));
}
BOOST_AUTO_TEST_CASE(same_constraint)
{
{