aboutsummaryrefslogtreecommitdiff
path: root/libc/test/src/string/memchr_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libc/test/src/string/memchr_test.cpp')
-rw-r--r--libc/test/src/string/memchr_test.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libc/test/src/string/memchr_test.cpp b/libc/test/src/string/memchr_test.cpp
index ede8411..a92c5fe 100644
--- a/libc/test/src/string/memchr_test.cpp
+++ b/libc/test/src/string/memchr_test.cpp
@@ -21,6 +21,11 @@ const char *call_memchr(const void *src, int c, size_t size) {
return reinterpret_cast<const char *>(LIBC_NAMESPACE::memchr(src, c, size));
}
+TEST(LlvmLibcMemChrTest, WideReadMultiIteration) {
+ const char *src = "abcdefghijklmnopqrst$\n";
+ ASSERT_STREQ(call_memchr(src, '$', 22), "$\n");
+}
+
TEST(LlvmLibcMemChrTest, FindsCharacterAfterNullTerminator) {
// memchr should continue searching after a null terminator.
const size_t size = 5;