Chromium Code Reviews| Index: base/hash_unittest.cc |
| diff --git a/base/hash_unittest.cc b/base/hash_unittest.cc |
| index 03f9db2ca40d389ba967d584eae3cd39d7352fac..afbd7973407ee8bd62b6525a409c4379549ee357 100644 |
| --- a/base/hash_unittest.cc |
| +++ b/base/hash_unittest.cc |
| @@ -25,6 +25,16 @@ TEST(HashTest, String) { |
| str = "helmo world"; |
| EXPECT_EQ(1006697176u, Hash(str)); |
| + // Add a null byte. |
|
Noel Gordon
2014/03/05 04:47:01
nit: maybe s/Add/Insert/ ?
Matt Giuca
2014/03/05 04:49:17
Done.
|
| + str = "hello world"; |
| + str[5] = '\0'; |
| + EXPECT_EQ(2319902537u, Hash(str)); |
| + |
| + // Test that the bytes after the null contribute to the hash. |
| + str = "hello worle"; |
| + str[5] = '\0'; |
| + EXPECT_EQ(553904462u, Hash(str)); |
| + |
| // Extremely long string. |
| // Also tests strings with high bit set, and null byte. |
| std::vector<char> long_string_buffer; |