Some more tests.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2685 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2003-02-11 19:14:05 +00:00
parent 4b883396bd
commit 4db3797f17
3 changed files with 20 additions and 4 deletions

View File

@ -76,6 +76,15 @@ StringAccessTest::PerformTest(void)
strcat(ptr, "pippo");
emptylocked.UnlockBuffer();
CPPUNIT_ASSERT(strcmp(emptylocked.String(), "pippo") == 0);
// LockBuffer(0) and UnlockBuffer(-1) on a zero lenght string
#ifndef TEST_R5
NextSubTest();
BString crashesR5;
ptr = crashesR5.LockBuffer(0);
crashesR5.UnlockBuffer(-1);
CPPUNIT_ASSERT(strcmp(crashesR5.String(), "") == 0);
#endif
}

View File

@ -203,13 +203,14 @@ StringReplaceTest::PerformTest(void)
delete str1;
//&IReplaceLast(const char*, const char*)
#ifndef TEST_R5
NextSubTest();
str1 = new BString("she sells sea shells on the SEashore");
str1->IReplaceLast("sea", "the");
CPPUNIT_ASSERT(strcmp(str1->String(),
"she sells sea shells on the theshore") == 0);
delete str1;
#endif
NextSubTest();
str1 = new BString("she sells sea shells on the seashore");
str1->IReplaceLast("tex", "the");
@ -252,12 +253,14 @@ StringReplaceTest::PerformTest(void)
CPPUNIT_ASSERT(strcmp(str1->String(), "ccccccccccccccc") == 0);
delete str1;
#ifndef TEST_R5
//ReplaceSet(const char*, const char*)
NextSubTest();
str1 = new BString("abcd abcd abcd");
str1->ReplaceSet("ad", "da");
CPPUNIT_ASSERT(strcmp(str1->String(), "dabcda dabcda dabcda") == 0);
delete str1;
#endif
}

View File

@ -407,12 +407,14 @@ StringSearchTest::PerformTest(void)
i = string1->IFindLast("st");
CPPUNIT_ASSERT(i == 16);
delete string1;
#ifndef TEST_R5
NextSubTest();
string1 = new BString("laSt but NOT leaSt");
i = string1->IFindLast("ST");
CPPUNIT_ASSERT(i == 16);
delete string1;
#endif
NextSubTest();
string1 = new BString;
@ -455,18 +457,20 @@ StringSearchTest::PerformTest(void)
delete string2;
//IFindLast(const char*, int32)
//#ifndef TEST_R5
NextSubTest();
string1 = new BString("abc abc abc");
i = string1->IFindLast("abc", 9);
CPPUNIT_ASSERT(i == 4);
delete string1;
//#endif
#ifndef TEST_R5
NextSubTest();
string1 = new BString("ABc abC aBC");
i = string1->IFindLast("aBc", 9);
CPPUNIT_ASSERT(i == 4);
delete string1;
#endif
NextSubTest();
string1 = new BString("abc abc abc");
i = string1->IFindLast("abc", -10);