Go to the documentation of this file.
17 #include "absl/strings/internal/memutil.h"
21 #include "gtest/gtest.h"
22 #include "absl/strings/ascii.h"
26 static char* memcasechr(
const char* s,
int c,
size_t slen) {
28 for (; slen; ++
s, --slen) {
34 static const char* memcasematch(
const char* phaystack,
size_t haylen,
35 const char* pneedle,
size_t neelen) {
39 if (haylen < neelen)
return nullptr;
42 const char* hayend = phaystack + haylen - neelen + 1;
43 while ((
match =
static_cast<char*
>(
44 memcasechr(phaystack, pneedle[0], hayend - phaystack)))) {
48 phaystack =
match + 1;
53 TEST(MemUtilTest, AllTests) {
60 sizeof(
"hello there") - 1),
63 sizeof(
"hello there") - 1),
66 sizeof(
"hello there") - 2),
74 sizeof(
"hello there") - 1);
77 sizeof(
"hello there") - 2);
80 sizeof(
"hello there") - 1);
84 sizeof(
"hello there") - 1,
"hole");
96 sizeof(
"hello there!") - 1,
"trole h");
99 sizeof(
"hello there!") - 2,
"trole h!");
103 sizeof(
"hello there") - 1,
"leho");
106 sizeof(
"hello there") - 1,
"u");
109 sizeof(
"hello there") - 1,
"");
112 sizeof(
"hello there") - 1,
" ");
122 sizeof(
"hello there!") - 2,
"!");
129 const char kHaystack[] =
"0123456789";
145 const char kHaystack[] =
"aBcDeFgHiJ";
162 const char kHaystack[] =
"0123456789";
char ascii_tolower(unsigned char c)
const char * memmem(const char *phaystack, size_t haylen, const char *pneedle, size_t needlelen)
int memcasecmp(const char *s1, const char *s2, size_t len)
unsigned char match[65280+2]
char * memrchr(const char *s, int c, size_t slen)
const char * memcasemem(const char *phaystack, size_t haylen, const char *pneedle, size_t needlelen)
#define TEST(name, init_size,...)
char * memdup(const char *s, size_t slen)
char * mempbrk(const char *s, size_t slen, const char *accept)
const char * memmatch(const char *phaystack, size_t haylen, const char *pneedle, size_t neelen)
size_t memcspn(const char *s, size_t slen, const char *reject)
#define EXPECT_TRUE(condition)
char * memcat(char *dest, size_t destlen, const char *src, size_t srclen)
size_t memspn(const char *s, size_t slen, const char *accept)
grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:24