ICU-1880 added TestDataDriver::utoi - gets an int from UnicodeString
X-SVN-Rev: 8587
This commit is contained in:
parent
8675a148e2
commit
6a1182c921
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user