Fixed/Renamed a test suite
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1916 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
8b5fd18249
commit
cc4d4cd541
55
src/tests/kits/support/bstring/StringAccessTest.cpp
Normal file
55
src/tests/kits/support/bstring/StringAccessTest.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
#include "StringAccessTest.h"
|
||||
#include "cppunit/TestCaller.h"
|
||||
#include <String.h>
|
||||
#include <UTF8.h>
|
||||
|
||||
StringAccessTest::StringAccessTest(std::string name) :
|
||||
BTestCase(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
StringAccessTest::~StringAccessTest()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StringAccessTest::PerformTest(void)
|
||||
{
|
||||
//CountChars(), Length(), String()
|
||||
NextSubTest();
|
||||
BString string("Something"B_UTF8_ELLIPSIS);
|
||||
CPPUNIT_ASSERT(string.CountChars() == 10);
|
||||
CPPUNIT_ASSERT(string.Length() == strlen(string.String());
|
||||
|
||||
NextSubTest();
|
||||
BString string2("ABCD");
|
||||
CPPUNIT_ASSERT(string2.CountChars() == 4);
|
||||
CPPUNIT_ASSERT(string2.Length() == strlen(string2.String());
|
||||
|
||||
NextSubTest();
|
||||
static char s[64];
|
||||
strcpy(s, B_UTF8_ELLIPSIS);
|
||||
strcat(s, B_UTF8_SMILING_FACE);
|
||||
BString string3(s);
|
||||
CPPUNIT_ASSERT(string3.CountChars() == 2);
|
||||
CPPUNIT_ASSERT(string3.Length() == strlen(string3.String());
|
||||
|
||||
NextSubTest();
|
||||
BString empty;
|
||||
CPPUNIT_ASSERT(empty.String() == NULL);
|
||||
CPPUNIT_ASSERT(empty.Length() == 0);
|
||||
CPPUNIT_ASSERT(empty.CountChars() == 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
CppUnit::Test *StringAccessTest::suite(void)
|
||||
{
|
||||
typedef CppUnit::TestCaller<StringAccessTest>
|
||||
StringAccessTestCaller;
|
||||
|
||||
return(new StringAccessTestCaller("BString::Access Test", &StringAccessTest::PerformTest));
|
||||
}
|
22
src/tests/kits/support/bstring/StringAccessTest.h
Normal file
22
src/tests/kits/support/bstring/StringAccessTest.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef StringAccessTest_H
|
||||
#define StringAccessTest_H
|
||||
|
||||
#include "TestCase.h"
|
||||
#include <String.h>
|
||||
|
||||
|
||||
class StringAccessTest : public BTestCase
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
protected:
|
||||
|
||||
public:
|
||||
static Test *suite(void);
|
||||
void PerformTest(void);
|
||||
StringAccessTest(std::string name = "");
|
||||
virtual ~StringAccessTest();
|
||||
};
|
||||
|
||||
#endif
|
@ -1,45 +0,0 @@
|
||||
#include "StringCountCharTest.h"
|
||||
#include "cppunit/TestCaller.h"
|
||||
#include <String.h>
|
||||
#include <UTF8.h>
|
||||
|
||||
StringCountCharTest::StringCountCharTest(std::string name) :
|
||||
BTestCase(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
StringCountCharTest::~StringCountCharTest()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StringCountCharTest::PerformTest(void)
|
||||
{
|
||||
//CountChars()
|
||||
NextSubTest();
|
||||
BString string("Something"B_UTF8_ELLIPSIS);
|
||||
CPPUNIT_ASSERT(string.CountChars() == 10);
|
||||
|
||||
NextSubTest();
|
||||
BString string2("ABCD");
|
||||
CPPUNIT_ASSERT(string2.CountChars() == 4);
|
||||
|
||||
NextSubTest();
|
||||
static char s[64];
|
||||
strcpy(s, B_UTF8_ELLIPSIS);
|
||||
strcat(s, B_UTF8_SMILING_FACE);
|
||||
BString string3(s);
|
||||
CPPUNIT_ASSERT(string3.CountChars() == 2);
|
||||
}
|
||||
|
||||
|
||||
CppUnit::Test *StringCountCharTest::suite(void)
|
||||
{
|
||||
typedef CppUnit::TestCaller<StringCountCharTest>
|
||||
StringCountCharTestCaller;
|
||||
|
||||
return(new StringCountCharTestCaller("BString::CountChar Test", &StringCountCharTest::PerformTest));
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
#ifndef StringCountCharTest_H
|
||||
#define StringCountCharTest_H
|
||||
|
||||
#include "TestCase.h"
|
||||
#include <String.h>
|
||||
|
||||
|
||||
class StringCountCharTest : public BTestCase
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
protected:
|
||||
|
||||
public:
|
||||
static Test *suite(void);
|
||||
void PerformTest(void);
|
||||
StringCountCharTest(std::string name = "");
|
||||
virtual ~StringCountCharTest();
|
||||
};
|
||||
|
||||
#endif
|
@ -2,7 +2,7 @@
|
||||
#include "cppunit/TestSuite.h"
|
||||
#include "StringTest.h"
|
||||
#include "StringConstructionTest.h"
|
||||
#include "StringCountCharTest.h"
|
||||
#include "StringAccessTest.h"
|
||||
#include "StringAssignTest.h"
|
||||
#include "StringAppendTest.h"
|
||||
#include "StringSubCopyTest.h"
|
||||
@ -22,7 +22,7 @@ CppUnit::Test *StringTestSuite()
|
||||
CppUnit::TestSuite *testSuite = new CppUnit::TestSuite();
|
||||
|
||||
testSuite->addTest(StringConstructionTest::suite());
|
||||
testSuite->addTest(StringCountCharTest::suite());
|
||||
testSuite->addTest(StringAccessTest::suite());
|
||||
testSuite->addTest(StringAssignTest::suite());
|
||||
testSuite->addTest(StringAppendTest::suite());
|
||||
testSuite->addTest(StringSubCopyTest::suite());
|
||||
|
Loading…
Reference in New Issue
Block a user