ICU-1880 added TestDataDriver::utoi - gets an int from UnicodeString

X-SVN-Rev: 8587
This commit is contained in:
Vladimir Weinstein 2002-05-10 04:42:51 +00:00
parent 8675a148e2
commit 6a1182c921
2 changed files with 17 additions and 0 deletions

View File

@ -9,6 +9,8 @@
#include "tedadrvr.h"
#include "resbtddr.h"
#include <stdlib.h>
TestDataDriver *TestDataDriver::createTestInstance(const char *testName, UErrorCode &status) {
if(U_FAILURE(status)) {
@ -37,3 +39,13 @@ TestDataDriver::countTests(void)
{
return fNumberOfTests;
}
int32_t
TestDataDriver::utoi(const UnicodeString &s)
{
char ch[256];
const UChar *u = s.getBuffer();
int32_t len = s.length();
u_UCharsToChars(u, ch, len);
return atoi(ch);
}

View File

@ -80,6 +80,11 @@ public:
// Gets the next test case
virtual int32_t getNextTestCase(UnicodeString * testCase, int32_t capacity, UErrorCode &status) = 0;
public:
// utilities
static int32_t utoi(const UnicodeString &s);
protected:
const char* fTestName;
int32_t fNumberOfTests;