24#include <unordered_map>
122static const char fox[] =
"The quick brown fox jumped over the lazy dog";
123static const char fox1[] =
"The quick brown fox ";
124static const char fox2[] =
"jumped over the lazy dog";
147 CPPUNIT_ASSERT_EQUAL(0U,
s1.length());
148 CPPUNIT_ASSERT_EQUAL(
SBuf(
""),
s1);
150 CPPUNIT_ASSERT_EQUAL(0,strcmp(
"",
s1.c_str()));
156 CPPUNIT_ASSERT_EQUAL(0U,
s1.length());
157 CPPUNIT_ASSERT_EQUAL(
SBuf(
""),
s1);
159 CPPUNIT_ASSERT_EQUAL(0,strcmp(
"",
s1.c_str()));
165 CPPUNIT_ASSERT_EQUAL(0U,
s1.length());
166 CPPUNIT_ASSERT_EQUAL(
SBuf(
""),
s1);
168 CPPUNIT_ASSERT_EQUAL(0,strcmp(
"",
s1.c_str()));
174 CPPUNIT_ASSERT_EQUAL(0U,
s1.length());
175 CPPUNIT_ASSERT_EQUAL(
SBuf(
""),
s1);
177 CPPUNIT_ASSERT_EQUAL(0,strcmp(
"",
s1.c_str()));
180 CPPUNIT_ASSERT_EQUAL(
literal,s5);
182 CPPUNIT_ASSERT_EQUAL(
literal,s6);
191 CPPUNIT_ASSERT_EQUAL(s3.rawContent(), s4.
rawContent());
198 CPPUNIT_ASSERT_EQUAL(
s1,s3);
201 CPPUNIT_ASSERT_EQUAL(s4,s3);
206 std::string str(
fox);
223 CPPUNIT_ASSERT_EQUAL(
s1,
s1);
224 CPPUNIT_ASSERT_EQUAL(
s1,s2);
225 s2.
assign(
"The quick brown fox jumped over the lazy doe");
226 CPPUNIT_ASSERT(!(
s1 == s2));
228 CPPUNIT_ASSERT(!(
s1 == s2));
229 CPPUNIT_ASSERT(
s1 != s2);
231 CPPUNIT_ASSERT(!(
s1 == s2));
232 CPPUNIT_ASSERT(
s1 != s2);
234 CPPUNIT_ASSERT_EQUAL(
s1,s2);
241 const char *
const rawAppendix = appendix.
rawContent();
248 CPPUNIT_ASSERT_EQUAL(s0, appendix);
253 CPPUNIT_ASSERT(
s1.rawContent() != appendix.
rawContent());
254 CPPUNIT_ASSERT(
s1 != appendix);
255 CPPUNIT_ASSERT_EQUAL(rawAppendix, appendix.
rawContent());
262 s1.Printf(
"%s:%d:%03.3f",
"fox",10,12345.67);
263 s2.
assign(
"fox:10:12345.670");
264 CPPUNIT_ASSERT_EQUAL(
s1,s2);
278 const char *alphabet=
"abcdefghijklmnopqrstuvwxyz";
282 CPPUNIT_ASSERT_EQUAL(
alpha,s);
288 control.append(alphabet,5).append(1,
'\0').append(alphabet,6,std::string::npos);
290 CPPUNIT_ASSERT_EQUAL(scontrol,s);
293 const char *alphazero=
"abcdefghijk\0mnopqrstuvwxyz";
294 SBuf s(alphazero,26);
295 std::string str(alphazero,26);
296 CPPUNIT_ASSERT_EQUAL(0,memcmp(str.data(),s.
rawContent(),26));
304 s1.appendf(
"%s:%d:%03.2f",
fox,1234,1234.56);
305 s2.
assign(
"The quick brown fox jumped over the lazy dog:1234:1234.56");
306 CPPUNIT_ASSERT_EQUAL(s2,
s1);
314 std::cout <<
"sizeof(SBuf): " <<
sizeof(
SBuf) << std::endl;
315 std::cout <<
"sizeof(MemBlob): " <<
sizeof(
MemBlob) << std::endl;
322 CPPUNIT_ASSERT_EQUAL(chg[5],
'u');
324 CPPUNIT_ASSERT_EQUAL(
literal[5],
'u');
325 CPPUNIT_ASSERT_EQUAL(chg[5],
'e');
336 std::cout << c << std::endl;
352 std::cerr << std::endl <<
" cmp(SBuf) npos " << left <<
" ?= " << right << std::endl;
353 CPPUNIT_ASSERT_EQUAL(
sign(strcmp(left, right)),
sign(
SBuf(left).cmp(
SBuf(right))));
355 if (
sign(strcmp(left, right)) !=
sign(
SBuf(left).cmp(right)))
356 std::cerr << std::endl <<
" cmp(char*) npos " << left <<
" ?= " << right << std::endl;
357 CPPUNIT_ASSERT_EQUAL(
sign(strcmp(left, right)),
sign(
SBuf(left).cmp(right)));
360 std::cerr << std::endl <<
" caseCmp(SBuf) npos " << left <<
" ?= " << right << std::endl;
361 CPPUNIT_ASSERT_EQUAL(
sign(strcasecmp(left, right)),
sign(
SBuf(left).caseCmp(
SBuf(right))));
363 if (
sign(strcasecmp(left, right)) !=
sign(
SBuf(left).caseCmp(right)))
364 std::cerr << std::endl <<
" caseCmp(char*) npos " << left <<
" ?= " << right << std::endl;
365 CPPUNIT_ASSERT_EQUAL(
sign(strcasecmp(left, right)),
sign(
SBuf(left).caseCmp(right)));
372 std::cerr << std::endl <<
" cmp(SBuf) " << n <<
' ' << left <<
" ?= " << right << std::endl;
373 CPPUNIT_ASSERT_EQUAL(
sign(strncmp(left, right, n)),
sign(
SBuf(left).cmp(
SBuf(right), n)));
375 if (
sign(strncmp(left, right, n)) !=
sign(
SBuf(left).cmp(right, n)))
376 std::cerr << std::endl <<
" cmp(char*) " << n <<
' ' <<
SBuf(left) <<
" ?= " << right << std::endl;
377 CPPUNIT_ASSERT_EQUAL(
sign(strncmp(left, right, n)),
sign(
SBuf(left).cmp(right, n)));
379 if (
sign(strncasecmp(left, right, n)) !=
sign(
SBuf(left).caseCmp(
SBuf(right), n)))
380 std::cerr << std::endl <<
" caseCmp(SBuf) " << n <<
' ' << left <<
" ?= " << right << std::endl;
381 CPPUNIT_ASSERT_EQUAL(
sign(strncasecmp(left, right, n)),
sign(
SBuf(left).caseCmp(
SBuf(right), n)));
383 if (
sign(strncasecmp(left, right, n)) !=
sign(
SBuf(left).caseCmp(right, n)))
384 std::cerr << std::endl <<
" caseCmp(char*) " << n <<
' ' <<
SBuf(left) <<
" ?= " << right << std::endl;
385 CPPUNIT_ASSERT_EQUAL(
sign(strncasecmp(left, right, n)),
sign(
SBuf(left).caseCmp(right, n)));
392 const size_t maxN = 2 +
min(strlen(left), strlen(right));
393 for (
size_t n = 0; n <= maxN; ++n) {
410 CPPUNIT_ASSERT(
s1.cmp(s2)>0);
411 CPPUNIT_ASSERT(
s1.caseCmp(s2)>0);
412 CPPUNIT_ASSERT(s2.
cmp(
s1)<0);
413 CPPUNIT_ASSERT_EQUAL(0,
s1.cmp(s2,2));
414 CPPUNIT_ASSERT_EQUAL(0,
s1.caseCmp(s2,2));
415 CPPUNIT_ASSERT(
s1 > s2);
416 CPPUNIT_ASSERT(s2 <
s1);
421 CPPUNIT_ASSERT(
s1.cmp(s2)<0);
423 CPPUNIT_ASSERT(
s1 < s2);
425 CPPUNIT_ASSERT_EQUAL(1,
SBuf(
"foolong").caseCmp(
SBuf(
"foo"), 5));
429 CPPUNIT_ASSERT_EQUAL(0,
s1.caseCmp(s2));
430 CPPUNIT_ASSERT_EQUAL(0,
s1.caseCmp(s2,2));
432 s1.assign(
"f\0oo",4);
434 CPPUNIT_ASSERT(
s1.cmp(s2) > 0);
435 CPPUNIT_ASSERT_EQUAL(0,
s1.caseCmp(s2));
436 CPPUNIT_ASSERT_EQUAL(0,
s1.caseCmp(s2,3));
437 CPPUNIT_ASSERT_EQUAL(0,
s1.caseCmp(s2,2));
438 CPPUNIT_ASSERT_EQUAL(0,
s1.cmp(s2,2));
453 char *right =
xstrdup(
"foo34567890123456789012345678");
454 SBuf left(
"fooZYXWVUTSRQPONMLKJIHGFEDCBA");
461 left.
setAt(14,
'\0');
466 std::cerr << std::endl <<
" cmp(char*) " << n <<
' ' << left <<
" ?= " << right;
469 std::cerr << std::endl <<
" caseCmp(char*) " << n <<
' ' << left <<
" ?= " << right;
482 CPPUNIT_ASSERT_EQUAL(s2,s3);
483 s3.
assign(
"quick brown fox jumped over the lazy dog");
484 CPPUNIT_ASSERT_EQUAL(
s1,s3);
486 CPPUNIT_ASSERT_EQUAL(
s1,
SBuf());
496 foo =
s1.rawContent();
497 CPPUNIT_ASSERT_EQUAL(0,strncmp(
fox,foo,
s1.length()));
499 CPPUNIT_ASSERT(!strcmp(
fox,foo));
510 CPPUNIT_ASSERT_EQUAL(
s1,s2);
519 CPPUNIT_ASSERT_EQUAL(
s1,s2);
523 CPPUNIT_ASSERT_EQUAL(
s1,s2);
524 const char *alphabet=
"abcdefghijklmnopqrstuvwxyz";
526 std::string s(alphabet);
531 CPPUNIT_ASSERT_EQUAL(ref,b);
537 CPPUNIT_ASSERT_EQUAL(ref,b);
543 CPPUNIT_ASSERT_EQUAL(ref,b);
549 CPPUNIT_ASSERT_EQUAL(ref,b);
555 CPPUNIT_ASSERT_EQUAL(ref,b);
561 CPPUNIT_ASSERT_EQUAL(ref,b);
567 CPPUNIT_ASSERT_EQUAL(ref,b);
573 CPPUNIT_ASSERT_EQUAL(ref,b);
580 SBuf s1(
"complete string");
583 CPPUNIT_ASSERT_EQUAL(
s1,s2);
584 s2.
assign(
" complete string ,");
586 CPPUNIT_ASSERT_EQUAL(
s1,s2);
587 s1.assign(
", complete string ,");
590 CPPUNIT_ASSERT_EQUAL(
s1,s2);
601 CPPUNIT_ASSERT_EQUAL(ref,
sb);
620 CPPUNIT_ASSERT_EQUAL(s2,s3);
622 CPPUNIT_ASSERT_EQUAL(
s1,s2);
629 const char *alphabet=
"abcdefghijklmnopqrstuvwxyz";
637 CPPUNIT_ASSERT_EQUAL(3U,idx);
638 CPPUNIT_ASSERT_EQUAL(
'd',
s1[idx]);
642 CPPUNIT_ASSERT_EQUAL(nposResult,idx);
646 CPPUNIT_ASSERT_EQUAL(4U,idx);
650 CPPUNIT_ASSERT_EQUAL(nposResult,idx);
654 CPPUNIT_ASSERT_EQUAL(nposResult,idx);
657 idx=
s1.find(
'd',
s1.length()+1);
658 CPPUNIT_ASSERT_EQUAL(nposResult,idx);
663 CPPUNIT_ASSERT_EQUAL(3U, idx);
664 CPPUNIT_ASSERT_EQUAL(
'd',
s1[idx]);
668 CPPUNIT_ASSERT_EQUAL(nposResult,idx);
672 CPPUNIT_ASSERT_EQUAL(4U,idx);
676 CPPUNIT_ASSERT_EQUAL(nposResult,idx);
679 idx=
s1.rfind(
'd',
s1.length()+1);
680 CPPUNIT_ASSERT_EQUAL(3U,idx);
686 const char *alphabet=
"abcdefghijklmnopqrstuvwxyz";
687 SBuf haystack(alphabet);
694 CPPUNIT_ASSERT_EQUAL(3U,idx);
697 CPPUNIT_ASSERT_EQUAL(23U,idx);
701 CPPUNIT_ASSERT_EQUAL(nposResult, idx);
705 CPPUNIT_ASSERT_EQUAL(nposResult, idx);
709 CPPUNIT_ASSERT_EQUAL(nposResult, idx);
713 CPPUNIT_ASSERT_EQUAL(nposResult, idx);
717 CPPUNIT_ASSERT_EQUAL(nposResult, idx);
721 CPPUNIT_ASSERT_EQUAL(nposResult, idx);
725 CPPUNIT_ASSERT_EQUAL(nposResult, idx);
733 CPPUNIT_ASSERT_EQUAL(3U,idx);
736 CPPUNIT_ASSERT_EQUAL(23U,idx);
742 CPPUNIT_ASSERT_EQUAL(3U,idx);
745 CPPUNIT_ASSERT_EQUAL(23U,idx);
749 CPPUNIT_ASSERT_EQUAL(nposResult, idx);
753 CPPUNIT_ASSERT_EQUAL(nposResult, idx);
757 CPPUNIT_ASSERT_EQUAL(nposResult, idx);
761 CPPUNIT_ASSERT_EQUAL(3U, idx);
765 CPPUNIT_ASSERT_EQUAL(nposResult, idx);
769 CPPUNIT_ASSERT_EQUAL(3U, idx);
773 CPPUNIT_ASSERT_EQUAL(3U, idx);
777 CPPUNIT_ASSERT_EQUAL(nposResult, idx);
785 CPPUNIT_ASSERT_EQUAL(29U,idx);
788 CPPUNIT_ASSERT_EQUAL(23U,idx);
798 CPPUNIT_ASSERT_EQUAL(40U,idx);
799 CPPUNIT_ASSERT_EQUAL(
' ',
s1[idx]);
806 SBuf goobar(
"goobar");
810 idx=haystack.rfind(
SBuf(
""));
811 CPPUNIT_ASSERT_EQUAL(haystack.length(),idx);
817 idx=haystack.rfind(
SBuf(
"fox"));
818 CPPUNIT_ASSERT_EQUAL(16U,idx);
825 idx=haystack.rfind(
SBuf(
"foe"));
829 idx=haystack.rfind(g);
830 CPPUNIT_ASSERT_EQUAL(43U,idx);
831 CPPUNIT_ASSERT_EQUAL(
'g',haystack[idx]);
833 idx=haystack.rfind(
SBuf(
"The"));
834 CPPUNIT_ASSERT_EQUAL(0U,idx);
836 haystack.append(
"The");
837 idx=haystack.rfind(
SBuf(
"The"));
838 CPPUNIT_ASSERT_EQUAL(44U,idx);
841 haystack=
"The quick brown fox";
842 SBuf needle(
"foxy lady");
843 idx=haystack.rfind(needle);
851 CPPUNIT_ASSERT_EQUAL(strlen(
fox),(
size_t)s.
length());
859 CPPUNIT_ASSERT_EQUAL(s.length(),s.copy(buf,40));
860 CPPUNIT_ASSERT_EQUAL(0,strncmp(s.rawContent(),buf,s.length()));
862 CPPUNIT_ASSERT_EQUAL(40U,s.copy(buf,40));
865 CPPUNIT_ASSERT_EQUAL(s2,s);
872 ref(
"the quick brown fox jumped over the lazy dog");
873 CPPUNIT_ASSERT_EQUAL(ref,sng);
890 CPPUNIT_ASSERT(
match!=ref);
894 CPPUNIT_ASSERT_EQUAL(ref,
match);
912 CPPUNIT_ASSERT_EQUAL(b.
length(),
static_cast<unsigned int>(0));
913 CPPUNIT_ASSERT_EQUAL(b.
spaceSize(), startLength);
919 auto x = b.
reserve(requirements);
921 CPPUNIT_ASSERT(x <= requirements.
maxCapacity - filled);
932 for (
const int delta: {-1,0,+1}) {
952 CPPUNIT_ASSERT(gap < buffer.
length());
953 const void *gapEnd = buffer.
rawContent() + gap;
955 CPPUNIT_ASSERT_EQUAL(gapEnd,
static_cast<const void*
>(buffer.
rawContent()));
958 const auto beforeSpaceSize = buffer.
spaceSize();
959 const void *
const beforePosition = buffer.
rawContent();
962 const void *
const afterPosition = buffer.
rawContent();
963 CPPUNIT_ASSERT_EQUAL(before.cowAvoided + 1, after.cowAvoided);
964 CPPUNIT_ASSERT_EQUAL(before.cowShift, after.cowShift);
965 CPPUNIT_ASSERT_EQUAL(before.cowJustAlloc, after.cowJustAlloc);
966 CPPUNIT_ASSERT_EQUAL(before.cowAllocCopy, after.cowAllocCopy);
967 CPPUNIT_ASSERT_EQUAL(beforeSpaceSize, buffer.
spaceSize());
968 CPPUNIT_ASSERT_EQUAL(beforePosition, afterPosition);
969 CPPUNIT_ASSERT(strcmp(
fox + gap, buffer.
c_str()) == 0);
978 const void *
const initialStorage = buffer.
rawContent();
982 CPPUNIT_ASSERT(gap < buffer.
length());
983 const void *gapEnd = buffer.
rawContent() + gap;
985 CPPUNIT_ASSERT_EQUAL(gapEnd,
static_cast<const void*
>(buffer.
rawContent()));
988 const auto beforeSpaceSize = buffer.
spaceSize();
991 const void *
const afterStorage = buffer.
rawContent();
992 CPPUNIT_ASSERT_EQUAL(before.cowAvoided, after.cowAvoided);
993 CPPUNIT_ASSERT_EQUAL(before.cowShift + 1, after.cowShift);
994 CPPUNIT_ASSERT_EQUAL(before.cowJustAlloc, after.cowJustAlloc);
995 CPPUNIT_ASSERT_EQUAL(before.cowAllocCopy, after.cowAllocCopy);
996 CPPUNIT_ASSERT_EQUAL(initialStorage, afterStorage);
997 CPPUNIT_ASSERT(beforeSpaceSize + gap <= buffer.
spaceSize());
998 CPPUNIT_ASSERT(strcmp(
fox + gap, buffer.
c_str()) == 0);
1007 const void *
const initialStorage = buffer.
rawContent();
1010 const auto gap = 2U;
1011 CPPUNIT_ASSERT(gap < buffer.
length());
1012 const void *gapEnd = buffer.
rawContent() + gap;
1014 CPPUNIT_ASSERT_EQUAL(gapEnd,
static_cast<const void*
>(buffer.
rawContent()));
1017 const auto beforeSpaceSize = buffer.
spaceSize();
1020 const void *
const afterStorage = buffer.
rawContent();
1021 CPPUNIT_ASSERT_EQUAL(before.cowAvoided, after.cowAvoided);
1022 CPPUNIT_ASSERT_EQUAL(before.cowShift + 1, after.cowShift);
1023 CPPUNIT_ASSERT_EQUAL(before.cowJustAlloc, after.cowJustAlloc);
1024 CPPUNIT_ASSERT_EQUAL(before.cowAllocCopy, after.cowAllocCopy);
1025 CPPUNIT_ASSERT_EQUAL(initialStorage, afterStorage);
1026 CPPUNIT_ASSERT(beforeSpaceSize + gap <= buffer.
spaceSize());
1027 CPPUNIT_ASSERT(strcmp(
fox + gap, buffer.
c_str()) == 0);
1034 static SBuf casebuf(
"THE QUICK");
1036 CPPUNIT_ASSERT(!
SBuf(
"The quick brown").startsWith(
SBuf(
fox1)));
1044 casebuf =
"tha quick";
1051 SBuf b(
"const.string, int 10 and a float 10.5");
1053 ss <<
"const.string, int " << 10 <<
" and a float " << 10.5;
1055 CPPUNIT_ASSERT_EQUAL(b,o);
1058 CPPUNIT_ASSERT_EQUAL(
SBuf(),o);
1063 CPPUNIT_ASSERT_EQUAL(f1,
SBuf(
fox1));
1078 CPPUNIT_ASSERT_EQUAL(0U,idx);
1082 CPPUNIT_ASSERT_EQUAL(haystack.
length()-1,idx);
1086 CPPUNIT_ASSERT_EQUAL(4U,idx);
1101 CPPUNIT_ASSERT_EQUAL(0U,idx);
1105 CPPUNIT_ASSERT_EQUAL(haystack.
length()-1,idx);
1109 CPPUNIT_ASSERT_EQUAL(3U,idx);
1122 const char *alphabet=
"abcdefghijklmnopqrstuvwxyz";
1123 std::string astr(alphabet);
1125 CPPUNIT_ASSERT_EQUAL(astr,
sb.toStdString());
1138 CPPUNIT_ASSERT_EQUAL(
'f', *i);
1139 CPPUNIT_ASSERT(i != e);
1141 CPPUNIT_ASSERT_EQUAL(
'o', *i);
1142 CPPUNIT_ASSERT(i != e);
1144 CPPUNIT_ASSERT_EQUAL(
'o', *i);
1145 CPPUNIT_ASSERT(i != e);
1147 CPPUNIT_ASSERT(i == e);
1152 CPPUNIT_ASSERT_EQUAL(
'o', *i);
1153 CPPUNIT_ASSERT(i != e);
1155 CPPUNIT_ASSERT_EQUAL(
'o', *i);
1156 CPPUNIT_ASSERT(i != e);
1158 CPPUNIT_ASSERT_EQUAL(
'f', *i);
1159 CPPUNIT_ASSERT(i != e);
1161 CPPUNIT_ASSERT(i == e);
1180 std::unordered_map<SBuf, int> um;
1181 um[
SBuf(
"one")] = 1;
1182 um[
SBuf(
"two")] = 2;
1184 auto i = um.find(
SBuf(
"one"));
1185 CPPUNIT_ASSERT(i != um.end());
1186 CPPUNIT_ASSERT(i->second == 1);
1188 i = um.find(
SBuf(
"eleventy"));
1189 CPPUNIT_ASSERT(i == um.end());
IcmpPinger control
pinger helper contains one of these as a global object.
SBuf ToUpper(SBuf buf)
Returns a lower-cased copy of its parameter.
SBuf ToLower(SBuf buf)
Returns an upper-cased copy of its parameter.
optimized set of C chars, with quick membership test and merge support
std::ostream & dump(std::ostream &os) const
dumps class-wide statistics
static const MemBlobStats & GetStats()
obtain a const view of class-wide statistics
int64_t endOffset() const
void run()
generates and executes cases using configuration params
Named SBuf::reserve() parameters. Defaults ask for and restrict nothing.
bool allowShared
whether sharing our storage with others is OK
size_type minSpace
allocate [at least this much] if spaceSize() is smaller
size_type maxCapacity
do not allocate more than this
size_type idealSpace
if allocating anyway, provide this much space
std::ostream & dump(std::ostream &os) const
Dump statistics to an ostream.
SBuf buf()
bytes written so far
SBufStream & clearBuf()
Clear the stream's backing store.
void performEqualityTest()
std::string fullReference
char * rawAppendStart(size_type anticipatedSize)
int caseCmp(const SBuf &S, const size_type n) const
shorthand version for case-insensitive compare()
const char * rawContent() const
static const size_type npos
char at(size_type pos) const
SBuf consume(size_type n=npos)
SBuf & chop(size_type pos, size_type n=npos)
void reserveCapacity(size_type minCapacity)
static const SBufStats & GetStats()
gets global statistic information
size_type length() const
Returns the number of bytes stored in SBuf.
size_type rfind(char c, size_type endPos=npos) const
size_type reserve(const SBufReservationRequirements &requirements)
int cmp(const SBuf &S, const size_type n) const
shorthand version for compare()
size_type findFirstNotOf(const CharacterSet &set, size_type startPos=0) const
SBuf & trim(const SBuf &toRemove, bool atBeginning=true, bool atEnd=true)
size_type spaceSize() const
size_type find(char c, size_type startPos=0) const
size_type findFirstOf(const CharacterSet &set, size_type startPos=0) const
const_iterator begin() const
SBuf & append(const SBuf &S)
const_reverse_iterator rbegin() const
void reserveSpace(size_type minSpace)
const_iterator end() const
bool startsWith(const SBuf &S, const SBufCaseSensitive isCaseSensitive=caseSensitive) const
SBuf substr(size_type pos, size_type n=npos) const
MemBlob::size_type size_type
void rawAppendFinish(const char *start, size_type actualSize)
SBuf & assign(const SBuf &S)
const_reverse_iterator rend() const
void setAt(size_type pos, char toset)
int compare(const SBuf &S, const SBufCaseSensitive isCaseSensitive, const size_type n) const
implements test program's main() function while enabling customization
int run(int argc, char *argv[])
CPPUNIT_TEST(testAutoFind)
CPPUNIT_TEST(testRFindChar)
CPPUNIT_TEST(testFindFirstNotOf)
void testSubscriptOpFail()
CPPUNIT_TEST(testAppendCString)
CPPUNIT_TEST(testConsume)
CPPUNIT_TEST(testFindFirstOf)
void testSBufConstructDestruct()
CPPUNIT_TEST(testSubscriptOp)
CPPUNIT_TEST(testAppendSBuf)
CPPUNIT_TEST_EXCEPTION(testSubscriptOpFail, TextException)
CPPUNIT_TEST(testFindChar)
CPPUNIT_TEST(testSBufHash)
CPPUNIT_TEST_SUITE(TestSBuf)
CPPUNIT_TEST(testStartsWith)
CPPUNIT_TEST(testIterators)
CPPUNIT_TEST(testReserve)
void testSBufConstructDestructAfterMemInit()
void testAppendStdString()
void testFindFirstNotOf()
CPPUNIT_TEST(testAppendf)
CPPUNIT_TEST(testStringOps)
CPPUNIT_TEST(testRFindSBuf)
CPPUNIT_TEST(testEqualityTest)
CPPUNIT_TEST(testSBufConstructDestruct)
CPPUNIT_TEST(testSBufLength)
CPPUNIT_TEST(testFindSBuf)
CPPUNIT_TEST(testRawSpace)
CPPUNIT_TEST(testSBufConstructDestructAfterMemInit)
CPPUNIT_TEST(testRawContent)
CPPUNIT_TEST(testStdStringOps)
CPPUNIT_TEST(testSBufStream)
CPPUNIT_TEST(testAppendStdString)
CPPUNIT_TEST(testComparisons)
an std::runtime_error with thrower location info
A const & min(A const &lhs, A const &rhs)
static bool match(const char *fn, const REList *list)
default hash functor to support std::unordered_map<SBuf,*>
int main(int argc, char *argv[])
void eventAdd(const char *, EVH *, void *, double, int, bool)
static void testComparisonStdFull(const char *left, const char *right)
CPPUNIT_TEST_SUITE_REGISTRATION(TestSBuf)
static void testComparisonStd(const char *s1, const char *s2)
SBuf literal("The quick brown fox jumped over the lazy dog")
static void testComparisonStdN(const char *left, const char *right, const size_t n)
static void testComparisonStdOneWay(const char *left, const char *right)
SBuf text("GET http://resource.com/path HTTP/1.1\r\n" "Host: resource.com\r\n" "Cookie: laijkpk3422r j1noin \r\n" "\r\n")
const CharacterSet alpha("alpha","abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")