Skip to content

Commit

Permalink
Merge b612d0b into 2edc6bb
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-keller committed May 29, 2018
2 parents 2edc6bb + b612d0b commit b2a98ed
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/CppUTest/SimpleString.h
Expand Up @@ -174,7 +174,9 @@ SimpleString BracketsFormattedHexStringFrom(cpputest_ulonglong value);
SimpleString BracketsFormattedHexStringFrom(signed char value);
SimpleString BracketsFormattedHexString(SimpleString hexString);


#if __cplusplus > 199711L
SimpleString StringFrom(const std::nullptr_t value);
#endif

#if CPPUTEST_USE_STD_CPP_LIB

Expand Down
6 changes: 6 additions & 0 deletions src/CppUTest/SimpleString.cpp
Expand Up @@ -540,6 +540,12 @@ SimpleString BracketsFormattedHexString(SimpleString hexString)
return SimpleString("(0x") + hexString + ")" ;
}

#if __cplusplus > 199711L
SimpleString StringFrom(const std::nullptr_t __attribute__((unused)) value)
{
return "(null)";
}
#endif

#ifdef CPPUTEST_USE_LONG_LONG

Expand Down
10 changes: 10 additions & 0 deletions tests/CppUTest/SimpleStringTest.cpp
Expand Up @@ -572,6 +572,16 @@ TEST(SimpleString, Sizes)
STRCMP_EQUAL("10", StringFrom((int) size).asCharString());
}

#if __cplusplus > 199711L
TEST(SimpleString, nullptr_type)
{
SimpleString s(StringFrom(nullptr));
STRCMP_EQUAL("(null)", s.asCharString());

CHECK_EQUAL(nullptr, 0);
}
#endif

TEST(SimpleString, HexStrings)
{
STRCMP_EQUAL("f3", HexStringFrom((signed char)-13).asCharString());
Expand Down

0 comments on commit b2a98ed

Please sign in to comment.