Add test for strings of null character.

They're working, but wanted to make that explicitly clear.
This commit is contained in:
Daniel
2016-02-28 09:11:19 +00:00
parent a47818647d
commit fa6cb80704

View File

@@ -38,6 +38,23 @@ void string_tests()
#endif
}
void string0_tests()
{
std::string x1(1, '\0');
std::string x2(2, '\0');
std::string x3(3, '\0');
std::string x4(10, '\0');
BOOST_HASH_TEST_NAMESPACE::hash<std::string> hasher;
BOOST_TEST(hasher(x1) != hasher(x2));
BOOST_TEST(hasher(x1) != hasher(x3));
BOOST_TEST(hasher(x1) != hasher(x4));
BOOST_TEST(hasher(x2) != hasher(x3));
BOOST_TEST(hasher(x2) != hasher(x4));
BOOST_TEST(hasher(x3) != hasher(x4));
}
#if !defined(BOOST_NO_STD_WSTRING)
void wstring_tests()
{
@@ -66,6 +83,7 @@ void wstring_tests()
int main()
{
string_tests();
string0_tests();
#if !defined(BOOST_NO_STD_WSTRING)
wstring_tests();
#endif