Add strchrnul.

Bug: http://b/18374026
Change-Id: Iea923309c090a51a2d41c5a83320ab3789f40f1c
This commit is contained in:
Elliott Hughes
2015-08-26 09:59:29 -07:00
parent 4d5c4f085b
commit 7ac3c128bb
5 changed files with 39 additions and 0 deletions

View File

@@ -454,6 +454,13 @@ TEST(string, strchr) {
}
}
TEST(string, strchrnul) {
const char* s = "01234222";
EXPECT_TRUE(strchrnul(s, '2') == &s[2]);
EXPECT_TRUE(strchrnul(s, '8') == (s + strlen(s)));
EXPECT_TRUE(strchrnul(s, '\0') == (s + strlen(s)));
}
TEST(string, strcmp) {
StringTestState<char> state(SMALL);
for (size_t i = 1; i < state.n; i++) {