summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorDavid Ostrovsky <david@ostrovsky.org>2013-06-17 22:38:34 +0200
committerNoel Power <noel.power@suse.com>2013-06-19 10:07:41 +0000
commit2e963d0510aacf2d5e59a7604c106bae7a928921 (patch)
treec60afb7837575c1b1109369040a0b74774c82735 /sal
parent0d5a2d2284addd5d161ca7bb30a354d268c2600a (diff)
Delete unused sal tests
Change-Id: Iba1eeb8d8fd0582f216b7552dc9ae21b69e66b4e Reviewed-on: https://gerrit.libreoffice.org/4326 Reviewed-by: Noel Power <noel.power@suse.com> Tested-by: Noel Power <noel.power@suse.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/qa/rtl_strings/export.exp1
-rw-r--r--sal/qa/rtl_strings/readme.txt20
-rw-r--r--sal/qa/rtl_strings/rtl_OString.cxx3263
-rw-r--r--sal/qa/rtl_strings/rtl_OUString.cxx3377
-rw-r--r--sal/qa/rtl_strings/rtl_OUStringBuffer.cxx1520
-rw-r--r--sal/qa/rtl_strings/rtl_String_Const.h812
-rw-r--r--sal/qa/rtl_strings/rtl_String_Utils.cxx164
-rw-r--r--sal/qa/rtl_strings/rtl_String_Utils.hxx65
-rw-r--r--sal/qa/rtl_strings/rtl_String_Utils_Const.h47
-rw-r--r--sal/qa/rtl_strings/rtl_old_testostring.cxx234
-rw-r--r--sal/qa/rtl_strings/rtl_old_testowstring.cxx303
-rw-r--r--sal/qa/rtl_strings/rtl_old_teststrbuf.cxx232
12 files changed, 0 insertions, 10038 deletions
diff --git a/sal/qa/rtl_strings/export.exp b/sal/qa/rtl_strings/export.exp
deleted file mode 100644
index a13529da5876..000000000000
--- a/sal/qa/rtl_strings/export.exp
+++ /dev/null
@@ -1 +0,0 @@
-registerAllTestFunction
diff --git a/sal/qa/rtl_strings/readme.txt b/sal/qa/rtl_strings/readme.txt
deleted file mode 100644
index 388c98751e8d..000000000000
--- a/sal/qa/rtl_strings/readme.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-This is the old test implemantation of rtl::XString.
-If you want to write new or better tests:
-Identify the test function in the source and remark it.
-
-The best way to remark old tests, go to the end of the source code and remark
-only the test_rtl_<X>String_<function>(hRtlTestResult); so the test will not
-executed any longer.
-
-There are already some new tests for rtl::XString, take a look into the
-directory sal/qa/rtl/ostring or sal/qa/rtl/oustring, where are some
-replacements added.
-
-
-Any other Questions?
-
-Do not hesitate to contact me at 'lla<at>openoffice.org'.
-
-best regards,
-Lars
-
diff --git a/sal/qa/rtl_strings/rtl_OString.cxx b/sal/qa/rtl_strings/rtl_OString.cxx
deleted file mode 100644
index 1934f0625248..000000000000
--- a/sal/qa/rtl_strings/rtl_OString.cxx
+++ /dev/null
@@ -1,3263 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <string.h>
-#include <sal/types.h>
-#include <testshl/tresstatewrapper.hxx>
-#include <rtl/string.hxx>
-#include <rtl_String_Const.h>
-#include <rtl_String_Utils.hxx>
-#include <rtl/ustring.h>
-
-using ::rtl::OString;
-//------------------------------------------------------------------------
-// test classes
-//------------------------------------------------------------------------
-const int MAXBUFLENGTH = 255;
-//------------------------------------------------------------------------
-// helper functions
-//------------------------------------------------------------------------
-
-static void unused()
-{
- test_ini_uString();
- (void)inputChar;
- (void)input1StrDefault;
- (void)input1StrNormal;
- (void)input1StrLastDefault;
- (void)input1StrLastNormal;
- unused();
-}
-
-//------------------------------------------------------------------------
-// testing constructors
-//------------------------------------------------------------------------
-static sal_Bool test_rtl_OString_ctor_001( hTestResult hRtlTestResult )
-{
- ::rtl::OString aStr;
- rtl_String* pData = aStr.pData;
-
-
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- pData->length == 0 &&
- ! *pData->buffer,
- "New OString containing no characters",
- "ctor_001"
- )
- );
-}
-
-//------------------------------------------------------------------------
-
-static sal_Bool SAL_CALL test_rtl_OString_ctor_002(
- hTestResult hRtlTestResult )
-{
- ::rtl::OString aStr(kTestStr1);
- rtl_String* pData = aStr.pData;
-
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- pData->refCount == 1 &&
- pData->length == kTestStr1Len &&
- cmpstr( (const sal_Char*)pData->buffer, kTestStr1, kTestStr1Len ),
- "New OString from a character buffer array",
- "ctor_002"
- )
- );
-}
-//------------------------------------------------------------------------
-
-static sal_Bool SAL_CALL test_rtl_OString_ctor_003(
- hTestResult hRtlTestResult )
-{
- ::rtl::OString aStr(kTestStr2, kTestStr1Len);
- rtl_String* pData = aStr.pData;
-
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- pData->refCount == 1 &&
- pData->length == kTestStr1Len &&
- cmpstr( (const sal_Char*)pData->buffer, kTestStr2, kTestStr1Len ),
- "New OString from the first n chars of ascii string",
- "ctor_003"
- )
- );
-}
-
-//------------------------------------------------------------------------
-
-static sal_Bool SAL_CALL test_rtl_OString_ctor_004(
- hTestResult hRtlTestResult)
-{
- ::rtl::OString aStr1(kTestStr1);
- ::rtl::OString aStr2(aStr1);
- rtl_String* pData1 = aStr1.pData;
- rtl_String* pData2 = aStr2.pData;
-
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- pData1->refCount == pData2->refCount &&
- pData1->length == kTestStr1Len &&
- pData1->buffer == pData2->buffer,
- "New OString from an OString",
- "ctor_004"
- )
- );
-}
-//------------------------------------------------------------------------
-
-static sal_Bool test_rtl_OString_ctor_005( hTestResult hRtlTestResult )
-{
- rtl_String *aStr1 = NULL;
-
- rtl_string_newFromStr( &aStr1, kTestStr1 );
-
- if ( aStr1 != NULL )
- {
- ::rtl::OString aStr2(aStr1);
- rtl_String* pData2 = aStr2.pData;
-
- sal_Bool bOK = c_rtl_tres_state
- (
- hRtlTestResult,
- aStr1->refCount == pData2->refCount &&
- pData2->length == kTestStr1Len &&
- aStr1->buffer == pData2->buffer,
- "new OString from a RTL String",
- "ctor_005"
- );
-
- rtl_string_release( aStr1 );
- aStr1 = NULL;
- return ( bOK );
- }
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- sal_False,
- "copying an ascii string to a RTL String!",
- "ctor_005"
- )
- );
-}
-
-//------------------------------------------------------------------------
-
-static sal_Bool test_rtl_OString_ctor_006( hTestResult hRtlTestResult )
-{
-
- sal_Unicode aStr1[kTestStr1Len+1];
-
- if ( AStringToUStringNCopy( aStr1, kTestStr1, kTestStr1Len ) )
- {
- if ( AStringToUStringNCompare( aStr1, kTestStr1, kTestStr1Len ) == 0 )
- {
- // const sal_Char *kTCMessage[2] = { "", "array." };
-
- ::rtl::OString aStr2
- (
- aStr1,
- kTestStr1Len,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOUStringToOString
- );
-
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- aStr2 == kTestStr1,
- "new OString from a unicode character buffer",
- "ctor_006"
- )
- );
- } /// end if AStringToUStringNCompare
-
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- sal_False,
- "compare ascii string with unicode string!",
- "ctor_006"
- )
- );
- } /// end if AStringToUStringNCopy
-
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- sal_False,
- "copy ascii string to unicode string!",
- "ctor_006"
- )
- );
-}
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_ctors(
- hTestResult hRtlTestResult )
-{
-
- c_rtl_tres_state_start(hRtlTestResult, "ctor");
- sal_Bool bTSState = test_rtl_OString_ctor_001( hRtlTestResult );
-
- bTSState &= test_rtl_OString_ctor_002( hRtlTestResult);
- bTSState &= test_rtl_OString_ctor_003( hRtlTestResult);
- bTSState &= test_rtl_OString_ctor_004( hRtlTestResult);
- bTSState &= test_rtl_OString_ctor_005( hRtlTestResult);
- bTSState &= test_rtl_OString_ctor_006( hRtlTestResult);
-
- c_rtl_tres_state_end(hRtlTestResult, "ctor");
-
-// return( bTSState );
-}
-
-
-
-//------------------------------------------------------------------------
-// testing the method getLength
-//------------------------------------------------------------------------
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_getLength(
- hTestResult hRtlTestResult)
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- c_rtl_tres_state_start(hRtlTestResult, "getLength");
-
-typedef struct TestCase
-{
- sal_Char* comments;
- sal_Int32 expVal;
- OString* input;
- ~TestCase() { delete input;}
-} TestCase;
-
-TestCase arrTestCase[]={
-
- {"length of ascii string", kTestStr1Len, new OString(kTestStr1)},
- {"length of ascci string of size 1", 1, new OString("1")},
- {"length of empty string (default constructor)", 0, new OString()},
- {"length of empty string (empty ascii string arg)",0,new OString("")},
- {"length of empty string (string arg = '\\0')",0,new OString("\0")}
- };
-
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Int32 length = arrTestCase[i].input->getLength();
- sal_Bool lastRes = (length == arrTestCase[i].expVal);
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "getLength", i )
-
- );
- res &= lastRes;
- }
- c_rtl_tres_state_end(hRtlTestResult, "getLength");
-// return ( res );
-}
-
-
-
-//------------------------------------------------------------------------
-// testing the method equals( const OString & aStr )
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_equals(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- c_rtl_tres_state_start(hRtlTestResult, "equals");
-
- typedef struct TestCase
-{
- sal_Char* comments;
- sal_Bool expVal;
- OString* input1;
- OString* input2;
- ~TestCase() { delete input1;delete input2;}
-} TestCase;
-
-TestCase arrTestCase[]={
-
- {"same size", sal_True, new OString(kTestStr1),new OString(kTestStr1)},
- {"different size", sal_False, new OString(kTestStr1),
- new OString(kTestStr2)},
- {"same size, no case match", sal_False, new OString(kTestStr1),
- new OString(kTestStr3)},
- {"two empty strings(def. constructor)", sal_True, new OString(),
- new OString()},
- {"empty(def.constructor) and non empty", sal_False, new OString(),
- new OString(kTestStr2)},
- {"non empty and empty(def. constructor)", sal_False,
- new OString(kTestStr1),new OString()},
- {"two empty strings(string arg = \"\")", sal_True,
- new OString(""),new OString("")},
- {"empty(string arg = \"\") and non empty", sal_False,
- new OString(""),new OString(kTestStr2)},
- {"non empty and empty(string arg = \"\")", sal_False,
- new OString(kTestStr1),new OString("")}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Bool lastRes =
- ( arrTestCase[i].input1->equals(*(arrTestCase[i].input2)) ==
- arrTestCase[i].expVal );
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "equals", i )
- );
-
- res &= lastRes;
- }
- c_rtl_tres_state_end(hRtlTestResult, "equals");
-// return (res);
-}
-
-//------------------------------------------------------------------------
-// testing the method equalsIgnoreAsciiCase( const OString & aStr )
-//------------------------------------------------------------------------
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_equalsIgnoreAsciiCase(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- c_rtl_tres_state_start(hRtlTestResult, "equalsIgnoreAsciiCase");
- typedef struct TestCase
-{
- sal_Char* comments;
- sal_Bool expVal;
- OString* input1;
- OString* input2;
- ~TestCase() { delete input1;delete input2;}
-} TestCase;
-
-TestCase arrTestCase[]={
- {"same strings but different cases",sal_True,new OString(kTestStr4),
- new OString(kTestStr5)},
- {"same strings",sal_True,new OString(kTestStr4),
- new OString(kTestStr4)},
- {"with equal beginning",sal_False,new OString(kTestStr2),
- new OString(kTestStr4)},
- {"empty(def.constructor) and non empty",sal_False,new OString(),
- new OString(kTestStr5)},
- {"non empty and empty(def.constructor)",sal_False,
- new OString(kTestStr4), new OString()},
- {"two empty strings(def.constructor)",sal_True,new OString(),
- new OString()},
- {"different strings with equal length",sal_False,
- new OString(kTestStr10), new OString(kTestStr11)}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Bool lastRes =
- (arrTestCase[i].input1->equalsIgnoreAsciiCase(*arrTestCase[i].input2)
- == arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "equalsIgnoreAsciiCase", i )
- );
-
- res &= lastRes;
- }
- c_rtl_tres_state_end(hRtlTestResult, "equalsIgnoreAsciiCase");
-
-// return (res);
-}
-
-static sal_Bool SAL_CALL test_rtl_OString_compareTo_001(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
-{
- sal_Char* comments;
- sal_Int32 expVal;
- OString* input1;
- OString* input2;
- ~TestCase() { delete input1;delete input2;}
-} TestCase;
-
-TestCase arrTestCase[]={
-
- {"simple compare, str1 to str5",-1,new OString(kTestStr1),
- new OString(kTestStr5)},
- {"simple compare, str2 to str5",-1,new OString(kTestStr2),
- new OString(kTestStr5)},
- {"simple compare, str1 to str9",-1,new OString(kTestStr1),
- new OString(kTestStr9)},
- {"simple compare, str1 to str2",-1,new OString(kTestStr1),
- new OString(kTestStr2)},
- {"simple compare, str4 to str5",-1,new OString(kTestStr4),
- new OString(kTestStr5)},
- {"simple compare, str1 to str3",-1,new OString(kTestStr1),
- new OString(kTestStr3)},
- {"simple compare, str5 to str1",+1,new OString(kTestStr5),
- new OString(kTestStr1)},
- {"simple compare, str2 to str1",+1,new OString(kTestStr2),
- new OString(kTestStr1)},
- {"simple compare, str9 to str5",+1,new OString(kTestStr9),
- new OString(kTestStr5)},
- {"simple compare, str5 to str4",+1,new OString(kTestStr5),
- new OString(kTestStr4)},
- {"simple compare, str1 to str1",0,new OString(kTestStr1),
- new OString(kTestStr1)},
- {"simple compare, nullString to nullString",0,new OString(),
- new OString()},
- {"simple compare, nullString to str2",-1,new OString(),
- new OString(kTestStr2)},
- {"simple compare, str1 to nullString",+1,new OString(kTestStr1),
- new OString()}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Int32 cmpRes =
- arrTestCase[i].input1->compareTo(*arrTestCase[i].input2);
- cmpRes = ( cmpRes == 0 ) ? 0 : ( cmpRes > 0 ) ? +1 : -1 ;
- sal_Bool lastRes = ( cmpRes == arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "compareTo(const OString&)", i )
- );
-
- res &= lastRes;
- }
-
- return (res);
-}
-
-
-//------------------------------------------------------------------------
-// testing the method compareTo( const OString & rObj, sal_Int32 length )
-//------------------------------------------------------------------------
-static sal_Bool SAL_CALL test_rtl_OString_compareTo_002(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Int32 expVal;
- sal_Int32 maxLength;
- OString* input1;
- OString* input2;
- ~TestCase() { delete input1;delete input2;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"compare with maxlength, str1 to str9, 16",-1,16,
- new OString(kTestStr1), new OString(kTestStr9)},
- {"compare with maxlength, str2 to str9, 32",-1,32,
- new OString(kTestStr2), new OString(kTestStr9)},
- {"compare with maxlength, str9 to str4, 16",+1,16,
- new OString(kTestStr9), new OString(kTestStr4)},
- {"compare with maxlength, str9 to str22, 32",+1,32,
- new OString(kTestStr9), new OString(kTestStr22)},
- {"compare with maxlength, str9 to str5, 16",0,16,
- new OString(kTestStr9), new OString(kTestStr5)},
- {"compare with maxlength, str9 to str9, 32",0,32,
- new OString(kTestStr9), new OString(kTestStr9)},
- {"compare with maxlength, str1 to str2, 32",-1,32,
- new OString(kTestStr1), new OString(kTestStr2)},
- {"compare with maxlength, str1 to str2, 32",-1,32,
- new OString(kTestStr1), new OString(kTestStr2)}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Int32 cmpRes =
- arrTestCase[i].input1->compareTo(*arrTestCase[i].input2,
- arrTestCase[i].maxLength);
- cmpRes = (cmpRes == 0) ? 0 : (cmpRes > 0) ? +1 : -1 ;
- sal_Bool lastRes = (cmpRes == arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "compareTo(const OString&, sal_Int32)", i )
- );
-
- res &= lastRes;
- }
-
- return (res);
-}
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_compareTo(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start(hRtlTestResult, "compareTo");
- sal_Bool res = test_rtl_OString_compareTo_001(hRtlTestResult);
- res &= test_rtl_OString_compareTo_002(hRtlTestResult);
- c_rtl_tres_state_end(hRtlTestResult, "compareTo");
-// return (res);
-}
-
-//------------------------------------------------------------------------
-// testing the operator == ( const OString& rStr1, const OString& rStr2 )
-// testing the operator == ( const OString& rStr1, const sal_Char *rStr2 )
-// testing the operator == ( const sal_Char *rStr1, const OString& rStr2 )
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_op_cmp(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start(hRtlTestResult, "op_cmp");
- const sal_Int16 NCASES = 7;
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
- const sal_Char *arrOStr[NCASES][2] =
- {
- {kTestStr1, kTestStr1},
- {kTestStr1, kTestStr3},
- {kTestStr1, kTestStr2},
- {0, 0},
- {0, kTestStr2},
- {kTestStr1, 0},
- {"", ""}
- };
-
- sal_Bool arrExpVal[NCASES] =
- {
- sal_True,
- sal_False,
- sal_False,
- sal_True,
- sal_False,
- sal_False,
- sal_True
- };
-
- sal_Char *arrComments[NCASES] =
- {
- "'Sun Microsystems'=='Sun Microsystems'",
- "!('Sun Microsystems'=='Sun microsystems')",
- "!('Sun Microsystems'=='Sun Microsystems Java Technology')",
- "two empty strings(def.constructor)",
- "!(empty string=='Sun Microsystems Java Technology')",
- "!('Sun Microsystems Java Technology'==empty string)",
- "''==''"
- };
-
- sal_Bool res = sal_True;
- sal_Int32 i;
-
- for(i = 0; i < NCASES; i++)
- {
- OString *str1, *str2;
- str1 = (arrOStr[i][0]) ? new OString(arrOStr[i][0]) : new OString() ;
- str2 = (arrOStr[i][1]) ? new OString(arrOStr[i][1]) : new OString() ;
-
- sal_Bool cmpRes = (*str1 == *str2);
- sal_Bool lastRes = (cmpRes == arrExpVal[i]);
- res &= lastRes;
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrComments[i],
- createName( pMeth, "operator ==(OString&, OString&)", i )
- );
-
- cmpRes = (*str1 == arrOStr[i][1]);
- lastRes = (cmpRes == arrExpVal[i]);
- res &= lastRes;
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrComments[i],
- createName( pMeth, "operator ==(OString&, sal_Char *)", i )
- );
-
- cmpRes = (arrOStr[i][0] == *str2);
- lastRes = (cmpRes == arrExpVal[i]);
- res &= lastRes;
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrComments[i],
- createName( pMeth, "operator ==(sal_Char *, OString&)", i )
- );
-
- delete str2;
- delete str1;
- }
-
- c_rtl_tres_state_end(hRtlTestResult, "op_cmp");
-// return ( res );
-}
-
-//------------------------------------------------------------------------
-// testing the operator != (const OString& rStr1, const OString& rStr2)
-// testing the operator != (const OString& rStr1, const sal_Char *rStr2)
-// testing the operator != (const sal_Char *rStr1, const OString& rStr2)
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_op_neq(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start(hRtlTestResult, "op_neq");
- const sal_Int16 NCASES = 6;
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- const sal_Char *arrOStr[NCASES][2] =
- {
- {kTestStr1, kTestStr3},
- {kTestStr1, kTestStr2},
- {kTestStr1, kTestStr1},
- {0, kTestStr2},
- {kTestStr1, 0},
- {0, 0}
- };
-
- sal_Bool arrExpVal[NCASES] =
- {
- sal_True,
- sal_True,
- sal_False,
- sal_True,
- sal_True,
- sal_False
- };
-
- sal_Char *arrComments[NCASES] =
- {
- "'Sun Microsystems'!='Sun microsystems'",
- "'Sun Microsystems'!='Sun Microsystems Java Technology'",
- "!('Sun Microsystems'!='Sun Microsystems')",
- "empty string!='Sun Microsystems Java Technology'",
- "'Sun Microsystems Java Technology'!=empty string", "!(''!='')"
- };
-
- sal_Bool res = sal_True;
- sal_Int32 i;
-
- for(i = 0; i < NCASES; i++)
- {
- OString *str1, *str2;
- str1 = (arrOStr[i][0]) ? new OString(arrOStr[i][0]) : new OString() ;
- str2 = (arrOStr[i][1]) ? new OString(arrOStr[i][1]) : new OString() ;
-
- sal_Bool cmpRes = (*str1 != *str2);
- sal_Bool lastRes = (cmpRes == arrExpVal[i]);
- res &= lastRes;
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrComments[i],
- createName( pMeth, "operator !=(OString&, OString&)", i )
- );
-
- cmpRes = (*str1 != arrOStr[i][1]);
- lastRes = (cmpRes == arrExpVal[i]);
- res &= lastRes;
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrComments[i],
- createName( pMeth, "operator !=(OString&, sal_Char *)", i )
- );
-
- cmpRes = (arrOStr[i][0] != *str2);
- lastRes = (cmpRes == arrExpVal[i]);
- res &= lastRes;
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrComments[i],
- createName( pMeth, "operator !=(sal_Char *, OString&)", i )
- );
-
- delete str2;
- delete str1;
- }
-
- c_rtl_tres_state_end(hRtlTestResult, "op_neq");
-// return ( res );
-}
-
-
-//------------------------------------------------------------------------
-// testing the operator > (const OString& rStr1, const OString& rStr2)
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_op_g(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- c_rtl_tres_state_start(hRtlTestResult, "op_g");
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Bool expVal;
- OString* input1;
- OString* input2;
- ~TestCase() { delete input1;delete input2;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- { "'Sun microsystems'>'Sun Microsystems'",sal_True,
- new OString(kTestStr3), new OString(kTestStr1)},
- {"!('Sun Microsystems'>'Sun microsystems')",sal_False,
- new OString(kTestStr1), new OString(kTestStr3)},
- {"'Sun Microsystems Java Technology'>'Sun Microsystems'",sal_True,
- new OString(kTestStr2), new OString(kTestStr1)},
- {"!('Sun Microsystems'>'Sun Microsystems Java Technology')",sal_False,
- new OString(kTestStr1), new OString(kTestStr2)},
- {"!('Sun Microsystems'>'Sun Microsystems'",sal_False,
- new OString(kTestStr1), new OString(kTestStr1)},
- {"'Sun Microsystems'>''",sal_True,new OString(kTestStr1),
- new OString()},
- {"!(''>'Sun Microsystems')",sal_False,new OString(),
- new OString(kTestStr1)},
- {"!(''>'')",sal_False,new OString(), new OString()}
-};
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Bool cmpRes = (*arrTestCase[i].input1 > *arrTestCase[i].input2);
- sal_Bool lastRes = (cmpRes == arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "operator >", i )
- );
-
- res &= lastRes;
-
- }
-
- c_rtl_tres_state_end(hRtlTestResult, "op_g");
-// return ( res );
-}
-
-//------------------------------------------------------------------------
-// testing the operator < (const OString& rStr1, const OString& rStr2)
-//------------------------------------------------------------------------
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_op_l(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- c_rtl_tres_state_start(hRtlTestResult, "op_l");
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Bool expVal;
- OString* input1;
- OString* input2;
- ~TestCase() { delete input1;delete input2;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"!('Sun microsystems'<'Sun Microsystems')",sal_False,
- new OString(kTestStr3), new OString(kTestStr1)},
- {"'Sun Microsystems'<'Sun microsystems'",sal_True,
- new OString(kTestStr1), new OString(kTestStr3)},
- {"'Sun Microsystems'<'Sun Microsystems Java Technology'",sal_True,
- new OString(kTestStr1), new OString(kTestStr2)},
- {"!('Sun Microsystems Java Technology'<'Sun Microsystems')",sal_False,
- new OString(kTestStr2), new OString(kTestStr1)},
- {"!('Sun Microsystems'<'Sun Microsystems'", sal_False,
- new OString(kTestStr1), new OString(kTestStr1)},
- {"'Sun Microsystems'<''",sal_False,new OString(kTestStr1),
- new OString()},
- {"''<'Sun Microsystems Java Technology'",sal_True,new OString(),
- new OString(kTestStr2)},
- {"!(''<'')",sal_False,new OString(), new OString()}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Bool cmpRes = (*arrTestCase[i].input1 < *arrTestCase[i].input2);
- sal_Bool lastRes = (cmpRes == arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "operator <", i )
- );
-
- res &= lastRes;
-
- }
-
- c_rtl_tres_state_end(hRtlTestResult, "op_l");
-// return ( res );
-}
-
-//------------------------------------------------------------------------
-// testing the operator >= (const OString& rStr1, const OString& rStr2)
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_op_ge(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- c_rtl_tres_state_start(hRtlTestResult, "op_ge");
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Bool expVal;
- OString* input1;
- OString* input2;
- ~TestCase() { delete input1;delete input2;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"'Sun microsystems'>='Sun Microsystems'",sal_True,
- new OString(kTestStr3), new OString(kTestStr1)},
- {"!('Sun Microsystems'>='Sun microsystems')",sal_False,
- new OString(kTestStr1), new OString(kTestStr3)},
- {"!('Sun Microsystems'>='Sun Microsystems Java Technology')",sal_False,
- new OString(kTestStr1), new OString(kTestStr2)},
- {"'Sun Microsystems Java Technology'>='Sun Microsystems'",sal_True,
- new OString(kTestStr2), new OString(kTestStr1)},
- {"'Sun Microsystems'>='Sun Microsystems'", sal_True,
- new OString(kTestStr1), new OString(kTestStr1)},
- {"'Sun Microsystems'>=''",sal_True,new OString(kTestStr1),
- new OString()},
- { "''>='Sun microsystems'",sal_False,new OString(),
- new OString(kTestStr3)},
- {"''>=''",sal_True,new OString(), new OString()}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Bool cmpRes = (*arrTestCase[i].input1 >= *arrTestCase[i].input2);
- sal_Bool lastRes = (cmpRes == arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "operator >=", i )
- );
-
- res &= lastRes;
-
- }
-
- c_rtl_tres_state_end(hRtlTestResult, "op_ge");
-// return ( res );
-}
-
-//------------------------------------------------------------------------
-// testing the operator <= (const OString& rStr1, const OString& rStr2)
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_op_le(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- c_rtl_tres_state_start(hRtlTestResult, "op_le");
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Bool expVal;
- OString* input1;
- OString* input2;
- ~TestCase() { delete input1;delete input2;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"!('Sun microsystems'<='Sun Microsystems')",sal_False,
- new OString(kTestStr3), new OString(kTestStr1)},
- {"'Sun Microsystems'<='Sun microsystems'",sal_True,
- new OString(kTestStr1), new OString(kTestStr3)},
- {"'Sun Microsystems'<='Sun Microsystems Java Technology'",sal_True,
- new OString(kTestStr1),
- new OString(kTestStr2)},
- {"!('Sun Microsystems Java Technology'<='Sun Microsystems')",sal_False,
- new OString(kTestStr2),
- new OString(kTestStr1)},
- {"!('Sun Microsystems'<='Sun Microsystems'", sal_True,
- new OString(kTestStr1), new OString(kTestStr1)},
- {"'Sun Microsystems'<=''",sal_False,new OString(kTestStr1),
- new OString()},
- {"''<='Sun Microsystems Java Technology'",sal_True,new OString(),
- new OString(kTestStr2)},
- {"!(''<='')",sal_True,new OString(), new OString()}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Bool cmpRes = (*arrTestCase[i].input1 <= *arrTestCase[i].input2);
- sal_Bool lastRes = (cmpRes == arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "operator <=", i )
- );
-
- res &= lastRes;
-
- }
-
- c_rtl_tres_state_end(hRtlTestResult, "op_le");
-// return ( res );
-}
-
-
-//------------------------------------------------------------------------
-// testing the operator =
-//------------------------------------------------------------------------
-static sal_Bool test_rtl_OString_op_eq_001( hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Bool expVal;
- OString* input1;
- OString* input2;
- ~TestCase() { delete input1;delete input2;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"'' = str1, str1 == str2",sal_True,new OString(kTestStr1),
- new OString()},
- {"str1 = str2, str1 == str2",sal_True,new OString(kTestStr1),
- new OString(kTestStr6)},
- {"str2 = '', str1 == str2",sal_True,new OString(),
- new OString(kTestStr2)},
- {"'' = '', str1 == str2",sal_True,new OString(),
- new OString()}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- *(arrTestCase[i].input1) = *(arrTestCase[i].input2);
-
- sal_Bool cmpRes =
- (*(arrTestCase[i].input1) == *(arrTestCase[i].input2));
- sal_Bool lastRes = (cmpRes == arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "operator =", i )
- );
-
- res &= lastRes;
- }
-
- return ( res );
-}
-
-static sal_Bool test_rtl_OString_op_eq_002(
- hTestResult hRtlTestResult )
-{
- ::rtl::OString aStr;
- aStr = OString(kTestStr1);
-
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- aStr == kTestStr1,
- "str = OString(\"%s\"), str == \"%s\"",
- "operator ="
- )
- );
-}
-
-static sal_Bool test_rtl_OString_op_eq_003(
- hTestResult hRtlTestResult )
-{
- sal_Bool bTCState = false;
-
- ::rtl::OString aStr1(kTestStr1);
- ::rtl::OString aStr2;
- ::rtl::OString aStr3;
-
- aStr3 = aStr2 = aStr1;
-
- bTCState = ( aStr1 == aStr2 )
- && ( aStr1 == aStr3 )
- && ( aStr2 == aStr3 );
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- bTCState,
- "str3=str2=str1,(str1 == str2)&&(str1 == str3)&&(str2 == str3)",
- "operator ="
- );
-
- return bTCState;
-}
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_op_eq(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start(hRtlTestResult, "op_eq");
- sal_Bool res = test_rtl_OString_op_eq_001( hRtlTestResult );
- res &= test_rtl_OString_op_eq_002( hRtlTestResult );
- res &= test_rtl_OString_op_eq_003( hRtlTestResult );
- c_rtl_tres_state_end(hRtlTestResult, "op_eq");
-
-// return ( res );
-}
-
-//------------------------------------------------------------------------
-// testing the operator +
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_op_plus(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- c_rtl_tres_state_start(hRtlTestResult, "op_plus");
- typedef struct TestCase
- {
- sal_Char* comments;
- OString* expVal;
- OString* input1;
- OString* input2;
- ~TestCase() { delete input1;delete input2; delete expVal;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"str1 = str7 + str8",new OString(kTestStr1),
- new OString(kTestStr7), new OString(kTestStr8)},
- {"str1 = str1 + '' ",new OString(kTestStr1),
- new OString(kTestStr1), new OString("")},
- {"str1 = '' + str1", new OString(kTestStr1),
- new OString(""), new OString(kTestStr1)},
- {" '' = '' + '' ", new OString(""),new OString(""),
- new OString("")},
- {"str1 = str1 + def.constr", new OString(kTestStr1),
- new OString(kTestStr1), new OString()},
- {" str1 = def.constr + str1 ",new OString(kTestStr1),
- new OString(), new OString(kTestStr1)},
- {" def.constr= def.constr + def.constr", new OString(),
- new OString(), new OString()}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- OString str = (*arrTestCase[i].input1) + (*arrTestCase[i].input2);
- sal_Bool lastRes = (str == *arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "operator +", i )
- );
-
- res &= lastRes;
-
- }
-
- c_rtl_tres_state_end(hRtlTestResult, "op_plus");
-// return ( res );
-}
-
-//------------------------------------------------------------------------
-// testing the operator +=
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_op_peq(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- c_rtl_tres_state_start(hRtlTestResult, "op_peq");
- typedef struct TestCase
- {
- sal_Char* comments;
- OString* expVal;
- OString* input1;
- OString* input2;
- ~TestCase() { delete input1;delete input2; delete expVal;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"str1 == (str7 += str8)",new OString(kTestStr1),
- new OString(kTestStr7), new OString(kTestStr8)},
- {"str1 == (str1 += '')",new OString(kTestStr1),
- new OString(kTestStr1), new OString("")},
- {"str1 == ('' += str1)", new OString(kTestStr1),
- new OString(""), new OString(kTestStr1)},
- {" '' == ('' += '')", new OString(""),
- new OString(""), new OString("")},
- {"str1 == (str1 += def.constr)", new OString(kTestStr1),
- new OString(kTestStr1), new OString()},
- {" str1 == (def.constr += str1)",new OString(kTestStr1),
- new OString(), new OString(kTestStr1)},
- {" def.constr== (def.constr += def.constr)",
- new OString(),new OString(), new OString()}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- { OString str;
- str += (*arrTestCase[i].input1); str += (*arrTestCase[i].input2);
- sal_Bool lastRes = (str == *arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "operator +", i )
- );
-
- res &= lastRes;
-
- }
-
- c_rtl_tres_state_end(hRtlTestResult, "op_peq");
-// return ( res );
-}
-
-//------------------------------------------------------------------------
-// testing the operator const sal_Char * (cscs for short)
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_op_cscs(
- hTestResult hRtlTestResult )
-{
-sal_Char methName[MAXBUFLENGTH];
-sal_Char* pMeth = methName;
-
- c_rtl_tres_state_start(hRtlTestResult, "op_cscs");
-typedef struct TestCase
- {
- sal_Char* comments;
- const sal_Char* expVal;
- sal_Int32 cmpLen;
- OString* input1;
- ~TestCase() { delete input1;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"test normal string",kTestStr1,kTestStr1Len,new OString(kTestStr1)},
- {"test empty string","",1,new OString()}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- const sal_Char* pstr = (*arrTestCase[i].input1);
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- cmpstr((sal_Char*)pstr,(sal_Char*)arrTestCase[i].expVal,
- arrTestCase[i].cmpLen),
- arrTestCase[i].comments,
- createName( pMeth, "const sal_Char*", i )
- );
- }
- c_rtl_tres_state_end(hRtlTestResult, "op_cscs");
-// return ( res );
-}
-
-
-//------------------------------------------------------------------------
-// testing the method getStr()
-//------------------------------------------------------------------------
-
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_getStr(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- c_rtl_tres_state_start(hRtlTestResult, "getStr");
- typedef struct TestCase
- {
- sal_Char* comments;
- const sal_Char* expVal;
- sal_Int32 cmpLen;
- OString* input1;
- ~TestCase() { delete input1;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"test normal string",kTestStr1,kTestStr1Len,new OString(kTestStr1)},
- {"test empty string","",0,new OString()}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- const sal_Char* pstr = arrTestCase[i].input1->getStr();
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- cmpstr(pstr, arrTestCase[i].expVal,
- arrTestCase[i].cmpLen),
- arrTestCase[i].comments,
- createName( pMeth, "getStr", i )
- );
- }
- c_rtl_tres_state_end(hRtlTestResult, "getStr");
-// return ( res );
-}
-
-
-
-//------------------------------------------------------------------------
-// testing the method copy( sal_Int32 beginIndex )
-//------------------------------------------------------------------------
-static sal_Bool SAL_CALL test_rtl_OString_copy_001(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- const sal_Char* srcStr;
- const sal_Char* arrExpStr;
- // string for comparing with result
- sal_Int32 beginIndex;
- // beginIndex for the method copy
- sal_Int32 lengthForCmp;
- // number of symbols for comparing
- // (if value is equal to 0 then pointers to buffers must be equal)
- sal_Int32 expLength;
- //expected length of the result string
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"beginIndex == 0 ( whole string )", kTestStr2,kTestStr2,
- 0, kTestStr2Len, kTestStr2Len},
- {"beginIndex == strlen-2 ( last two char )", kTestStr2,"gy",
- kTestStr2Len-2, 2, 2},
- {"beginIndex == strlen-1( last char )", kTestStr2, "y",
- kTestStr2Len-1, 1, 1}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i <(sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- OString src(arrTestCase[i].srcStr);
- OString dst;
- // rtl_String* pDataSrc = src.pData;
-
- dst = src.copy(arrTestCase[i].beginIndex);
-
- // rtl_String* pDataDst = dst.pData;
-
- sal_Bool lastRes;
-
- lastRes= (dst== arrTestCase[i].arrExpStr);
-
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth,
- "copy_001(beginIndex)(check buffer and length)", i )
- );
-
- res &= lastRes;
-
- }
-
- return (res);
-}
-
-
-//------------------------------------------------------------------------
-// testing the method copy( sal_Int32 beginIndex, sal_Int32 count )
-//------------------------------------------------------------------------
-static sal_Bool SAL_CALL test_rtl_OString_copy_002(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- const sal_Char* arrExpStr;
- sal_Int32 beginIndex;
- sal_Int32 count;
- sal_Int32 expLen;
-
- } TestCase;
-
- TestCase arrTestCase[] ={
-
- {"copy substring", kTestStr6, kTestStr11Len, kTestStr2Len - kTestStr11Len,kTestStr6Len},
- /* LLA: it is a bug, beginIndex + count > kTestStr2.getLength() */
- /* {"copy normal substring with incorrect count",kTestStr6, kTestStr11Len, 31, 15}, */
- {"copy whole string", kTestStr2, 0, kTestStr2Len, kTestStr2Len},
- /* {"copy whole string with incorrect count larger than len and index 0", kTestStr2, 0, 40, 32}, */
- /* LLA: bug beginIndex + count > kTestStr2 {"copy last character", "y",kTestStr2Len - 1, 31,1}, */
- {"copy last character", "y",kTestStr2Len - 1, 1,1},
- /* LLA: bug, beginIndex > kTestStr2 {"beginindex larger than len","",60, 0,0}, */
- {"beginindex exact as large as it's length","",kTestStr2Len, 0,0}
- /* LLA: bug, negative count is not allowed. {"count is nagative int","",3, -1,0} */
- };
- sal_Bool res = sal_True;
-
- sal_uInt32 i;
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++) {
- OString src(kTestStr2);
- OString dst;
- dst = src.copy(arrTestCase[i].beginIndex, arrTestCase[i].count);
- // rtl_String* pDataSrc = src.pData;
- // rtl_String* pDataDst = dst.pData;
-
- sal_Bool lastRes=sal_True;
- // checks buffer and length
- //t_print("this is copy__002 #%d\n", i);
- //t_print("dst buffer =%s\n", pDataDst->buffer);
- //t_print("expStr =%s\n", arrTestCase[i].arrExpStr);
- //t_print("dst length =%d\n", pDataDst->length);
- //t_print("count =%d\n", arrTestCase[i].count);
- //t_print("expLen =%d\n", arrTestCase[i].expLen);
-
- lastRes = (dst.equals(arrTestCase[i].arrExpStr)) ? sal_True : sal_False;
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth,
- "copy_002(beginIndex,count)(check buffer and length)", i)
- );
- res &= lastRes;
-
-
- }
-
- return (res);
-}
-
-
-static sal_Bool SAL_CALL test_rtl_OString_copy_003(
- hTestResult hRtlTestResult )
-{
- sal_Bool res = sal_True;
- char comment[] = "copy whole short string to long string";
-
- OString src(kTestStr1);
- // rtl_String* pDataSrc = src.pData;
- OString dst(kTestStr2);
-
- dst = src.copy(0);
- // rtl_String* pDataDst = dst.pData;
- //check buffer and length
- sal_Bool lastRes =(dst==src);
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- comment,
- "copy_003(beginIndex)(check buffer and length)"
- );
- res &= lastRes;
-
- return (res);
-}
-
-
-static sal_Bool SAL_CALL test_rtl_OString_copy_004(
- hTestResult hRtlTestResult )
-{
- sal_Bool res = sal_True;
- sal_Char comment[] = "copy whole long string to short string";
-
- OString src(kTestStr2);
- // rtl_String* pDataSrc = src.pData;
- OString dst(kTestStr1);
-
- dst = src.copy(0);
- // rtl_String* pDataDst = dst.pData;
- //check buffer and length
- sal_Bool lastRes =(dst==src);
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- comment,
- "copy_004(beginIndex)(check buffer and length)"
- );
-
- res &= lastRes;
- return (res);
-}
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_copy(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start(hRtlTestResult, "copy");
- sal_Bool res = test_rtl_OString_copy_001(hRtlTestResult);
- res &= test_rtl_OString_copy_002(hRtlTestResult);
- res &= test_rtl_OString_copy_003(hRtlTestResult);
- res &= test_rtl_OString_copy_004(hRtlTestResult);
- c_rtl_tres_state_end(hRtlTestResult, "copy");
-
-// return ( res );
-}
-
-//------------------------------------------------------------------------
-// testing the method concat( const OString & aStr )
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_concat(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth =methName;
-
- c_rtl_tres_state_start(hRtlTestResult, "concat");
- typedef struct TestCase
- {
- sal_Char* comments;
- OString* expVal;
- OString* input1;
- OString* input2;
- ~TestCase() { delete input1;delete input2; delete expVal;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"concatenates two strings",new OString(kTestStr1),
- new OString(kTestStr7),
- new OString(kTestStr8)},
- {"concatenates empty string",new OString(kTestStr1),
- new OString(kTestStr1),
- new OString("")},
- {"concatenates to empty string",new OString(kTestStr1),
- new OString(""),
- new OString(kTestStr1)},
- {"concatenates two empty strings",new OString(""),new OString(""),
- new OString("")},
- {"concatenates string constructed by default constructor",
- new OString(kTestStr1),
- new OString(kTestStr1), new OString()},
- {"concatenates to string constructed by default constructor",
- new OString(kTestStr1),
- new OString(), new OString(kTestStr1)},
- {"concatenates two strings constructed by default constructor",
- new OString(),
- new OString(), new OString()}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- OString str =
- arrTestCase[i].input1->concat(*arrTestCase[i].input2);
- sal_Bool lastRes = (str == *arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "concat", i)
- );
-
- res &= lastRes;
-
- }
-
- c_rtl_tres_state_end(hRtlTestResult, "concat");
-// return ( res );
-}
-
-
-//------------------------------------------------------------------------
-// testing the method toAsciiLowerCase()
-//-----------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_toAsciiLowerCase(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth =methName;
-
- c_rtl_tres_state_start(hRtlTestResult, "toAsciiLowerCase");
- typedef struct TestCase
- {
- sal_Char* comments;
- OString* expVal;
- OString* input1;
- ~TestCase() { delete input1; delete expVal;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
-
- {"only uppercase",new OString(kTestStr5),new OString(kTestStr4)},
- {"different cases",new OString(kTestStr5),new OString(kTestStr1)},
- {"different cases",new OString(kTestStr5),new OString(kTestStr3)},
- {"only lowercase",new OString(kTestStr5),new OString(kTestStr5)},
- {"empty string",new OString(""),new OString("")},
- {"string constructed by default constructor",
- new OString(),new OString()}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- OString str = arrTestCase[i].input1->toAsciiLowerCase();
- sal_Bool lastRes = (str ==* arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "toAsciiLowerCase", i)
- );
-
- res &= lastRes;
- }
-
- c_rtl_tres_state_end(hRtlTestResult, "toAsciiLowerCase");
-// return ( res );
-}
-
-//------------------------------------------------------------------------
-// testing the method toAsciiUpperCase()
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_toAsciiUpperCase(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth =methName;
-
- c_rtl_tres_state_start(hRtlTestResult, "toAsciiUpperCase");
- typedef struct TestCase
- {
- sal_Char* comments;
- OString* expVal;
- OString* input1;
- ~TestCase() { delete input1; delete expVal;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"only lowercase",new OString(kTestStr4),new OString(kTestStr5)},
- {"mixed cases",new OString(kTestStr4),new OString(kTestStr3)},
- {"miced cases",new OString(kTestStr4),new OString(kTestStr1)},
- {"only uppercase",new OString(kTestStr4),new OString(kTestStr4)},
- {"empty string",new OString(""),new OString("")},
- {"string constructed by default constructor",
- new OString(),new OString()}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- OString str = arrTestCase[i].input1->toAsciiUpperCase();
- sal_Bool lastRes = (str == *arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "toAsciiLowerCase", i)
- );
-
- res &= lastRes;
- }
- c_rtl_tres_state_end(hRtlTestResult, "toAsciiUpperCase");
-
-// return ( res );
-}
-
-
-//------------------------------------------------------------------------
-// testing the method trim()
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_trim(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth =methName;
-
- c_rtl_tres_state_start(hRtlTestResult, "trim");
- typedef struct TestCase
- {
- sal_Char* comments;
- OString* expVal;
- OString* input1;
- ~TestCase() { delete input1; delete expVal;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"removes space from the front",new OString(kTestStr1),
- new OString(kTestStr10)},
- {"removes space from the end",new OString(kTestStr1),
- new OString(kTestStr11)},
- {"removes space from the front and end",new OString(kTestStr1),
- new OString(kTestStr12)},
- {"removes several spaces from the end",new OString(kTestStr1),
- new OString(kTestStr13)},
- {"removes several spaces from the front",new OString(kTestStr1),
- new OString(kTestStr14)},
- {"removes several spaces from the front and one from the end",
- new OString(kTestStr1),
- new OString(kTestStr15)},
- {"removes one space from the front and several from the end",
- new OString(kTestStr1),
- new OString(kTestStr16)},
- {"removes several spaces from the front and end",
- new OString(kTestStr1),
- new OString(kTestStr17)},
- {"removes characters that have codes <= 32",new OString(kTestStr20),
- new OString("\1\3\5\7\11\13\15\17sun\21\23\25\27\31\33\40")},
- {"no spaces",new OString(kTestStr8),new OString(kTestStr8)}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- OString strRes = arrTestCase[i].input1->trim();
- sal_Bool lastRes = (strRes == *arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "trim", i)
- );
-
- res &= lastRes;
-
- }
-
- c_rtl_tres_state_end(hRtlTestResult, "trim");
-// return ( res );
-}
-
-
-
-//------------------------------------------------------------------------
-// testing the method boolean( sal_Bool b )
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OString_boolean(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth =methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Bool input1;
- OString* expVal;
- ~TestCase() {delete expVal;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"true",sal_True,new OString("true")},
- {"false",sal_False, new OString("false")}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- ::rtl::OString aStr1;
- aStr1 = aStr1.boolean( arrTestCase[i].input1 );
- sal_Bool lastRes = (arrTestCase[i].expVal->compareTo(aStr1) == 0);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "valueof_bool", i)
- );
-
- res &= lastRes;
-
- }
-
- return ( res );
-}
-
-sal_Bool SAL_CALL test_rtl_OString_valueOf_sal_Char(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth =methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Char input1;
- OString* expVal;
- ~TestCase() {delete expVal;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"A",'A',new OString("A")},
- {"a",'a', new OString("a")},
- {"0",'0', new OString("0")},
- {"-",'-', new OString("-")},
- {"_",'_', new OString("_")},
- {"|",'|', new OString("|")},
- {"?",'?', new OString("?")},
- {"?",'?', new OString("?")},
- {"\n",'\n', new OString("\n")},
- {"\'",'\'', new OString("\'")},
- {"\"",'\"', new OString("\"")}
-
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- ::rtl::OString aStr1;
- aStr1 = aStr1.valueOf( arrTestCase[i].input1 );
- sal_Bool lastRes = (arrTestCase[i].expVal->compareTo(aStr1) == 0);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "valueof_char", i)
- );
-
- res &= lastRes;
-
- }
-
- return ( res );
-}
-
-/**
- * Calls the method valueOf(T, radix) and compares
- * returned strings with strings that passed in the array resArray.
- *
- * @param T, type of argument, passed to valueOf
- * @param resArray, array of result strings to compare to
- * @param n the number of elements in the array resArray (testcases)
- * @param pTestResult the instance of the class TestResult
- * @param inArray [optional], array of value that is passed as first argument
- * to valueOf
- *
- * @return true, if all returned strings are equal to corresponding string in
- * resArray else, false.
- */
-template <class T>
-sal_Bool test_valueOf( const char** resArray, int n, sal_Int16 radix,
- hTestResult hRtlTestResult, const T *inArray )
-{
- sal_Bool bRes = sal_True;
-
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
- sal_Int32 i;
-
- for (i = 0; i < n; i++)
- {
- ::rtl::OString aStr1;
- ::rtl::OString aStr2( resArray[i] );
-
- if (inArray == 0)
- aStr1 = ::rtl::OString::valueOf((T)i, radix);
- else
- {
- if ( inArray[i] < 0 )
- {
- aStr2 = "-";
- aStr2 += resArray[i];
- }
- aStr1 = ::rtl::OString::valueOf((T)inArray[i], radix);
- }
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- aStr2.compareTo(aStr1) == 0,
- (sal_Char*)resArray[i],
- createName( pMeth, "valueOf", i )
- );
- }
-
- return (bRes);
-}
-
-
-#define test_valueOf_Int32 test_valueOf<sal_Int32>
-#define test_valueOf_Int64 test_valueOf<sal_Int64>
-
-//------------------------------------------------------------------------
-// testing the method valueOf( sal_Int32 i, sal_Int16 radix=2 )
-// testing the method valueOf( sal_Int32 i, sal_Int16 radix=8 )
-// testing the method valueOf( sal_Int32 i, sal_Int16 radix=10 )
-// testing the method valueOf( sal_Int32 i, sal_Int16 radix=16 )
-// testing the method valueOf( sal_Int32 i, sal_Int16 radix=36 )
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OString_valueOf_Int32(
- hTestResult hRtlTestResult )
-{
- sal_Bool bRes = sal_False;
-
- bRes = c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32((const char**)kBinaryNumsStr,
- kBinaryNumsCount, kRadixBinary, hRtlTestResult, 0 ),
- "kRadixBinary",
- "valueOf(sal_Int32, radix 2)"
- );
-
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32((const char**)kOctolNumsStr,
- kOctolNumsCount, kRadixOctol, hRtlTestResult, 0),
- "kRadixOctol",
- "valueOf(sal_Int32, radix 8)"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32((const char**)kDecimalNumsStr,
- kDecimalNumsCount, kRadixDecimal, hRtlTestResult, 0),
- "kRadixDecimal",
- "valueOf(sal_Int32, radix 10)"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32((const char**)kHexDecimalNumsStr,
- kHexDecimalNumsCount, kRadixHexdecimal, hRtlTestResult, 0),
- "kRadixHexdecimal",
- "valueOf(sal_Int32, radix 16)"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32((const char**)kBase36NumsStr,
- kBase36NumsCount, kRadixBase36, hRtlTestResult, 0),
- "kRadixBase36",
- "valueOf(sal_Int32, radix 36)"
- );
-
-
- return ( bRes );
-}
-
-//------------------------------------------------------------------------
-// testing the method valueOf( sal_Int32 l, sal_Int32 radix=2 )
-// where l = large constants
-// testing the method valueOf( sal_Int32 l, sal_Int32 radix=8 )
-// where l = large constants
-// testing the method valueOf( sal_Int32 l, sal_Int32 radix=10 )
-// where l = large constants
-// testing the method valueOf( sal_Int32 l, sal_Int32 radix=16 )
-// where l = large constants
-// testing the method valueOf( sal_Int32 l, sal_Int32 radix=36 )
-// where l = large constants
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OString_valueOf_Int32_Bounderies(
- hTestResult hRtlTestResult )
-{
- sal_Bool bRes = sal_False;
-
- bRes = c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32((const char**)kBinaryMaxNumsStr,
- kInt32MaxNumsCount, kRadixBinary, hRtlTestResult,
- kInt32MaxNums),
- "kRadixBinary",
- "valueOf(salInt32, radix 2) Bounderies"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32((const char**)kOctolMaxNumsStr,
- kInt32MaxNumsCount, kRadixOctol, hRtlTestResult,
- kInt32MaxNums),
- "kRadixOctol",
- "valueOf(salInt32, radix 8) Bounderies"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32((const char**)kDecimalMaxNumsStr,
- kInt32MaxNumsCount, kRadixDecimal,
- hRtlTestResult, kInt32MaxNums),
- "kRadixDecimal",
- "valueOf(salInt32, radix 10) Bounderies"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32((const char**)kHexDecimalMaxNumsStr,
- kInt32MaxNumsCount, kRadixHexdecimal,
- hRtlTestResult, kInt32MaxNums),
- "kRadixHexdecimal",
- "valueOf(salInt32, radix 16) Bounderies"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32((const char**)kBase36MaxNumsStr,
- kInt32MaxNumsCount, kRadixBase36,
- hRtlTestResult, kInt32MaxNums),
- "kRadixBase36",
- "valueOf(salInt32, radix 36) Bounderies"
- );
-
- return ( bRes );
-}
-
-//------------------------------------------------------------------------
-// testing the method valueOf( sal_Int32 i, sal_Int16 radix=2 )
-// for negative value
-// testing the method valueOf( sal_Int32 i, sal_Int16 radix=8 )
-// for negative value
-// testing the method valueOf( sal_Int32 i, sal_Int16 radix=10 )
-// for negative value
-// testing the method valueOf( sal_Int32 i, sal_Int16 radix=16 )
-// for negative value
-// testing the method valueOf( sal_Int32 i, sal_Int16 radix=36 )
-// for negative value
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OString_valueOf_Int32_Negative(
- hTestResult hRtlTestResult )
-{
- sal_Bool bRes = sal_False;
- sal_Int32 inArr[kBase36NumsCount];
- sal_Int32 i;
-
- for (i = 0; i < kBase36NumsCount; i++ )
- inArr[i] = -i;
-
- bRes = c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32( kBinaryNumsStr, kBinaryNumsCount,
- kRadixBinary, hRtlTestResult, inArr ),
- "negative Int32, kRadixBinary",
- "valueOf( negative Int32, radix 2 )"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32( kOctolNumsStr, kOctolNumsCount,
- kRadixOctol, hRtlTestResult, inArr ),
- "negative Int32, kRadixOctol",
- "valueOf( negative Int32, radix 8 )"
- );
-
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32( kDecimalNumsStr, kDecimalNumsCount,
- kRadixDecimal, hRtlTestResult, inArr ),
- "negative Int32, kRadixDecimal",
- "valueOf( negative Int32, radix 10 )"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32( kHexDecimalNumsStr, kHexDecimalNumsCount,
- kRadixHexdecimal, hRtlTestResult, inArr ),
- "negative Int32, kRadixHexdecimal",
- "valueOf( negative Int32, radix 16 )"
- );
-
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32( kBase36NumsStr, kBase36NumsCount,
- kRadixBase36, hRtlTestResult, inArr ),
- "negative Int32, kRadixBase36",
- "valueOf( negative Int32, radix 36 )"
- );
-
- return ( bRes );
-}
-//------------------------------------------------------------------------
-// testing the method valueOf( sal_Int32 l, sal_Int32 radix ) where radix = -5
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OString_valueOf_Int32_WrongRadix(
- hTestResult hRtlTestResult )
-{
- sal_Bool bRes = sal_False;
-
- sal_Int32 intVal = 11;
-
- ::rtl::OString aStr1;
- ::rtl::OString aStr2("11");
-
- aStr1 = aStr1.valueOf( intVal, -5 );
-
- bRes = c_rtl_tres_state
- (
- hRtlTestResult,
- aStr2.compareTo( aStr1 ) == 0,
- "if radix not valid then radix must be 10",
- "valueOf(sal_Int32, sal_Int32 radix): radix = -5"
- );
-
- return (bRes);
-}
-
-//------------------------------------------------------------------------
-// testing the method valueOf( sal_Int32 l, sal_Int32 radix )
-// where l = -2147483648 (smallest negative value)
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OString_valueOf_Int32_SmallestNegativeValue(
- hTestResult hRtlTestResult)
-{
- // Standard-conforming way to assign -2147483648 to n:
- sal_Int32 n = -1;
- for (int i = 1; i < 32; ++i)
- n *= 2;
- return c_rtl_tres_state
- (
- hRtlTestResult,
- ::rtl::OString::valueOf(n) == "-2147483648",
- "-2147483648",
- "valueOf(sal_Int32 -2147483648)"
- );
-}
-
-//------------------------------------------------------------------------
-// testing the method valueOf( sal_Int64 l, sal_Int16 radix=2 )
-// testing the method valueOf( sal_Int64 l, sal_Int16 radix=8 )
-// testing the method valueOf( sal_Int64 l, sal_Int16 radix=10 )
-// testing the method valueOf( sal_Int64 l, sal_Int16 radix=16 )
-// testing the method valueOf( sal_Int64 l, sal_Int16 radix=36 )
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OString_valueOf_Int64(
- hTestResult hRtlTestResult )
-{
- sal_Bool bRes = sal_False;
-
- bRes = c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64((const char**)kBinaryNumsStr,
- kBinaryNumsCount, kRadixBinary, hRtlTestResult, 0),
- "kRadixBinary",
- "valueOf(sal_Int64, radix 2)_"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64((const char**)kOctolNumsStr,
- kOctolNumsCount, kRadixOctol, hRtlTestResult, 0),
- "kRadixOctol",
- "valueOf(sal_Int64, radix 8)_"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64((const char**)kDecimalNumsStr,
- kDecimalNumsCount, kRadixDecimal, hRtlTestResult, 0),
- "kRadixDecimal",
- "valueOf(sal_Int64, radix 10)_"
- );
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64((const char**)kHexDecimalNumsStr,
- kHexDecimalNumsCount, kRadixHexdecimal, hRtlTestResult, 0),
- "kRadixHexdecimal",
- "valueOf(sal_Int64, radix 16)_"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64((const char**)kBase36NumsStr,
- kBase36NumsCount, kRadixBase36, hRtlTestResult, 0),
- "kRadixBase36",
- "valueOf(sal_Int64, radix 36)_"
- );
-
- return (bRes);
-}
-
-//------------------------------------------------------------------------
-// testing the method valueOf( sal_Int64 l, sal_Int32 radix=2 )
-// where l = large constants
-// testing the method valueOf( sal_Int64 l, sal_Int32 radix=8 )
-// where l = large constants
-// testing the method valueOf( sal_Int64 l, sal_Int32 radix=10 )
-// where l = large constants
-// testing the method valueOf( sal_Int64 l, sal_Int32 radix=16 )
-// where l = large constants
-// testing the method valueOf( sal_Int64 l, sal_Int32 radix=36 )
-// where l = large constants
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OString_valueOf_Int64_Bounderies(
- hTestResult hRtlTestResult )
-{
- sal_Bool bRes = sal_False;
-
- bRes = c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64((const char**)kBinaryMaxNumsStr,
- kInt64MaxNumsCount, kRadixBinary,
- hRtlTestResult, kInt64MaxNums),
- "kRadixBinary",
- "valueOf(salInt64, radix 2) Bounderies"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64((const char**)kOctolMaxNumsStr,
- kInt64MaxNumsCount, kRadixOctol,
- hRtlTestResult, kInt64MaxNums),
- "kRadixOctol",
- "valueOf(salInt64, radix 8) Bounderies"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64((const char**)kDecimalMaxNumsStr,
- kInt64MaxNumsCount, kRadixDecimal,
- hRtlTestResult, kInt64MaxNums),
- "kRadixDecimal",
- "valueOf(salInt64, radix 10) Bounderies"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64((const char**)kHexDecimalMaxNumsStr,
- kInt64MaxNumsCount, kRadixHexdecimal,
- hRtlTestResult, kInt64MaxNums),
- "kRadixHexdecimal",
- "valueOf(salInt64, radix 16) Bounderies"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64((const char**)kBase36MaxNumsStr,
- kInt64MaxNumsCount, kRadixBase36,
- hRtlTestResult, kInt64MaxNums),
- "kRadixBase36",
- "valueOf(salInt64, radix 36) Bounderies"
- );
-
- return ( bRes );
-}
-
-//------------------------------------------------------------------------
-// testing the method valueOf( sal_Int64 l, sal_Int16 radix=2 )
-// for negative value
-// testing the method valueOf( sal_Int64 l, sal_Int16 radix=8 )
-// for negative value
-// testing the method valueOf( sal_Int64 l, sal_Int16 radix=10 )
-// for negative value
-// testing the method valueOf( sal_Int64 l, sal_Int16 radix=16 )
-// for negative value
-// testing the method valueOf( sal_Int64 l, sal_Int16 radix=36 )
-// for negative value
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OString_valueOf_Int64_Negative(
- hTestResult hRtlTestResult )
-{
- sal_Bool bRes = sal_False;
-
- sal_Int64 inArr[36];
- sal_Int32 i;
-
- for (i = 0; i < 36; i++) {
- inArr[i] = -i;
- }
-
-
- bRes = c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64( kBinaryNumsStr, kBinaryNumsCount,
- kRadixBinary, hRtlTestResult, inArr ),
- "negative Int64, kRadixBinary",
- "valueOf( negative Int64, radix 2 )"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64( kOctolNumsStr, kOctolNumsCount,
- kRadixOctol, hRtlTestResult, inArr ),
- "negative Int64, kRadixOctol",
- "valueOf( negative Int64, radix 8 )"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64( kDecimalNumsStr, kDecimalNumsCount,
- kRadixDecimal, hRtlTestResult, inArr ),
- "negative Int64, kRadixDecimal",
- "valueOf( negative Int64, radix 10 )"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64( kHexDecimalNumsStr, kHexDecimalNumsCount,
- kRadixHexdecimal, hRtlTestResult, inArr ),
- "negative Int64, kRadixHexDecimal",
- "valueOf( negative Int64, radix 16 )"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64( kBase36NumsStr, kBase36NumsCount,
- kRadixBase36, hRtlTestResult, inArr),
- "negative Int64, kRadixBase36",
- "valueOf( negative Int64, radix 36 )"
- );
-
- return (bRes);
-}
-//------------------------------------------------------------------------
-// testing the method valueOf( sal_Int64 l, sal_Int32 radix )
-// where radix = -5
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OString_valueOf_Int64_WrongRadix(
- hTestResult hRtlTestResult )
-{
- sal_Bool bRes = sal_False;
-
- sal_Int64 intVal = 11;
-
- ::rtl::OString aStr1;
- ::rtl::OString aStr2("11");
-
- aStr1 = aStr1.valueOf( intVal, -5 );
-
- bRes = c_rtl_tres_state
- (
- hRtlTestResult,
- aStr2.compareTo(aStr1) == 0,
- "if radix not valid then radix must be 10",
- "valueOf(sal_Int64, sal_Int32 radix): radix = -5"
- );
-
- return (bRes);
-}
-
-//------------------------------------------------------------------------
-// testing the method valueOf( sal_Int64 l, sal_Int32 radix )
-// where l = -9223372036854775808 (smallest negative value)
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OString_valueOf_Int64_SmallestNegativeValue(
- hTestResult hRtlTestResult)
-{
- // Standard-conforming way to assign -9223372036854775808 to n:
- sal_Int64 n = -1;
- for (int i = 1; i < 64; ++i)
- n *= 2;
- return c_rtl_tres_state
- (
- hRtlTestResult,
- ::rtl::OString::valueOf(n) == "-9223372036854775808",
- "-9223372036854775808",
- "valueOf(sal_Int64 -9223372036854775808)"
- );
-}
-
-//------------------------------------------------------------------------
-// testing the method valueOf()
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_valueOf(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start(hRtlTestResult, "valueOf");
- sal_Bool bTState = test_rtl_OString_boolean( hRtlTestResult );
-
- bTState &= test_rtl_OString_valueOf_sal_Char( hRtlTestResult );
-
- bTState &= test_rtl_OString_valueOf_Int32( hRtlTestResult );
- bTState &= test_rtl_OString_valueOf_Int32_Bounderies( hRtlTestResult );
- bTState &= test_rtl_OString_valueOf_Int32_Negative( hRtlTestResult );
- bTState &= test_rtl_OString_valueOf_Int32_WrongRadix( hRtlTestResult );
- bTState &= test_rtl_OString_valueOf_Int32_SmallestNegativeValue(
- hRtlTestResult );
-
- bTState &= test_rtl_OString_valueOf_Int64( hRtlTestResult );
- bTState &= test_rtl_OString_valueOf_Int64_Bounderies( hRtlTestResult );
- bTState &= test_rtl_OString_valueOf_Int64_Negative( hRtlTestResult );
- bTState &= test_rtl_OString_valueOf_Int64_WrongRadix( hRtlTestResult );
- bTState &= test_rtl_OString_valueOf_Int64_SmallestNegativeValue(
- hRtlTestResult );
-
- c_rtl_tres_state_end(hRtlTestResult, "valueOf");
-// return ( bTState );
-}
-
-
-//------------------------------------------------------------------------
-// testing the method toChar()
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_toChar(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- c_rtl_tres_state_start(hRtlTestResult, "toChar");
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Char expVal;
- OString* input1;
- ~TestCase() {delete input1;}
- } TestCase;
-
-
- TestCase arrTestCase[] =
- {
- {"A", 'A', new OString("A")},
- {"a", 'a', new OString("a")},
- {"0", '0',new OString("0")},
- {"-", '-',new OString("-")},
- {"_", '_',new OString("_")},
-
-// TODO: may be UTF-8 values
-// {"0„6", '0„6',new OString("0„6")},
-// { "0„7", '0„7',new OString("0„7")},
-// {"0‹0", '0‹0',new OString("0‹0")},
-// {"06", '06',new OString("06")},
- {"\n", '\n',new OString("\n")},
- {"\'", '\'',new OString("\'")},
- {"\"", '\"',new OString("\"")},
- {"\0", '\0',new OString("\0")},
- {"", '\0',new OString("")},
- {"Sun Microsystems", 'S', new OString(kTestStr1)}
- };
-
-
- // sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++ )
- {
- sal_Char strRes = arrTestCase[i].input1->toChar();
- sal_Bool lastRes = ( strRes == arrTestCase[i].expVal );
-
- char com[MAXBUFLENGTH];
- com[0] = '\'';
- cpynstr(com + 1, (*arrTestCase[i].input1), MAXBUFLENGTH);
- int length = AStringLen( (*arrTestCase[i].input1) );
- com[length + 1] = '\'';
- com[length + 2] = 0;
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- com,
- createName( pMeth, "toChar", i )
- );
-
- }
-
- c_rtl_tres_state_end(hRtlTestResult, "toChar");
-// return (res);
-}
-
-
-//------------------------------------------------------------------------
-// testing the method toFloat()
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_toFloat(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- c_rtl_tres_state_start(hRtlTestResult, "toFloat");
- typedef struct TestCase
- {
- float expVal;
- OString* input1;
- float m_nPrecision;
- ~TestCase() {delete input1;}
- } TestCase;
-
-
- TestCase arrTestCase[] =
- {
- {3.0f, new OString("3"), 3e-7f},
- {3.1f, new OString("3.1"), 3e-7f},
- {3.1415f, new OString("3.1415"), 3e-7f},
- {3.14159f, new OString("3.14159"), 3e-7f},
- {3.141592f, new OString("3.141592"), 3e-7f},
- {3.1415926f, new OString("3.1415926"), 3e-7f},
- {3.14159265f, new OString("3.14159265"), 3e-7f},
- {3.141592653589793238462643f,
- new OString("3.141592653589793238462643"), 3e-7f},
- {6.5822e-16f, new OString("6.5822e-16"), 6e-16f * 1e-7f},
- {9.1096e-31f, new OString("9.1096e-31"), 9e-31f * 1e-7f},
- {2.997925e8f, new OString("2.997925e8"), 3e8f * 1e-7f},
- {6.241e18f, new OString("6.241e18"), 6e18f * 1e-7f},
- {3.1f, new OString("03.1"), 3e-7f},
- {3.1f, new OString(" 3.1"), 3e-7f},
- {-3.1f, new OString("-3.1"), 3e-7f},
- {3.1f, new OString("+3.1"), 3e-7f},
- {0.0f, new OString("-0.0"), 1e-7f}
- };
-
-
- // sal_Bool res = sal_True;
- sal_uInt32 i;
-
- t_print("sizeof(float)=%d, sizeof(double)=%d\n", sizeof(float), sizeof(double));
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++ )
- {
- float fA = arrTestCase[i].input1->toFloat();
- float fB = arrTestCase[i].expVal;
- float fPrec = arrTestCase[i].m_nPrecision;
- float fResult = (float) fabs(fA - fB);
- // t_print("float result: A:(%.9f) B:(%.9f) fabs(A-B):%E\n", fA, fB, fResult);
- t_print("float result: A:(%E) B:(%E) fabs(A-B):%E\n", fA, fB, (float) fResult);
- sal_Bool lastRes = ( fResult <= fPrec );
-
- char com[MAXBUFLENGTH];
- com[0] = '\'';
- cpynstr(com + 1, (*arrTestCase[i].input1), MAXBUFLENGTH);
- int length = AStringLen( (*arrTestCase[i].input1) );
- com[length + 1] = '\'';
- com[length + 2] = 0;
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- com,
- createName( pMeth, "toFloat", i )
- );
-
- }
-
- c_rtl_tres_state_end(hRtlTestResult, "toFloat");
-// return (res);
-}
-
-//------------------------------------------------------------------------
-// testing the method toBoolean()
-//------------------------------------------------------------------------
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_toBoolean(
- hTestResult hRtlTestResult)
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- c_rtl_tres_state_start(hRtlTestResult, "toBoolean");
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Bool expVal;
- OString* input;
-
- } TestCase;
-
- TestCase arrTestCase[]={
-
- {"expected true", sal_True, new OString("True")},
- {"expected false", sal_False, new OString("False")},
- {"expected true", sal_True, new OString("1")}
- };
-
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Bool bRes = arrTestCase[i].input->toBoolean();
- sal_Bool lastRes = (bRes == arrTestCase[i].expVal);
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "toBoolean", i )
-
- );
- res &= lastRes;
- }
- c_rtl_tres_state_end(hRtlTestResult, "toBoolean");
-// return ( res );
-}
-
-
-
-//------------------------------------------------------------------------
-// testing the method toInt32( sal_Int16 radix = 2,8,10,16,36 )
-//------------------------------------------------------------------------
-sal_Bool test_toInt32( int num, const sal_Char** in,
-const sal_Int32 *expVal,sal_Int16 radix, hTestResult hRtlTestResult )
-{
- sal_Bool res = sal_True;
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
- sal_Int32 i;
-
- for( i = 0; i < num; i++ )
- {
- OString str(in[i]);
- sal_Int32 intRes = str.toInt32(radix);
- sal_Bool lastRes = (intRes == expVal[i]);
-
- char buf[MAXBUFLENGTH];
- buf[0] = '\'';
- cpynstr( buf + 1, in[i], MAXBUFLENGTH );
- int length = AStringLen( in[i] );
- buf[length + 1] = '\'';
- buf[length + 2] = 0;
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- buf,
- createName( pMeth,"toInt32", i )
- );
-
- res &= lastRes;
- }
-
- return( res );
-}
-
-sal_Bool SAL_CALL test_rtl_OString_toInt32_wrongRadix(
- hTestResult hRtlTestResult )
-{
- ::rtl::OString str("0");
-
- sal_Int32 iRes = str.toInt32(-1);
-
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- iRes == 0,
- "wrong radix -1",
- "toInt32( 0, wrong radix -1 )"
- )
- );
-}
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_toInt32(
- hTestResult hRtlTestResult )
-{
- sal_Int32 expValues[kBase36NumsCount];
- sal_Int32 i;
-
- c_rtl_tres_state_start(hRtlTestResult, "toInt32");
- for ( i = 0; i < kBase36NumsCount; i++ )
- expValues[i] = i;
-
- sal_Bool res = c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt32( kBinaryNumsCount, kBinaryNumsStr,
- expValues, kRadixBinary, hRtlTestResult ),
- "kBinaryNumsStr",
- "toInt32( radix 2 )"
- );
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt32( kInt32MaxNumsCount, kBinaryMaxNumsStr,
- kInt32MaxNums, kRadixBinary, hRtlTestResult ),
- "kBinaryMaxNumsStr",
- "toInt32_Boundaries( radix 2 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt32( kOctolNumsCount, kOctolNumsStr,
- expValues, kRadixOctol, hRtlTestResult ),
- "kOctolNumsStr",
- "toInt32( radix 8 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt32( kInt32MaxNumsCount, kOctolMaxNumsStr,
- (sal_Int32*)kInt32MaxNums, kRadixOctol, hRtlTestResult ),
- "kOctolMaxNumsStr",
- "toInt32_Boundaries( radix 8 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt32( kDecimalNumsCount, kDecimalNumsStr, expValues,
- kRadixDecimal, hRtlTestResult ),
- "kDecimalNumsStr",
- "toInt32( radix 10 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt32( kInt32MaxNumsCount, kDecimalMaxNumsStr,
- (sal_Int32*)kInt32MaxNums, kRadixDecimal, hRtlTestResult ),
- "kDecimalMaxNumsStr",
- "toInt32_Boundaries( radix 10 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt32( kHexDecimalNumsCount, kHexDecimalNumsStr, expValues,
- kRadixHexdecimal, hRtlTestResult ),
- "kHexDecimalNumsStr",
- "toInt32( radix 16 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt32( kInt32MaxNumsCount, kHexDecimalMaxNumsStr,
- (sal_Int32*)kInt32MaxNums, kRadixHexdecimal, hRtlTestResult ),
- "kHexDecimalMaxNumsStr",
- "toInt32_Boundaries( radix 16 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt32( kBase36NumsCount, kBase36NumsStr, expValues,
- kRadixBase36, hRtlTestResult ),
- "kBase36NumsStr",
- "toInt32( radix 36 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt32( kInt32MaxNumsCount, kBase36MaxNumsStr,
- (sal_Int32*)kInt32MaxNums, kRadixBase36, hRtlTestResult ),
- "kBase36MaxNumsStr",
- "toInt32_Boundaries( radix 36 )"
- );
-
- const sal_Int16 nSpecCases = 5;
- static const sal_Char *spString[nSpecCases] =
- {
- "-1",
- "+1",
- " 1",
- " -1",
- "001"
- };
-
- sal_Int32 expSpecVal[nSpecCases] =
- {
- -1,
- 1,
- 1,
- -1,
- 1
- };
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt32( nSpecCases, spString, expSpecVal,
- kRadixDecimal, hRtlTestResult ),
- "special cases",
- "toInt32( specialcases )"
- );
-
- res &= test_rtl_OString_toInt32_wrongRadix( hRtlTestResult );
-
- c_rtl_tres_state_end(hRtlTestResult, "toInt32");
-// return ( res );
-}
-
-//------------------------------------------------------------------------
-// testing the method toInt64( sal_Int16 radix = 2,8,10,16,36 )
-//------------------------------------------------------------------------
-sal_Bool test_toInt64( int num, const sal_Char** in,
-const sal_Int64 *expVal,sal_Int16 radix, hTestResult hRtlTestResult )
-{
- sal_Bool res = sal_True;
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
- sal_Int32 i;
-
- for( i = 0; i < num; i++ )
- {
- OString str( in[i] );
- sal_Int64 intRes = str.toInt64( radix );
- sal_Bool lastRes = ( intRes == expVal[i] );
-
- char buf[MAXBUFLENGTH];
- buf[0] = '\'';
- cpynstr( buf + 1, in[i], MAXBUFLENGTH );
- int length = AStringLen(in[i]);
- buf[length + 1] = '\'';
- buf[length + 2] = 0;
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- buf,
- createName( pMeth, "toInt64", i )
- );
-
- res &= lastRes;
- }
- return (res);
-}
-
-sal_Bool SAL_CALL test_rtl_OString_toInt64_wrongRadix(
- hTestResult hRtlTestResult )
-{
- ::rtl::OString str("0");
-
- sal_Int64 iRes = str.toInt64(-1);
-
- return (
-
- c_rtl_tres_state
- ( hRtlTestResult,
- iRes == 0,
- "wrong radix -1",
- "toInt64( wrong radix -1)"
- )
- );
-}
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_toInt64(
- hTestResult hRtlTestResult )
-{
- sal_Int64 expValues[kBase36NumsCount];
- sal_Int32 i;
-
- c_rtl_tres_state_start(hRtlTestResult, "toInt64");
- for (i = 0; i < kBase36NumsCount; expValues[i] = i, i++);
-
- sal_Bool res = c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt64( kBinaryNumsCount, kBinaryNumsStr, expValues,
- kRadixBinary, hRtlTestResult ),
- "kBinaryNumsStr",
- "toInt64( radix 2 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt64( kInt32MaxNumsCount, kBinaryMaxNumsStr,
- (sal_Int64*)kInt64MaxNums, kRadixBinary, hRtlTestResult ),
- "kBinaryMaxNumsStr",
- "toInt64_Boundaries( radix 2 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt64( kOctolNumsCount, kOctolNumsStr, expValues,
- kRadixOctol, hRtlTestResult ),
- "kOctolNumsStr",
- "toInt64( radix 8 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt64( kInt32MaxNumsCount, kOctolMaxNumsStr,
- (sal_Int64*)kInt64MaxNums, kRadixOctol, hRtlTestResult ),
- "kOctolMaxNumsStr",
- "toInt64_Boundaries( radix 8 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt64( kDecimalNumsCount, kDecimalNumsStr, expValues,
- kRadixDecimal, hRtlTestResult ),
- "kDecimalNumsStr",
- "toInt64( radix 10 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt64( kInt32MaxNumsCount, kDecimalMaxNumsStr,
- (sal_Int64*)kInt64MaxNums, kRadixDecimal, hRtlTestResult ),
- "kDecimalMaxNumsStr",
- "toInt64_Boundaries( radix 10 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt64( kHexDecimalNumsCount, kHexDecimalNumsStr, expValues,
- kRadixHexdecimal, hRtlTestResult ),
- "kHexDecimalNumsStr",
- "toInt64( radix 16 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt64( kInt32MaxNumsCount, kHexDecimalMaxNumsStr,
- (sal_Int64*)kInt64MaxNums, kRadixHexdecimal, hRtlTestResult ),
- "kHexDecimalMaxNumsStr",
- "toInt64_Boundaries( radix 16 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt64( kBase36NumsCount, kBase36NumsStr, expValues,
- kRadixBase36, hRtlTestResult ),
- "kBase36NumsStr",
- "toInt64( radix 36 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt64( kInt32MaxNumsCount, kBase36MaxNumsStr,
- (sal_Int64*)kInt64MaxNums, kRadixBase36, hRtlTestResult ),
- "kBase36MaxNumsStr",
- "toInt64_Boundaries( radix 36 )"
- );
-
-
-
- const sal_Int16 nSpecCases = 5;
- static const sal_Char *spString[nSpecCases] =
- {
- "-1",
- "+1",
- " 1",
- " -1",
- "001"
- };
-
- sal_Int64 expSpecVal[nSpecCases] =
- {
- -1,
- 1,
- 1,
- -1,
- 1
- };
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toInt64( nSpecCases, spString, expSpecVal,
- kRadixDecimal, hRtlTestResult ),
- "special cases",
- "toInt64( specialcases )"
- );
-
- res &= test_rtl_OString_toInt64_wrongRadix( hRtlTestResult );
-
- c_rtl_tres_state_end(hRtlTestResult, "toInt64");
-// return (res);
-}
-
-//------------------------------------------------------------------------
-// testing the method replace( sal_Char oldChar, sal_Char newChar )
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_replace(
- hTestResult hRtlTestResult)
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- c_rtl_tres_state_start(hRtlTestResult, "replace");
-typedef struct TestCase
-{
- sal_Char* comments;
- OString* expVal;
- OString* input;
- sal_Char oldChar;
- sal_Char newChar;
-
- ~TestCase() { delete input; delete expVal;}
-} TestCase;
-
-TestCase arrTestCase[]={
-
- {"string differs", new OString(kTestStr18),
- new OString(kTestStr4),'S','s'},
- {"string differs", new OString(kTestStr19),
- new OString(kTestStr17),(sal_Char)' ',(sal_Char)'-'},
- {"same string, no replace ", new OString(kTestStr22),
- new OString(kTestStr22),'*','8'}
- };
-
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- ::rtl::OString aStr1;
- aStr1= arrTestCase[i].input->replace(arrTestCase[i].oldChar,
- arrTestCase[i].newChar);
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- (arrTestCase[i].expVal->compareTo(aStr1) == 0),
- arrTestCase[i].comments,
- createName( pMeth, "replace", i )
-
- );
- }
- c_rtl_tres_state_end(hRtlTestResult, "replace");
-// return ( res );
-}
-
-
-
-//------------------------------------------------------------------------
-// testing the method replaceAt( sal_Int32 index, sal_Int32 count,
-// const OString& newStr )
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString_replaceAt(
- hTestResult hRtlTestResult)
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- c_rtl_tres_state_start(hRtlTestResult, "replaceAt");
- typedef struct TestCase
- {
- sal_Char* comments;
- OString* expVal;
- OString* input;
- OString* newStr;
- sal_Int32 index;
- sal_Int32 count;
-
- ~TestCase() { delete input; delete expVal; delete newStr;}
- } TestCase;
-
- TestCase arrTestCase[]=
- {
-
- { "string differs", new OString(kTestStr2), new OString(kTestStr22),
- new OString(kTestStr2), 0, kTestStr22Len },
-
- { "larger index", new OString(kTestStr1), new OString(kTestStr7),
- new OString(kTestStr8), 64, kTestStr8Len },
-
- { "larger count", new OString(kTestStr2), new OString(kTestStr22),
- new OString(kTestStr2),0, 64 },
-
- { "navigate index", new OString(kTestStr2), new OString(kTestStr22),
- new OString(kTestStr2), -64, 64 },
-
- { "null string", new OString(""),
- new OString(kTestStr14),new OString(""), 0, kTestStr14Len }
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- ::rtl::OString aStr1;
- aStr1= arrTestCase[i].input->replaceAt( arrTestCase[i].index,
- arrTestCase[i].count, *arrTestCase[i].newStr );
-
- sal_Bool lastRes = ( arrTestCase[i].expVal->compareTo(aStr1) == 0 );
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "replaceAt", i )
-
- );
- res &= lastRes;
- }
- c_rtl_tres_state_end(hRtlTestResult, "replaceAt");
-// return ( res );
-}
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OString( hTestResult hRtlTestResult )
-{
-
- c_rtl_tres_state_start(hRtlTestResult, "rtl_OString" );
-
- test_rtl_OString_ctors( hRtlTestResult );
- test_rtl_OString_getLength( hRtlTestResult );
- test_rtl_OString_equals( hRtlTestResult );
- test_rtl_OString_equalsIgnoreAsciiCase( hRtlTestResult );
- test_rtl_OString_compareTo( hRtlTestResult );
- test_rtl_OString_op_cmp( hRtlTestResult );
- test_rtl_OString_op_neq( hRtlTestResult );
- test_rtl_OString_op_g( hRtlTestResult );
- test_rtl_OString_op_l( hRtlTestResult );
- test_rtl_OString_op_ge( hRtlTestResult );
- test_rtl_OString_op_le( hRtlTestResult );
- test_rtl_OString_op_eq( hRtlTestResult );
- test_rtl_OString_op_plus( hRtlTestResult );
- test_rtl_OString_op_peq( hRtlTestResult );
- test_rtl_OString_op_cscs( hRtlTestResult );
- test_rtl_OString_getStr( hRtlTestResult );
- test_rtl_OString_copy( hRtlTestResult );
- test_rtl_OString_concat( hRtlTestResult );
- test_rtl_OString_toAsciiLowerCase( hRtlTestResult );
- test_rtl_OString_toAsciiUpperCase( hRtlTestResult );
- test_rtl_OString_trim( hRtlTestResult );
- test_rtl_OString_valueOf( hRtlTestResult );
- test_rtl_OString_toChar( hRtlTestResult );
- test_rtl_OString_toFloat( hRtlTestResult );
- test_rtl_OString_toBoolean( hRtlTestResult );
- test_rtl_OString_toInt32( hRtlTestResult );
- test_rtl_OString_toInt64( hRtlTestResult );
- test_rtl_OString_replace( hRtlTestResult );
- test_rtl_OString_replaceAt( hRtlTestResult );
-
- c_rtl_tres_state_end(hRtlTestResult, "rtl_OString");
-}
-
-
-// -----------------------------------------------------------------------------
-void RegisterAdditionalFunctions(FktRegFuncPtr _pFunc)
-{
- if (_pFunc)
- {
- (_pFunc)(&test_rtl_OString, "");
-
- //# (_pFunc)(&test_rtl_OString_ctors, "");
- //# (_pFunc)(&test_rtl_OString_getLength, "");
- //# (_pFunc)(&test_rtl_OString_equals, "");
- //# (_pFunc)(&test_rtl_OString_equalsIgnoreAsciiCase, "");
- //# (_pFunc)(&test_rtl_OString_compareTo, "");
- //# (_pFunc)(&test_rtl_OString_op_cmp, "");
- //# (_pFunc)(&test_rtl_OString_op_neq, "");
- //# (_pFunc)(&test_rtl_OString_op_g, "");
- //# (_pFunc)(&test_rtl_OString_op_l, "");
- //# (_pFunc)(&test_rtl_OString_op_ge, "");
- //# (_pFunc)(&test_rtl_OString_op_le, "");
- //# (_pFunc)(&test_rtl_OString_op_eq, "");
- //# (_pFunc)(&test_rtl_OString_op_plus, "");
- //# (_pFunc)(&test_rtl_OString_op_peq, "");
- //# (_pFunc)(&test_rtl_OString_op_cscs, "");
- //# (_pFunc)(&test_rtl_OString_getStr, "");
- //# (_pFunc)(&test_rtl_OString_copy, "");
- //# (_pFunc)(&test_rtl_OString_concat, "");
- //# (_pFunc)(&test_rtl_OString_toAsciiLowerCase, "");
- //# (_pFunc)(&test_rtl_OString_toAsciiUpperCase, "");
- //# (_pFunc)(&test_rtl_OString_trim, "");
- //# (_pFunc)(&test_rtl_OString_valueOf, "");
- //# (_pFunc)(&test_rtl_OString_toChar, "");
- //# (_pFunc)(&test_rtl_OString_toFloat, "");
- //# (_pFunc)(&test_rtl_OString_toDouble, "");
- //# (_pFunc)(&test_rtl_OString_toBoolean, "");
- //# (_pFunc)(&test_rtl_OString_toInt32, "");
- //# (_pFunc)(&test_rtl_OString_toInt64, "");
- //# (_pFunc)(&test_rtl_OString_replace, "");
- //# (_pFunc)(&test_rtl_OString_replaceAt, "");
- }
-}
-
-/*
-D:\local\644\SRX644\sal\qa\rtl_OString.cxx(3559) : error C2664:
-'unsigned char (void (__cdecl *)(void *),const char *)'
- : cannot convert parameter 1 from
-'unsigned char (__cdecl *)(void *)' to 'void (__cdecl *)(void *)'
-
- This conversion requires a reinterpret_cast, a C-style cast or function-
-style cast
-*/
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl_strings/rtl_OUString.cxx b/sal/qa/rtl_strings/rtl_OUString.cxx
deleted file mode 100644
index 8758704643c2..000000000000
--- a/sal/qa/rtl_strings/rtl_OUString.cxx
+++ /dev/null
@@ -1,3377 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <sal/types.h>
-
-#include <testshl/tresstatewrapper.hxx>
-#include "stringhelper.hxx"
-#include <rtl/string.hxx>
-#include <rtl/ustring.h>
-#include <rtl/ustring.hxx>
-
-#include <osl/thread.h>
-#include <rtl_String_Const.h>
-#include <rtl_String_Utils.hxx>
-
-
-using ::rtl::OUString;
-using ::rtl::OString;
-
-//------------------------------------------------------------------------
-// test classes
-//------------------------------------------------------------------------
-const int MAXBUFLENGTH = 255;
-//------------------------------------------------------------------------
-// helper functions
-//------------------------------------------------------------------------
-static void unused()
-{
- // NEVER CALL SUCH FUNCTION!!!
- (void)input1StrLastDefault;
- (void)input1StrLastNormal;
- unused();
-}
-
-//------------------------------------------------------------------------
-// testing constructors
-//------------------------------------------------------------------------
-static sal_Bool test_rtl_OUString_ctor_001( hTestResult hRtlTestResult )
-{
-
- ::rtl::OUString aUStr;
- rtl_uString * pData = aUStr.pData;
-
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- pData->length == 0 &&
- ! *pData->buffer,
- "New OUString containing no characters",
- "ctor_001"
- )
- );
-}
-
-//------------------------------------------------------------------------
-
-static sal_Bool SAL_CALL test_rtl_OUString_ctor_002(
- hTestResult hRtlTestResult )
-{
- ::rtl::OUString aUStr( kTestStr1,
- kTestStr1Len,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString
- );
-
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- aUStr == aUStr1,
- "OUString from an ascii string",
- "ctor_002"
- )
- );
-}
-//------------------------------------------------------------------------
-
-static sal_Bool SAL_CALL test_rtl_OUString_ctor_003(
- hTestResult hRtlTestResult )
-{
- rtl_uString *rtlUStr =NULL ;
- rtl_uString_newFromAscii( &rtlUStr, kTestStr1 );
- ::rtl::OUString aUStr( rtlUStr );
-
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- aUStr == aUStr1,
- "New OUString from a rtl_uString",
- "ctor_003"
- )
- );
-}
-
-//------------------------------------------------------------------------
-
-static sal_Bool SAL_CALL test_rtl_OUString_ctor_004(
- hTestResult hRtlTestResult)
-{
- ::rtl::OUString aUStr( aUStr1 );
-
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- aUStr == aUStr1,
- "New OUString from unicode string",
- "ctor_004"
- )
- );
-}
-//------------------------------------------------------------------------
-
-static sal_Bool test_rtl_OUString_ctor_005( hTestResult hRtlTestResult )
-{
- ::rtl::OUString aUStr( aUStr2, kTestStr1Len );
-
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- aUStr == aUStr1,
- "New OUString from the first n characters of unicode string",
- "ctor_005"
- )
- );
-
-}
-
-
-//------------------------------------------------------------------------
-
-static sal_Bool test_rtl_OUString_ctor_006( hTestResult hRtlTestResult )
-{
- ::rtl::OUString aUStrtmp( aUStr1 );
- ::rtl::OUString aUStr( aUStrtmp );
-
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- aUStr==aUStrtmp,
- "New OUString from another OUString",
- "ctor_006"
- )
- );
-}
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_ctors(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "ctors");
- sal_Bool DCState = test_ini_uString();
- (void)DCState;
- sal_Bool bTSState = test_rtl_OUString_ctor_001( hRtlTestResult );
- bTSState &= test_rtl_OUString_ctor_002( hRtlTestResult);
- bTSState &= test_rtl_OUString_ctor_003( hRtlTestResult);
- bTSState &= test_rtl_OUString_ctor_004( hRtlTestResult);
- bTSState &= test_rtl_OUString_ctor_005( hRtlTestResult);
- bTSState &= test_rtl_OUString_ctor_006( hRtlTestResult);
- c_rtl_tres_state_end( hRtlTestResult, "ctors");
-// return( bTSState );
-}
-
-
-
-//------------------------------------------------------------------------
-// testing the method getLength
-//------------------------------------------------------------------------
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_getLength(
- hTestResult hRtlTestResult)
-{
- c_rtl_tres_state_start( hRtlTestResult, "getLength");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Int32 expVal;
- OUString* input;
- ~TestCase() { delete input;}
- } TestCase;
-
- TestCase arrTestCase[]={
-
- {"length of ascii string", kTestStr1Len,
- new OUString( kTestStr1,
- kTestStr1Len,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)},
- {"length of ascci string of size 1", 1,
- new OUString( "1",
- 1,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)},
- {"length of empty string (default constructor)", 0, new OUString()},
- {"length of empty string (empty ascii string arg)",0,
- new OUString( "",
- 0,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)},
- {"length of empty string (string arg = \"\\0\"')", 1,
- new OUString( "\0",
- 1,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)}
- };
-
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Int32 length = arrTestCase[i].input->getLength();
- sal_Bool lastRes = (length == arrTestCase[i].expVal);
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "getLength", i )
-
- );
- res &= lastRes;
- }
- c_rtl_tres_state_end( hRtlTestResult, "getLength");
-// return ( res );
-}
-
-//------------------------------------------------------------------------
-// testing the method equals( const OString & aStr )
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_equals(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "equals");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Bool expVal;
- OUString* input1;
- OUString* input2;
- ~TestCase() { delete input1;delete input2;}
- } TestCase;
-
- TestCase arrTestCase[]={
-
- {"same size", sal_True, new OUString(aUStr1), new OUString(aUStr1)},
- {"different size", sal_False, new OUString(aUStr1),
- new OUString(aUStr2)
- },
- {"same size, no case match", sal_False, new OUString(aUStr1),
- new OUString(aUStr3)
- },
- {"two empty strings(def. constructor)", sal_True, new OUString(),
- new OUString()
- },
- {"empty(def.constructor) and non empty", sal_False, new OUString(),
- new OUString(aUStr2)
- },
- {"non empty and empty(def. constructor)", sal_False,
- new OUString(aUStr1),
- new OUString()
- },
- {"two empty strings(string arg = \"\")", sal_True,
- new OUString( "",
- 0,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString),
- new OUString( "",
- 0,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)
- },
- {"empty(string arg = \"\") and non empty", sal_False,
- new OUString( "",
- 0,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString),
- new OUString(aUStr2)
- },
- {"non empty and empty(string arg = \"\")", sal_False,
- new OUString(aUStr1),
- new OUString( "",
- 0,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)
- }
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Bool lastRes =
- ( arrTestCase[i].input1->equals(*(arrTestCase[i].input2)) ==
- arrTestCase[i].expVal );
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "equals", i )
- );
-
- res &= lastRes;
- }
- c_rtl_tres_state_end( hRtlTestResult, "equals");
-// return (res);
-}
-
-//------------------------------------------------------------------------
-// testing the method equalsIgnoreAsciiCase( const OString & aStr )
-//------------------------------------------------------------------------
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_equalsIgnoreAsciiCase(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "equalsIgnoreAsciiCase");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Bool expVal;
- OUString* input1;
- OUString* input2;
- ~TestCase() { delete input1;delete input2;}
- } TestCase;
-
- TestCase arrTestCase[]={
- {"same strings but different cases",sal_True,new OUString(aUStr4),
- new OUString(aUStr5)
- },
- {"same strings",sal_True,new OUString(aUStr4),
- new OUString(aUStr4)},
- {"with equal beginning",sal_False,new OUString(aUStr2),
- new OUString(aUStr4)
- },
- {"empty(def.constructor) and non empty",sal_False,new OUString(),
- new OUString(aUStr5)
- },
- {"non empty and empty(def.constructor)",sal_False,
- new OUString(aUStr4),
- new OUString()
- },
- {"two empty strings(def.constructor)",sal_True,new OUString(),
- new OUString()
- },
- {"different strings with equal length",sal_False,
- new OUString(aUStr10),
- new OUString(aUStr11)
- }
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Bool lastRes =
- (arrTestCase[i].input1->equalsIgnoreAsciiCase(*arrTestCase[i].input2) ==
- arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "equalsIgnoreAsciiCase", i )
- );
-
- res &= lastRes;
- }
- c_rtl_tres_state_end( hRtlTestResult, "equalsIgnoreAsciiCase");
-// return (res);
-}
-
-
-static sal_Bool SAL_CALL test_rtl_OUString_compareTo_001(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Int32 expVal;
- OUString* input1;
- OUString* input2;
- ~TestCase() { delete input1;delete input2;}
- } TestCase;
-
- TestCase arrTestCase[]={
-
- {"simple compare, str1 to str5",-1,new OUString(aUStr1),
- new OUString(aUStr5)
- },
- {"simple compare, str2 to str5",-1,new OUString(aUStr2),
- new OUString(aUStr5)
- },
- {"simple compare, str1 to str9",-1,new OUString(aUStr1),
- new OUString(aUStr9)
- },
- {"simple compare, str1 to str2",-1,new OUString(aUStr1),
- new OUString(aUStr2)
- },
- {"simple compare, str4 to str5",-1,new OUString(aUStr4),
- new OUString(aUStr5)
- },
- {"simple compare, str1 to str3",-1,new OUString(aUStr1),
- new OUString(aUStr3)
- },
- {"simple compare, str5 to str1",+1,new OUString(aUStr5),
- new OUString(aUStr1)
- },
- {"simple compare, str2 to str1",+1,new OUString(aUStr2),
- new OUString(aUStr1)
- },
- {"simple compare, str9 to str5",+1,new OUString(aUStr9),
- new OUString(aUStr5)
- },
- {"simple compare, str5 to str4",+1,new OUString(aUStr5),
- new OUString(aUStr4)
- },
- {"simple compare, str1 to str1",0,new OUString(aUStr1),
- new OUString(aUStr1)
- },
- {"simple compare, nullString to nullString",0,new OUString(),
- new OUString()
- },
- {"simple compare, nullString to str2",-1,new OUString(),
- new OUString(aUStr2)
- },
- {"simple compare, str1 to nullString",+1,new OUString(aUStr1),
- new OUString()
- }
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Int32 cmpRes = arrTestCase[i].input1->compareTo
- (*arrTestCase[i].input2);
- cmpRes = ( cmpRes == 0 ) ? 0 : ( cmpRes > 0 ) ? +1 : -1 ;
- sal_Bool lastRes = ( cmpRes == arrTestCase[i].expVal);
-
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "compareTo_001(const OString&)", i )
- );
-
- res &= lastRes;
- }
-
- return (res);
-}
-
-
-//------------------------------------------------------------------------
-// testing the method compareTo( const OString & rObj, sal_Int32 length )
-//------------------------------------------------------------------------
-static sal_Bool SAL_CALL test_rtl_OUString_compareTo_002(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Int32 expVal;
- sal_Int32 maxLength;
- OUString* input1;
- OUString* input2;
- ~TestCase() { delete input1;delete input2;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"compare with maxlength, str1 to str9, 16",-1,16,
- new OUString(aUStr1), new OUString(aUStr9)},
- {"compare with maxlength, str2 to str9, 32",-1,32,
- new OUString(aUStr2), new OUString(aUStr9)},
- {"compare with maxlength, str9 to str4, 16",+1,16,
- new OUString(aUStr9), new OUString(aUStr4)},
- {"compare with maxlength, str9 to str22, 32",+1,32,
- new OUString(aUStr9), new OUString(aUStr22)},
- {"compare with maxlength, str9 to str5, 16",0,16,
- new OUString(aUStr9), new OUString(aUStr5)},
- {"compare with maxlength, str9 to str9, 32",0,32,
- new OUString(aUStr9), new OUString(aUStr9)},
- {"compare with maxlength, str1 to str2, 32",-1,32,
- new OUString(aUStr1), new OUString(aUStr2)},
- {"compare with maxlength, str1 to str2, 32",-1,32,
- new OUString(aUStr1), new OUString(aUStr2)},
- {"compare with maxlength, str1 to str2", 0,-1,
- new OUString(aUStr1), new OUString(aUStr2)}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Int32 cmpRes = arrTestCase[i].input1->compareTo
- (*arrTestCase[i].input2, arrTestCase[i].maxLength);
- cmpRes = (cmpRes == 0) ? 0 : (cmpRes > 0) ? +1 : -1 ;
- sal_Bool lastRes = (cmpRes == arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "compareTo_002(const OString&, sal_Int32)", i )
- );
-
- res &= lastRes;
- }
-
- return (res);
-}
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_compareTo(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "compareTo");
- sal_Bool res = test_rtl_OUString_compareTo_001(hRtlTestResult);
- res &= test_rtl_OUString_compareTo_002(hRtlTestResult);
- c_rtl_tres_state_end( hRtlTestResult, "compareTo");
-// return (res);
-}
-
-//------------------------------------------------------------------------
-// testing the method match( const OUString & str, sal_Int32 fromIndex = 0 )
-//------------------------------------------------------------------------
-static sal_Bool SAL_CALL test_rtl_OUString_match_001(
- hTestResult hRtlTestResult)
-
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Bool expVal;
- OUString* input1;
- OUString* input2;
- ~TestCase() { delete input1;delete input2;}
- } TestCase;
-
- TestCase arrTestCase[]={
-
- {"aUStr2 and aUStr1", sal_True, new OUString(aUStr2),
- new OUString(aUStr1)},
- {"aUStr1 and aUStr2", sal_False, new OUString(aUStr1),
- new OUString(aUStr2)},
- {"aUStr5 and aUStr6", sal_False, new OUString(aUStr5),
- new OUString(aUStr6)},
- {"null and aUStr1", sal_False, new OUString( "",
- 0,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString),
- new OUString(aUStr1)}
-
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Bool lastRes = ( arrTestCase[i].input1->match(
- *(arrTestCase[i].input2)) == arrTestCase[i].expVal );
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "match(const OUString & str)", i )
- );
-
- res &= lastRes;
- }
- return (res);
-}
-
-static sal_Bool SAL_CALL test_rtl_OUString_match_002(
- hTestResult hRtlTestResult )
-
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Bool expVal;
- sal_Int32 fromIndex;
- OUString* input1;
- OUString* input2;
- ~TestCase() { delete input1;delete input2;}
- } TestCase;
-
- TestCase arrTestCase[]={
-
- {"aUStr2 from 17 and aUStr6", sal_True, 17,
- new OUString(aUStr2),new OUString(aUStr6)},
- {"aUStr2 from 5 and aUStr6", sal_False, 5,
- new OUString(aUStr2),new OUString(aUStr6)},
- {"aUStr2 from 0 and aUStr1", sal_True, 0,
- new OUString(aUStr2),new OUString(aUStr1)},
- {"aUStr1 from 16 and null", sal_True, 16,
- new OUString(aUStr1),
- new OUString( "",
- 0,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString
- )
- },
- {"aUStr1 from 5 and null", sal_True, 5,
- new OUString(aUStr1),
- new OUString( "",
- 0,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString
- )
- },
- {"aUStr2 from -1 and aUStr1", sal_False, -1,
- new OUString(aUStr2),new OUString(aUStr1)},
- {"aUStr5 from 2 and aUStr4", sal_False, 2,
- new OUString(aUStr5),new OUString(aUStr4)},
- {"aUStr2 from 18 and aUStr1", sal_False, 18,
- new OUString(aUStr2),new OUString(aUStr1)}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Bool lastRes = ( arrTestCase[i].input1->match
- (*(arrTestCase[i].input2),arrTestCase[i].fromIndex) ==
- arrTestCase[i].expVal );
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth,
- "match(const OUString & str,sal_Int32 fromIndex = 0)", i )
-
- );
-
- res &= lastRes;
- }
- return (res);
-}
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_match(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "match");
- sal_Bool res = test_rtl_OUString_match_001(hRtlTestResult);
- res &= test_rtl_OUString_match_002(hRtlTestResult);
- c_rtl_tres_state_end( hRtlTestResult, "match");
-// return (res);
-}
-
-//------------------------------------------------------------------------
-// testing the operator +=
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_op_eq(
- hTestResult hRtlTestResult)
-{
- c_rtl_tres_state_start( hRtlTestResult, "eq");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- OUString* input1;
- OUString* input2;
- ~TestCase() { delete input1; delete input2;}
- } TestCase;
-
- TestCase arrTestCase[]={
- {"null and Ustr1", new OUString, new OUString(aUStr1)},
- {"Ustr2 and Ustr1", new OUString(aUStr2),
- new OUString(aUStr1)},
- {""" and Ustr1 from bit character buffer",
- new OUString(aUStr1),
- new OUString( "",
- 0,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString
- )},
- {"Ustr1 and Ustr2 from value and length",
- new OUString( aUStr2, kTestStr2Len ),
- new OUString(aUStr1)}
- };
-
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- *(arrTestCase[i].input1) = *(arrTestCase[i].input2);
- sal_Bool lastRes = (*(arrTestCase[i].input1) ==
- *(arrTestCase[i].input2));
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "op_eq", i )
-
- );
- res &= lastRes;
- }
- c_rtl_tres_state_end( hRtlTestResult, "eq");
-// return ( res );
-}
-
-//------------------------------------------------------------------------
-// testing the operator +=
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_op_peq(
- hTestResult hRtlTestResult)
-{
- c_rtl_tres_state_start( hRtlTestResult, "peq");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- OUString* expVal;
- OUString* input1;
- OUString* input2;
- ~TestCase() { delete input1; delete input2;}
- } TestCase;
-
- TestCase arrTestCase[]={
- {" ' '= ''+='' ", new OUString( "",
- 0,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString
- ),
- new OUString( "",
- 0,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString
- ),
- new OUString( "",
- 0,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString
- )},
- {"Ustr1= null += Ustr1", new OUString(aUStr1),
- new OUString(), new OUString(aUStr1)},
- {"Ustr1= '' += Ustr1", new OUString(aUStr1),
- /*new OUString( "",
- 0,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString
- )*/
- new OUString(),
- new OUString(aUStr1)},
- {"Ustr1PlusUStr6 = Ustr1 += Ustr6",
- new OUString(aUStr1PlusUStr6), new OUString(aUStr1),
- new OUString(aUStr6)},
- };
-
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- *(arrTestCase[i].input1) += *(arrTestCase[i].input2);
- sal_Bool lastRes = (*(arrTestCase[i].expVal) ==
- *(arrTestCase[i].input1));
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "op_peq", i )
-
- );
- res &= lastRes;
- }
- c_rtl_tres_state_end( hRtlTestResult, "peq");
-// return ( res );
-}
-
-//------------------------------------------------------------------------
-// testing the operator const sal_Unicode * (csuc for short)
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_csuc(
- hTestResult hRtlTestResult)
-{
- c_rtl_tres_state_start( hRtlTestResult, "csuc");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- const sal_Unicode tmpUC=0x0;
- rtl_uString* tmpUstring = NULL;
- const sal_Char *tmpStr=kTestStr1;
- sal_Int32 tmpLen=(sal_Int32) kTestStr1Len;
- // sal_Int32 cmpLen = 0;
-
- rtl_string2UString( &tmpUstring, tmpStr, tmpLen,
- osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS );
- OSL_ASSERT(tmpUstring != NULL);
-
-
- typedef struct TestCase
- {
- sal_Char* comments;
- const sal_Unicode* expVal;
- sal_Int32 cmpLen;
- OUString* input1;
- ~TestCase() { delete input1;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"test normal ustring",(*tmpUstring).buffer,kTestStr1Len,
- new OUString(aUStr1)},
- {"test empty ustring",&tmpUC, 1, new OUString()}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- const sal_Unicode* pstr = *arrTestCase[i].input1;
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- cmpstr((sal_Char*)pstr,
- (sal_Char*)arrTestCase[i].expVal,
- arrTestCase[i].cmpLen),
- arrTestCase[i].comments,
- createName( pMeth, "const sal_Unicode*", i )
- );
- }
- c_rtl_tres_state_end( hRtlTestResult, "csuc");
-// return ( res );
-}
-
-//------------------------------------------------------------------------
-// testing the method const sal_Unicode * getStr()
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_getStr(
- hTestResult hRtlTestResult)
-{
- c_rtl_tres_state_start( hRtlTestResult, "getStr");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- const sal_Unicode tmpUC=0x0;
- rtl_uString* tmpUstring = NULL;
- const sal_Char *tmpStr=kTestStr1;
- sal_Int32 tmpLen=(sal_Int32) kTestStr1Len;
- // sal_Int32 cmpLen = 0;
-
- rtl_string2UString( &tmpUstring, tmpStr, tmpLen,
- osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS );
- OSL_ASSERT(tmpUstring != NULL);
-
-
- typedef struct TestCase
- {
- sal_Char* comments;
- const sal_Unicode* expVal;
- sal_Int32 cmpLen;
- OUString* input1;
- ~TestCase() { delete input1;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"test normal ustring",(*tmpUstring).buffer,kTestStr1Len,
- new OUString(aUStr1)},
- {"test empty ustring",&tmpUC, 1, new OUString()}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- const sal_Unicode* pstr = arrTestCase[i].input1->getStr();
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- cmpstr((sal_Char*)pstr,
- (sal_Char*)arrTestCase[i].expVal,
- arrTestCase[i].cmpLen),
- arrTestCase[i].comments,
- createName( pMeth, "getStr", i )
- );
- }
- c_rtl_tres_state_end( hRtlTestResult, "getStr");
-// return ( res );
-}
-
-
-//------------------------------------------------------------------------
-// testing the method sal_Int32 reverseCompareTo( const OUString & str )
-//-------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_reverseCompareTo(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "reverseCompareTo");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Int32 expVal;
- OUString* input1;
- OUString* input2;
- ~TestCase() { delete input1;delete input2;}
- } TestCase;
-
- TestCase arrTestCase[]={
-
- {"simple compare, str1 to str5",-1,new OUString(aUStr1),
- new OUString(aUStr5)
- },
- {"simple compare, str2 to str5",1,new OUString(aUStr2),
- new OUString(aUStr5)
- },
- {"simple compare, str1 to str9",-1,new OUString(aUStr1),
- new OUString(aUStr9)
- },
- {"simple compare, str4 to str5",-1,new OUString(aUStr4),
- new OUString(aUStr5)
- },
- {"simple compare, str5 to str1",+1,new OUString(aUStr5),
- new OUString(aUStr1)
- },
- {"simple compare, str2 to str1",+1,new OUString(aUStr2),
- new OUString(aUStr1)
- },
- {"simple compare, str1 to str1",0,new OUString(aUStr1),
- new OUString(aUStr1)
- },
- {"simple compare, nullString to nullString",0,new OUString(),
- new OUString()
- },
- {"simple compare, nullString to str2",-1,new OUString(),
- new OUString(aUStr2)
- },
- {"simple compare, str1 to nullString",+1,new OUString(aUStr1),
- new OUString()
- }
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Int32 cmpRes = arrTestCase[i].input1->reverseCompareTo
- (*arrTestCase[i].input2);
- cmpRes = ( cmpRes == 0 ) ? 0 : ( cmpRes > 0 ) ? +1 : -1 ;
- sal_Bool lastRes = ( cmpRes == arrTestCase[i].expVal);
-
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "compareTo(const OString&)", i )
- );
-
- res &= lastRes;
- }
- c_rtl_tres_state_end( hRtlTestResult, "reverseCompareTo");
-// return (res);
-}
-
-//------------------------------------------------------------------------
-// testing the method sal_Bool equalsAscii( const sal_Char* asciiStr )
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_equalsAscii(
- hTestResult hRtlTestResult)
-{
- c_rtl_tres_state_start( hRtlTestResult, "equalsAscii");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- const sal_Char *tmpAstr1="Sun Microsystems\0";
- const sal_Char *tmpAstr2="\0";
-
-
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Bool expVal;
- OUString* input1;
- const sal_Char* input2;
- ~TestCase() { delete input1;}
- } TestCase;
-
- TestCase arrTestCase[]={
- {"str1 with str1 ", sal_True, new OUString( kTestStr1,
- kTestStr1Len,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString
- ), tmpAstr1},
- {"str2 with str1 ", sal_False,new OUString( kTestStr2,
- kTestStr2Len,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString
- ), tmpAstr1},
- {"null with str1 ", sal_False, new OUString(), tmpAstr1},
- {"null with '' ", sal_True, new OUString(), tmpAstr2},
- {"'' with ''", sal_True, new OUString( "",
- 0,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString
- ),
- tmpAstr2}
-
- };
-
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
-
- sal_Bool lastRes = (arrTestCase[i].expVal ==
- arrTestCase[i].input1->equalsAscii(arrTestCase[i].input2));
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "equalsAscii", i )
-
- );
- res &= lastRes;
- }
- c_rtl_tres_state_end( hRtlTestResult, "equalsAscii");
-// return ( res );
-}
-
-
-
-//------------------------------------------------------------------------
-// testing the method sal_Bool equalsAsciiL(
-// const sal_Char* asciiStr, sal_Int32 asciiStrLength )
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_equalsAsciiL(
- hTestResult hRtlTestResult)
-{
- c_rtl_tres_state_start( hRtlTestResult, "equalsAsciiL");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- const sal_Char *tmpAstr1="Sun Microsystems\0";
- const sal_Char *tmpAstr2="\0";
- const sal_Char *tmpAstr3="Sun Microsystems Java Technology\0";
-
-
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Bool expVal;
- OUString* input1;
- const sal_Char* input2;
- sal_Int32 cmpLen;
- ~TestCase() { delete input1;}
- } TestCase;
-
- TestCase arrTestCase[]={
- {"str1 with str1,str1Len ", sal_True, new OUString( kTestStr1,
- kTestStr1Len,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString
- ), tmpAstr1, kTestStr1Len},
- {"str2 with str1,str1Len", sal_False,new OUString( kTestStr2,
- kTestStr2Len,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString
- ), tmpAstr1, kTestStr1Len},
- {"str1 with str2,str1Len", sal_True,new OUString( kTestStr1,
- kTestStr1Len,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString
- ), tmpAstr3, kTestStr1Len},
- {"null with str1,1 ", sal_False, new OUString(), tmpAstr1, 1},
- {"null with '',1 ", sal_False, new OUString(), tmpAstr2, 1},
- {"'' with '', 1", sal_False, new OUString( "",
- 0,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString
- ),
- tmpAstr2, 1}
-
- };
-
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
-
- sal_Bool lastRes = (arrTestCase[i].expVal ==
- arrTestCase[i].input1->equalsAsciiL(arrTestCase[i].input2,
- arrTestCase[i].cmpLen)
- );
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "equalsAsciiL", i )
-
- );
- res &= lastRes;
- }
- c_rtl_tres_state_end( hRtlTestResult, "equalsAsciiL");
-// return ( res );
-}
-
-//------------------------------------------------------------------------
-// testing the method sal_Int32 compareToAscii( const sal_Char* asciiStr )
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_compareToAscii(
- hTestResult hRtlTestResult)
-{
- c_rtl_tres_state_start( hRtlTestResult, "compareToAscii");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- const sal_Char *tmpAstr1="Sun Microsystems\0";
- const sal_Char *tmpAstr2="\0";
- const sal_Char *tmpAstr3="sun microsystems java technology\0";
- const sal_Char *tmpAstr4="Sun Microsystems Java Technology\0";
-
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Int32 expVal;
- OUString* input1;
- const sal_Char* input2;
- ~TestCase() { delete input1;}
- } TestCase;
-
- TestCase arrTestCase[]={
- {"str1 with str1 ", 0, new OUString( kTestStr1,
- kTestStr1Len,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString
- ), tmpAstr1},
- {"str1 with '' ", 83, new OUString( kTestStr1,
- kTestStr1Len,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString
- ), tmpAstr2},
- {"null with str1 ", -83 , new OUString(), tmpAstr1},
- {"null with '' ", 0, new OUString(), tmpAstr2},
- {"str1 with str9", -32, new OUString( kTestStr1,
- kTestStr1Len,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString
- ),
- tmpAstr3},
- {"str1 with str2", -32, new OUString( kTestStr1,
- kTestStr1Len,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString
- ),
- tmpAstr4}
-
- };
-
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Bool lastRes = (arrTestCase[i].expVal ==
- arrTestCase[i].input1->compareToAscii(arrTestCase[i].input2));
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "equalsAscii", i )
-
- );
- res &= lastRes;
- }
- c_rtl_tres_state_end( hRtlTestResult, "compareToAscii");
-// return ( res );
-}
-
-
-//------------------------------------------------------------------------
-// testing the method boolean( sal_Bool b )
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_boolean(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "Bool");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- OUString* expVal;
- sal_Bool input1;
-
- ~TestCase() {delete expVal;}
- }TestCase;
-
- TestCase arrTestCase[]=
- {
- {"input Bool 'true' and return OUString 'true'",
- new OUString("true",4,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString),
- sal_True
- },
- {"input Bool 'false' and return OUString 'false'",
- new OUString("false",5,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString),
- sal_False
- }
- };
-
- sal_Bool res;
- sal_uInt32 i;
-
- for(i=0;i<(sizeof(arrTestCase))/(sizeof(TestCase));i++)
- {
- sal_Bool lastRes=(*arrTestCase[i].expVal==
- OUString::boolean(arrTestCase[i].input1)
-
- );
-
- c_rtl_tres_state(hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "valueOf( sal_Bool b )", i )
- );
-
- res &= lastRes;
- }
- c_rtl_tres_state_end( hRtlTestResult, "Bool");
-// return(res);
-}
-
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_valueOf_sal_Unicode(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "Unicode");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- sal_Unicode tmpchar1=97;
- sal_Unicode tmpchar2=53;
- sal_Unicode tmpchar3=0;
- sal_Unicode tmpchar4=32;
- sal_Unicode tmpchar5=47;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- OUString* expVal;
- sal_Unicode input1;
-
- ~TestCase() {delete expVal;}
- }TestCase;
-
- TestCase arrTestCase[]=
- {
- {"input Unicode 'a' and return OUString 'a'",
- new OUString(&tmpchar1,1),tmpchar1
- },
- {"input Unicode '5' and return OUString '5'",
- new OUString(&tmpchar2,1), tmpchar2
- },
- {"input Unicode 0 and return OUString 0",
- new OUString(&tmpchar3,1),tmpchar3
- },
- {"input Unicode ' ' and return OUString ' '",
- new OUString(&tmpchar4,1),tmpchar4
- },
- {"input Unicode '/' and return OUString ' '",
- new OUString(&tmpchar5,1),tmpchar5
- }
- };
-
- sal_Bool res=sal_True;
- sal_uInt32 i;
-
- for(i=0;i<(sizeof(arrTestCase))/(sizeof(TestCase));i++)
- {
- sal_Bool lastRes=(*(arrTestCase[i].expVal)==
- OUString::valueOf(arrTestCase[i].input1));
-
- c_rtl_tres_state(hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "valueOf( sal_Unicode c )", i )
- );
-
- res &= lastRes;
- }
- c_rtl_tres_state_end( hRtlTestResult, "Unicode");
-// return(res);
-}
-
-
-/**
- * Calls the method valueOf(T, radix) and compares
- * returned ustrings with ustrings that passed in the array resArray.
- *
- * @param T, type of argument, passed to valueOf
- * @param resArray, array of result ustrings to compare to
- * @param n the number of elements in the array resArray (testcases)
- * @param pTestResult the instance of the class TestResult
- * @param inArray [optional], array of value that is passed as first argument
- * to valueOf
- *
- * @return true, if all returned ustrings are equal to corresponding ustring in
- * resArray else, false.
- */
-template <class T>
-sal_Bool test_valueOf( const char** resArray, int n, sal_Int16 radix,
- hTestResult hRtlTestResult, const T *inArray )
-{
- sal_Bool bRes = sal_True;
-
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
- sal_Int32 i;
-// static sal_Unicode aUchar[50]={0x12};
-
- for (i = 0; i < n; i++)
- {
- ::rtl::OUString aStr1;
-
- OSL_ENSURE( i < 50, "ERROR: leave aUchar bound");
-
-// AStringToUStringCopy(aUchar,resArray[i]);
-// ::rtl::OUString aStr2(aUchar);
- rtl::OUString aStr2;
- aStr2 = OUString::createFromAscii(resArray[i]);
-
- ::rtl::OUString aStr3( "-",1,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString);
-
- if (inArray == 0)
- {
- aStr1 = ::rtl::OUString::valueOf((T)i, radix);
- }
- else
- {
- if ( inArray[i] < 0 )
- {
- sal_Unicode aStr4[100];
- OSL_ASSERT(strlen(resArray[i]) < 100);
-
- if(AStringToUStringCopy(aStr4,resArray[i]))
- {
- aStr2 = aStr3;
- aStr2 += aStr4;
- }
-
- }
- aStr1 = ::rtl::OUString::valueOf((T)inArray[i], radix);
- }
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- aStr2.compareTo(aStr1) == 0,
- (sal_Char*)resArray[i],
- createName( pMeth, "valueOf", i )
- );
- }
-
- return (bRes);
-}
-
-
-#define test_valueOf_Int32 test_valueOf<sal_Int32>
-#define test_valueOf_Int64 test_valueOf<sal_Int64>
-
-//------------------------------------------------------------------------
-// testing the method valueOf( sal_Int32 i, sal_Int16 radix=2 )
-// testing the method valueOf( sal_Int32 i, sal_Int16 radix=8 )
-// testing the method valueOf( sal_Int32 i, sal_Int16 radix=10 )
-// testing the method valueOf( sal_Int32 i, sal_Int16 radix=16 )
-// testing the method valueOf( sal_Int32 i, sal_Int16 radix=36 )
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OUString_valueOf_Int32(
- hTestResult hRtlTestResult )
-{
- sal_Bool bRes = sal_False;
-
- bRes = c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32((const char**)kBinaryNumsStr,
- kBinaryNumsCount, kRadixBinary, hRtlTestResult, 0 ),
- "kRadixBinary",
- "valueOf(sal_Int32, radix 2)"
- );
-
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32((const char**)kOctolNumsStr,
- kOctolNumsCount, kRadixOctol, hRtlTestResult, 0),
- "kRadixOctol",
- "valueOf(sal_Int32, radix 8)"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32((const char**)kDecimalNumsStr,
- kDecimalNumsCount, kRadixDecimal, hRtlTestResult, 0),
- "kRadixDecimal",
- "valueOf(sal_Int32, radix 10)"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32((const char**)kHexDecimalNumsStr,
- kHexDecimalNumsCount, kRadixHexdecimal, hRtlTestResult, 0),
- "kRadixHexdecimal",
- "valueOf(sal_Int32, radix 16)"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32((const char**)kBase36NumsStr,
- kBase36NumsCount, kRadixBase36, hRtlTestResult, 0),
- "kRadixBase36",
- "valueOf(sal_Int32, radix 36)"
- );
-
-
- return ( bRes );
-}
-
-//------------------------------------------------------------------------
-// testing the method valueOf( sal_Int32 l, sal_Int32 radix=2 )
-// where l = large constants
-// testing the method valueOf( sal_Int32 l, sal_Int32 radix=8 )
-// where l = large constants
-// testing the method valueOf( sal_Int32 l, sal_Int32 radix=10 )
-// where l = large constants
-// testing the method valueOf( sal_Int32 l, sal_Int32 radix=16 )
-// where l = large constants
-// testing the method valueOf( sal_Int32 l, sal_Int32 radix=36 )
-// where l = large constants
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OUString_valueOf_Int32_Bounderies(
- hTestResult hRtlTestResult )
-{
- sal_Bool bRes = sal_False;
-
- bRes = c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32((const char**)kBinaryMaxNumsStr,
- kInt32MaxNumsCount, kRadixBinary,
- hRtlTestResult, kInt32MaxNums),
- "kRadixBinary",
- "valueOf(salInt32, radix 2) Bounderies"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32((const char**)kOctolMaxNumsStr,
- kInt32MaxNumsCount, kRadixOctol,
- hRtlTestResult, kInt32MaxNums),
- "kRadixOctol",
- "valueOf(salInt32, radix 8) Bounderies"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32((const char**)kDecimalMaxNumsStr,
- kInt32MaxNumsCount, kRadixDecimal,
- hRtlTestResult, kInt32MaxNums),
- "kRadixDecimal",
- "valueOf(salInt32, radix 10) Bounderies"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32((const char**)kHexDecimalMaxNumsStr,
- kInt32MaxNumsCount, kRadixHexdecimal,
- hRtlTestResult, kInt32MaxNums),
- "kRadixHexdecimal",
- "valueOf(salInt32, radix 16) Bounderies"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32((const char**)kBase36MaxNumsStr,
- kInt32MaxNumsCount, kRadixBase36,
- hRtlTestResult, kInt32MaxNums),
- "kRadixBase36",
- "valueOf(salInt32, radix 36) Bounderies"
- );
-
- return ( bRes );
-}
-
-//------------------------------------------------------------------------
-// testing the method valueOf( sal_Int32 i, sal_Int16 radix=2 )
-// for negative value
-// testing the method valueOf( sal_Int32 i, sal_Int16 radix=8 )
-// for negative value
-// testing the method valueOf( sal_Int32 i, sal_Int16 radix=10 )
-// for negative value
-// testing the method valueOf( sal_Int32 i, sal_Int16 radix=16 )
-// for negative value
-// testing the method valueOf( sal_Int32 i, sal_Int16 radix=36 )
-// for negative value
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OUString_valueOf_Int32_Negative(
- hTestResult hRtlTestResult )
-{
- sal_Bool bRes = sal_False;
- sal_Int32 inArr[kBase36NumsCount];
- sal_Int32 i;
-
- for (i = 0; i < kBase36NumsCount; i++ )
- inArr[i] = -i;
-
- bRes = c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32( kBinaryNumsStr, kBinaryNumsCount,
- kRadixBinary, hRtlTestResult, inArr ),
- "negative Int32, kRadixBinary",
- "valueOf( negative Int32, radix 2 )"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32( kOctolNumsStr, kOctolNumsCount,
- kRadixOctol, hRtlTestResult, inArr ),
- "negative Int32, kRadixOctol",
- "valueOf( negative Int32, radix 8 )"
- );
-
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32( kDecimalNumsStr, kDecimalNumsCount,
- kRadixDecimal, hRtlTestResult, inArr ),
- "negative Int32, kRadixDecimal",
- "valueOf( negative Int32, radix 10 )"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32( kHexDecimalNumsStr, kHexDecimalNumsCount,
- kRadixHexdecimal, hRtlTestResult, inArr ),
- "negative Int32, kRadixHexdecimal",
- "valueOf( negative Int32, radix 16 )"
- );
-
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int32( kBase36NumsStr, kBase36NumsCount,
- kRadixBase36, hRtlTestResult, inArr ),
- "negative Int32, kRadixBase36",
- "valueOf( negative Int32, radix 36 )"
- );
-
- return ( bRes );
-}
-//------------------------------------------------------------------------
-// testing the method valueOf( sal_Int32 l, sal_Int32 radix ) where radix = -5
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OUString_valueOf_Int32_WrongRadix(
- hTestResult hRtlTestResult )
-{
- sal_Bool bRes = sal_False;
-
- sal_Int32 intVal = 11;
-
- ::rtl::OUString aStr1;
- ::rtl::OUString aStr2("11",2,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString);
-
- aStr1 = aStr1.valueOf( intVal, -5 );
-
- bRes = c_rtl_tres_state
- (
- hRtlTestResult,
- aStr2.compareTo( aStr1 ) == 0,
- "if radix not valid then radix must be 10",
- "valueOf(sal_Int32, sal_Int32 radix): radix = -5"
- );
-
- return (bRes);
-}
-
-
-//------------------------------------------------------------------------
-static sal_Bool SAL_CALL test_rtl_OUString_valueOf_Int32_defaultParam(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- sal_Char* newUChar1="15";
- sal_Char* newUChar2="0";
- sal_Char* newUChar3="-15";
- sal_Char* newUChar4="2147483647";
- sal_Char* newUChar5="-2147483648";
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Int32 input1;
- OUString* expVal;
- ~TestCase() {delete expVal;}
- }TestCase;
-
- TestCase arrTestCase[]=
- {
- {"input Int32 15 and return OUString 15",15,
- new OUString(newUChar1,2,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)
- },
- {"input Int32 0 and return OUString 0",0,
- new OUString(newUChar2,1,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)
- },
- {"input Int32 -15 and return OUString -15",-15,
- new OUString(newUChar3,3,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)
- },
- {"input Int32 2147483647 and return OUString 2147483647", SAL_MAX_INT32 /* 2147483647 */,
- new OUString(newUChar4,10,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)
- },
- {"input Int32 -2147483648 and return OUString -2147483648",
- SAL_MIN_INT32 /* 2-2147483648 */,
- new OUString(newUChar5,11,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)
- }
- };
-
- sal_Bool res=sal_True;
- sal_uInt32 i;
-
- for(i=0;i<(sizeof(arrTestCase))/(sizeof(TestCase));i++)
- {
- sal_Bool lastRes=(*(arrTestCase[i].expVal)==
- OUString::valueOf(arrTestCase[i].input1));
-
- c_rtl_tres_state(hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth,
- "valueOf( sal_Int32 i, sal_Int16 radix = 10 )", i )
- );
-
- res &= lastRes;
- }
-
- return(res);
-
-}
-//------------------------------------------------------------------------
-// testing the method valueOf( sal_Int64 l, sal_Int16 radix=2 )
-// testing the method valueOf( sal_Int64 l, sal_Int16 radix=8 )
-// testing the method valueOf( sal_Int64 l, sal_Int16 radix=10 )
-// testing the method valueOf( sal_Int64 l, sal_Int16 radix=16 )
-// testing the method valueOf( sal_Int64 l, sal_Int16 radix=36 )
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OUString_valueOf_Int64(
- hTestResult hRtlTestResult )
-{
- sal_Bool bRes = sal_False;
-
- bRes = c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64((const char**)kBinaryNumsStr,
- kBinaryNumsCount, kRadixBinary, hRtlTestResult, 0),
- "kRadixBinary",
- "valueOf(sal_Int64, radix 2)_"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64((const char**)kOctolNumsStr,
- kOctolNumsCount, kRadixOctol, hRtlTestResult, 0),
- "kRadixOctol",
- "valueOf(sal_Int64, radix 8)_"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64((const char**)kDecimalNumsStr,
- kDecimalNumsCount, kRadixDecimal, hRtlTestResult, 0),
- "kRadixDecimal",
- "valueOf(sal_Int64, radix 10)_"
- );
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64((const char**)kHexDecimalNumsStr,
- kHexDecimalNumsCount, kRadixHexdecimal, hRtlTestResult, 0),
- "kRadixHexdecimal",
- "valueOf(sal_Int64, radix 16)_"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64((const char**)kBase36NumsStr,
- kBase36NumsCount, kRadixBase36, hRtlTestResult, 0),
- "kRadixBase36",
- "valueOf(sal_Int64, radix 36)_"
- );
-
- return (bRes);
-}
-
-//------------------------------------------------------------------------
-// testing the method valueOf( sal_Int64 l, sal_Int32 radix=2 )
-// where l = large constants
-// testing the method valueOf( sal_Int64 l, sal_Int32 radix=8 )
-// where l = large constants
-// testing the method valueOf( sal_Int64 l, sal_Int32 radix=10 )
-// where l = large constants
-// testing the method valueOf( sal_Int64 l, sal_Int32 radix=16 )
-// where l = large constants
-// testing the method valueOf( sal_Int64 l, sal_Int32 radix=36 )
-// where l = large constants
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OUString_valueOf_Int64_Bounderies(
- hTestResult hRtlTestResult )
-{
- sal_Bool bRes = sal_False;
-
- bRes = c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64((const char**)kBinaryMaxNumsStr,
- kInt64MaxNumsCount, kRadixBinary,
- hRtlTestResult, kInt64MaxNums),
- "kRadixBinary",
- "valueOf(salInt64, radix 2) Bounderies"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64((const char**)kOctolMaxNumsStr,
- kInt64MaxNumsCount, kRadixOctol,
- hRtlTestResult, kInt64MaxNums),
- "kRadixOctol",
- "valueOf(salInt64, radix 8) Bounderies"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64((const char**)kDecimalMaxNumsStr,
- kInt64MaxNumsCount, kRadixDecimal,
- hRtlTestResult, kInt64MaxNums),
- "kRadixDecimal",
- "valueOf(salInt64, radix 10) Bounderies"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64((const char**)kHexDecimalMaxNumsStr,
- kInt64MaxNumsCount, kRadixHexdecimal,
- hRtlTestResult, kInt64MaxNums),
- "kRadixHexdecimal",
- "valueOf(salInt64, radix 16) Bounderies"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64((const char**)kBase36MaxNumsStr,
- kInt64MaxNumsCount, kRadixBase36,
- hRtlTestResult, kInt64MaxNums),
- "kRadixBase36",
- "valueOf(salInt64, radix 36) Bounderies"
- );
-
- return ( bRes );
-}
-
-//------------------------------------------------------------------------
-// testing the method valueOf( sal_Int64 l, sal_Int16 radix=2 )
-// for negative value
-// testing the method valueOf( sal_Int64 l, sal_Int16 radix=8 )
-// for negative value
-// testing the method valueOf( sal_Int64 l, sal_Int16 radix=10 )
-// for negative value
-// testing the method valueOf( sal_Int64 l, sal_Int16 radix=16 )
-// for negative value
-// testing the method valueOf( sal_Int64 l, sal_Int16 radix=36 )
-// for negative value
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OUString_valueOf_Int64_Negative(
- hTestResult hRtlTestResult )
-{
- sal_Bool bRes = sal_False;
-
- sal_Int64 inArr[36];
- sal_Int32 i;
-
- for (i = 0; i < 36; i++) {
- inArr[i] = -i;
- }
-
-
- bRes = c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64( kBinaryNumsStr, kBinaryNumsCount,
- kRadixBinary, hRtlTestResult, inArr ),
- "negative Int64, kRadixBinary",
- "valueOf( negative Int64, radix 2 )"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64( kOctolNumsStr, kOctolNumsCount,
- kRadixOctol, hRtlTestResult, inArr ),
- "negative Int64, kRadixOctol",
- "valueOf( negative Int64, radix 8 )"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64( kDecimalNumsStr, kDecimalNumsCount,
- kRadixDecimal, hRtlTestResult, inArr ),
- "negative Int64, kRadixDecimal",
- "valueOf( negative Int64, radix 10 )"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64( kHexDecimalNumsStr, kHexDecimalNumsCount,
- kRadixHexdecimal, hRtlTestResult, inArr ),
- "negative Int64, kRadixHexDecimal",
- "valueOf( negative Int64, radix 16 )"
- );
-
- bRes &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_valueOf_Int64( kBase36NumsStr, kBase36NumsCount,
- kRadixBase36, hRtlTestResult, inArr),
- "negative Int64, kRadixBase36",
- "valueOf( negative Int64, radix 36 )"
- );
-
- return (bRes);
-}
-//------------------------------------------------------------------------
-// testing the method valueOf( sal_Int64 l, sal_Int32 radix )
-// where radix = -5
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OUString_valueOf_Int64_WrongRadix(
- hTestResult hRtlTestResult )
-{
- sal_Bool bRes = sal_False;
-
- sal_Int64 intVal = 11;
-
- ::rtl::OUString aStr1;
- ::rtl::OUString aStr2("11",2,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString);
-
- aStr1 = aStr1.valueOf( intVal, -5 );
-
- bRes = c_rtl_tres_state
- (
- hRtlTestResult,
- aStr2.compareTo(aStr1) == 0,
- "if radix not valid then radix must be 10",
- "valueOf(sal_Int64, sal_Int32 radix): radix = -5"
- );
-
- return (bRes);
-}
-
-//------------------------------------------------------------------------
-static sal_Bool SAL_CALL test_rtl_OUString_valueOf_Int64_defaultParam(
- hTestResult hRtlTestResult )
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- sal_Char* newUChar1="15";
- sal_Char* newUChar2="0";
- sal_Char* newUChar3="-15";
- sal_Char* newUChar4= "9223372036854775807";
- sal_Char* newUChar5="-9223372036854775808";
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Int64 input1;
- OUString* expVal;
- ~TestCase() {delete expVal;}
- }TestCase;
-
- TestCase arrTestCase[]=
- {
- {"input Int64 15 and return OUString 15",15,
- new OUString(newUChar1,2,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)
- },
- {"input Int64 0 and return OUString 0",0,
- new OUString(newUChar2,1,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)
- },
- {"input Int64 -15 and return OUString -15",-15,
- new OUString(newUChar3,3,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)
- },
- {"input Int64 9223372036854775807 and return 9223372036854775807",
- SAL_MAX_INT64 /* 9223372036854775807*/,
- new OUString(newUChar4,19,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)
- },
- {"input Int64 -9223372036854775808 and return -9223372036854775808",
- SAL_MIN_INT64 /* 9223372036854775808*/,
- new OUString(newUChar5,20,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)
- }
- };
-
- sal_Bool res=sal_True;
- sal_uInt32 i;
-
- for(i=0;i<(sizeof(arrTestCase))/(sizeof(TestCase));i++)
- {
- sal_Bool lastRes=(*(arrTestCase[i].expVal)==
- OUString::valueOf(arrTestCase[i].input1));
-
- c_rtl_tres_state(hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth,
- "valueOf( sal_Int64 i, sal_Int16 radix = 10 )", i )
- );
-
- res &= lastRes;
- }
-
- return(res);
-
-}
-
-//------------------------------------------------------------------------
-// testing the method valueOf()
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_valueOf(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "valueOf");
- sal_Bool bTState = test_rtl_OUString_valueOf_Int32( hRtlTestResult );
- bTState &= test_rtl_OUString_valueOf_Int32_Bounderies( hRtlTestResult );
- bTState &= test_rtl_OUString_valueOf_Int32_Negative( hRtlTestResult );
- bTState &= test_rtl_OUString_valueOf_Int32_WrongRadix( hRtlTestResult );
- bTState &= test_rtl_OUString_valueOf_Int32_defaultParam(
- hRtlTestResult );
- bTState &= test_rtl_OUString_valueOf_Int64( hRtlTestResult );
- bTState &= test_rtl_OUString_valueOf_Int64_Bounderies( hRtlTestResult );
- bTState &= test_rtl_OUString_valueOf_Int64_Negative( hRtlTestResult );
- bTState &= test_rtl_OUString_valueOf_Int64_WrongRadix( hRtlTestResult );
- bTState &= test_rtl_OUString_valueOf_Int64_defaultParam(
- hRtlTestResult );
-
- c_rtl_tres_state_end( hRtlTestResult, "valueOf");
-// return ( bTState );
-}
-//------------------------------------------------------------------------
-// this is my testing code
-// testing the method createFromAscii( const sal_Char * value )
-//------------------------------------------------------------------------
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_createFromAscii(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "createFromAscii");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
-
- typedef struct TestCase
- {
- sal_Char* comments;
- const sal_Char* input1;
- OUString* expVal;
- ~TestCase() {delete expVal;}
-
- }TestCase;
-
- TestCase arrTestCase[]=
- {
-
- { "create OUString from sal_Char" ,kTestStr1,
- new OUString(kTestStr1,kTestStr1Len,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)
- },
- {
- "create OUString from empty", "",
- new OUString()
- },
- {
- "create OUString from empty(string arg = '\\0')","",
- new OUString("",0,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)
- }
-
- };
-
- sal_Bool res;
- sal_uInt32 i;
-
- for(i=0;i<(sizeof(arrTestCase))/(sizeof(TestCase));i++)
- {
- sal_Bool lastRes=(*(arrTestCase[i].expVal)==
- OUString::createFromAscii(arrTestCase[i].input1));
-
-
- {
- c_rtl_tres_state(hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "createFromAscii", i )
- );
- }
-
- res&=lastRes;
-
- }
-
- c_rtl_tres_state_end( hRtlTestResult, "createFromAscii");
-// return(res);
-}
-//------------------------------------------------------------------------
-// testing the method index( )
-//------------------------------------------------------------------------
-template <class T>
-sal_Bool test_index( const T* input1, int num,const sal_Int32* input2,
- const sal_Int32* expVal,int base,rtlTestResult hRtlTestResult)
-{
- sal_Bool res=sal_True;
- sal_Char methName[MAXBUFLENGTH];
- sal_Char *meth = '\0';
- sal_Char* pMeth=methName;
- sal_Int32 i;
- sal_Bool lastRes=sal_False;
-
- for(i=0;i<num;i++)
- {
- OUString str(aUStr2);
-
- if(base==0)
- {
- lastRes=(str.indexOf(input1[i])==expVal[i]);
- meth="indexOf_001";
- }
- if(base==1)
- {
- lastRes=(str.indexOf(input1[i],input2[i])==expVal[i]);
- meth="indexOf_002";
- }
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- "index",
- createName( pMeth,meth, i )
- );
-
- res &= lastRes;
- }
-
- return( res );
-}
-template <class T>
-sal_Bool test_indexStr( const T** input1, int num,const sal_Int32* input2,
- const sal_Int32* expVal,int base,rtlTestResult hRtlTestResult)
-{
- sal_Bool res=sal_True;
- sal_Char methName[MAXBUFLENGTH];
- sal_Char *meth = '\0';
- sal_Char* pMeth=methName;
- sal_Int32 i;
- sal_Bool lastRes=sal_False;
-
- for(i=0;i<num;i++)
- {
- OUString str(aUStr2);
-
-
- if(base==0)
- {
- OUString s1(input1[i]);
- lastRes=(str.indexOf(s1)==expVal[i]);
- meth="indexOf_003";
- }
- if(base==1)
- {
- OUString s2(input1[i]);
- lastRes=(str.indexOf(s2,input2[i])==expVal[i]);
- meth="indexOf_004";
- }
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- "index",
- createName( pMeth,meth, i )
- );
-
- res &= lastRes;
- }
-
- return( res );
-}
-//------------------------------------------------------------------------
-// testing the method indexOf( )
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OUString_indexOf_001(
- hTestResult hRtlTestResult )
-{
- sal_Bool bRes=sal_False;
-
- bRes=c_rtl_tres_state
- (
- hRtlTestResult,
- test_index<sal_Unicode>((const sal_Unicode*)input1Default,
- nDefaultCount,input2Default,
- expValDefault,0,hRtlTestResult),
- "index",
- "indexDefault(sal_Unicode ch, sal_Int32 fromIndex = 0)"
- );
-
- return ( bRes );
-}
-//------------------------------------------------------------------------
-// testing the method indexOf( )
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OUString_indexOf_002(
- hTestResult hRtlTestResult )
-{
- sal_Bool bRes=sal_False;
-
- bRes=c_rtl_tres_state
- (
- hRtlTestResult,
- test_index<sal_Unicode>((const sal_Unicode*)input1Normal,
- nNormalCount,input2Normal,
- expValNormal,1,hRtlTestResult),
- "index",
- "indexNormal(sal_Unicode ch, sal_Int32 fromIndex)"
- );
-
- return ( bRes );
-}
-//------------------------------------------------------------------------
-// testing the method indexOf( OUString ch, sal_Int32 fromIndex = 0 )
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OUString_indexOf_003(
- hTestResult hRtlTestResult )
-{
- sal_Bool bRes=sal_False;
-
- bRes=c_rtl_tres_state
- (
- hRtlTestResult,
- test_indexStr<sal_Unicode>((const sal_Unicode**)input1StrDefault,
- nStrDefaultCount,input2StrDefault,
- expValStrDefault,0,hRtlTestResult),
- "index",
- "indexDefault(OUString ch, sal_Int32 fromIndex = 0)"
- );
-
- return ( bRes );
-}
-//------------------------------------------------------------------------
-// testing the method indexOf( OUString ch, sal_Int32 fromIndex )
-//------------------------------------------------------------------------
-sal_Bool SAL_CALL test_rtl_OUString_indexOf_004(
- hTestResult hRtlTestResult )
-{
- sal_Bool bRes=sal_False;
-
- bRes=c_rtl_tres_state
- (
- hRtlTestResult,
- test_indexStr<sal_Unicode>((const sal_Unicode**)input1StrNormal,
- nStrNormalCount,input2StrNormal,
- expValStrNormal,1,hRtlTestResult),
- "indexOf",
- "indexOf(OUString ch, sal_Int32 fromIndex)"
- );
-
- return ( bRes );
-}
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_indexOf(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "indexOf");
- sal_Bool res = test_rtl_OUString_indexOf_001(hRtlTestResult);
- res &= test_rtl_OUString_indexOf_002(hRtlTestResult);
- res &= test_rtl_OUString_indexOf_003(hRtlTestResult);
- res &= test_rtl_OUString_indexOf_004(hRtlTestResult);
- c_rtl_tres_state_end( hRtlTestResult, "indexOf");
-// return ( res );
-}
-//------------------------------------------------------------------------
-// testing the method concat( const OString & aStr )
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_concat(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "concat");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth =methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- OUString* expVal;
- OUString* input1;
- OUString* input2;
- ~TestCase() { delete input1;delete input2; delete expVal;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"concatenates two ustrings",new OUString(aUStr1),
- new OUString(aUStr7), new OUString(aUStr8)},
- {"concatenates empty ustring",new OUString(aUStr1),
- new OUString(aUStr1), new OUString("",0,
- kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString)},
- {"concatenates to empty ustring",new OUString(aUStr1),new OUString("",
- 0,kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),
- new OUString(aUStr1)},
- {"concatenates two empty ustrings",new OUString("",0,
- kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),
- new OUString("",0,
- kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),
- new OUString("",0,
- kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString)},
- {"concatenates ustring constructed by default constructor",
- new OUString(aUStr1),new OUString(aUStr1), new OUString()},
- {"concatenates to ustring constructed by default constructor",
- new OUString(aUStr1),new OUString(), new OUString(aUStr1)},
- {"concatenates two ustrings constructed by default constructor",
- new OUString(),new OUString(), new OUString()}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- OUString str = arrTestCase[i].input1->concat(*arrTestCase[i].input2);
- sal_Bool lastRes = (str == *arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "concat", i)
- );
-
- res &= lastRes;
-
- }
- c_rtl_tres_state_end( hRtlTestResult, "concat");
-// return ( res );
-}
-//------------------------------------------------------------------------
-// testing the method replaceAt( sal_Int32 index, sal_Int32 count,
-// const OUString& newStr )
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_replaceAt(
- rtlTestResult hRtlTestResult)
-{
- c_rtl_tres_state_start( hRtlTestResult, "replaceAt");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- OUString* expVal;
- OUString* input;
- OUString* newStr;
- sal_Int32 index;
- sal_Int32 count;
-
- ~TestCase() { delete input; delete expVal; delete newStr;}
- } TestCase;
-
- TestCase arrTestCase[]=
- {
-
- { "string differs", new OUString(aUStr2), new OUString(aUStr22),
- new OUString(aUStr2), 0, kTestStr22Len },
-
- { "larger index", new OUString(aUStr1), new OUString(aUStr7),
- new OUString(aUStr8), 64, kTestStr8Len },
-
- { "larger count", new OUString(aUStr2), new OUString(aUStr22),
- new OUString(aUStr2),0, 64 },
-
- { "navigate index", new OUString(aUStr2), new OUString(aUStr22),
- new OUString(aUStr2), -64, 64 },
-
- { "null ustring",
- new OUString("",0,
- kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),
- new OUString(aUStr14),
- new OUString("",0,
- kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),
- 0, kTestStr14Len }
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- ::rtl::OUString aStr1;
- aStr1 = arrTestCase[i].input->replaceAt( arrTestCase[i].index,
- arrTestCase[i].count, *arrTestCase[i].newStr );
-
- sal_Bool lastRes = ( arrTestCase[i].expVal->compareTo(aStr1) == 0 );
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "replaceAt", i )
-
- );
- res &= lastRes;
- }
-
- c_rtl_tres_state_end( hRtlTestResult, "replaceAt");
-// return ( res );
-}
-//------------------------------------------------------------------------
-// this is my testing code
-// testing the method replace( sal_Unicode oldChar, sal_Unicode newChar )
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_replace(
- hTestResult hRtlTestResult)
-{
- c_rtl_tres_state_start( hRtlTestResult, "replace");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- OUString* expVal;
- OUString* input;
- sal_Unicode oldChar;
- sal_Unicode newChar;
-
- ~TestCase() { delete input; delete expVal;}
- } TestCase;
-
- TestCase arrTestCase[]=
- {
- {"ustring differs", new OUString(aUStr18), new OUString(aUStr4),83,115},
- {"ustring differs", new OUString(aUStr19), new OUString(aUStr17),32,45},
- {"ustring must be empty", new OUString("",0,
- kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),
- new OUString("",0,
- kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),83,23},
- {"ustring must be empty", new OUString(),
- new OUString("",0,
- kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),83,23},
- {"same ustring, no replace ", new OUString(aUStr22),
- new OUString(aUStr22),42,56}
- };
-
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- ::rtl::OUString aStr1;
- aStr1= arrTestCase[i].input->replace(arrTestCase[i].oldChar,arrTestCase[i].newChar);
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- (arrTestCase[i].expVal->compareTo(aStr1) == 0),
- arrTestCase[i].comments,
- createName( pMeth, "replace", i )
-
- );
- }
- c_rtl_tres_state_end( hRtlTestResult, "replace");
-// return ( res );
-}
-//------------------------------------------------------------------------
-// testing the method toAsciiLowerCase()
-//-----------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_toAsciiLowerCase(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "toAsciiLowerCase");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth =methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- OUString* expVal;
- OUString* input1;
- ~TestCase() { delete input1; delete expVal;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
-
- {"only uppercase",new OUString(aUStr5),new OUString(aUStr4)},
- {"different cases",new OUString(aUStr5),new OUString(aUStr1)},
- {"different cases",new OUString(aUStr5),new OUString(aUStr3)},
- {"only lowercase",new OUString(aUStr5),new OUString(aUStr5)},
- {"empty ustring",new OUString("",0,
- kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),
- new OUString("",0,
- kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString)},
- {"ustring constructed by default constructor",new OUString(),
- new OUString()},
- {"have special Unicode",new OUString("\23\12\34sun\13\45",6,
- kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),
- new OUString("\23\12\34sun\13\45",6,
- kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString)}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
- sal_Bool lastRes=sal_False;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- OUString str = arrTestCase[i].input1->toAsciiLowerCase();
- if(i<=5)
- {
- lastRes = (str ==* arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "toAsciiLowerCase", i)
- );
- }
- else
- {
- c_rtl_tres_state
- (
- hRtlTestResult,
- sal_True,
- arrTestCase[i].comments,
- createName( pMeth, "toAsciiLowerCase", i)
- );
- }
- res &= lastRes;
- }
- c_rtl_tres_state_end( hRtlTestResult, "toAsciiLowerCase");
-// return ( res );
-}
-//------------------------------------------------------------------------
-// testing the method toAsciiUpperCase()
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_toAsciiUpperCase(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "toAsciiUpperCase");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth =methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- OUString* expVal;
- OUString* input1;
- ~TestCase() { delete input1; delete expVal;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"only lowercase",new OUString(aUStr4),new OUString(aUStr5)},
- {"mixed cases",new OUString(aUStr4),new OUString(aUStr3)},
- {"mixed cases",new OUString(aUStr4),new OUString(aUStr1)},
- {"only uppercase",new OUString(aUStr4),new OUString(aUStr4)},
- {"empty ustring",new OUString("",0,
- kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),
- new OUString("",0,
- kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString)},
- {"ustring constructed by default constructor",new OUString(),
- new OUString()},
- {"have special Unicode",new OUString("\23\12\34SUN\13\45",6,
- kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString),
- new OUString("\23\12\34sun\13\45",6,
- kEncodingRTLTextUSASCII,kConvertFlagsOStringToOUString)}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
- sal_Bool lastRes=sal_False;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- OUString str = arrTestCase[i].input1->toAsciiUpperCase();
- if(i<=5)
- {
- lastRes = (str == *arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "toAsciiUpperCase", i)
- );
- }
- else
- {
- c_rtl_tres_state
- (
- hRtlTestResult,
- sal_True,
- arrTestCase[i].comments,
- createName( pMeth, "toAsciiUpperCase", i)
- );
- }
-
- res &= lastRes;
- }
- c_rtl_tres_state_end( hRtlTestResult, "toAsciiUpperCase");
-// return ( res );
-}
-
-//------------------------------------------------------------------------
-// testing the method trim()
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_trim(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "trim");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth =methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- OUString* expVal;
- OUString* input1;
- ~TestCase() { delete input1; delete expVal;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"removes space from the front",new OUString(aUStr1),
- new OUString(aUStr10)},
- {"removes space from the end",new OUString(aUStr1),
- new OUString(aUStr11)},
- {"removes space from the front and end",new OUString(aUStr1),
- new OUString(aUStr12)},
- {"removes several spaces from the end",new OUString(aUStr1),
- new OUString(aUStr13)},
- {"removes several spaces from the front",new OUString(aUStr1),
- new OUString(aUStr14)},
- {"removes several spaces from the front and one from the end",
- new OUString(aUStr1),
- new OUString(aUStr15)},
- {"removes one space from the front and several from the end",
- new OUString(aUStr1),
- new OUString(aUStr16)},
- {"removes several spaces from the front and end",
- new OUString(aUStr1),
- new OUString(aUStr17)},
- {"removes characters that have codes <= 32",new OUString(aUStr30),
- new OUString("\1\3\5\7\11\13\15\17sun\21\23\25\27\31\33\50",
- 18,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)},
- {"removes characters that have codes <= 32",new OUString(aUStr28),
- new OUString("\50\3\5\7\11\13\15\17sun\21\23\25\27\31\33\1",
- 18,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)},
- {"removes characters that have codes <= 32",new OUString(aUStr29),
- new OUString("\50\3\5\7\11\13\15\17sun\21\23\25\27\31\33\50",
- 18,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)},
- {"removes characters that have codes <= 32",new OUString(aUStr20),
- new OUString("\1\3\5\7\11\13\15\17sun\21\23\25\27\31\23\20",
- 18,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)},
- {"no spaces",new OUString(aUStr8),
- new OUString(aUStr8)}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- OUString strRes = arrTestCase[i].input1->trim();
- sal_Bool lastRes = (strRes == *arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "trim", i)
- );
-
- res &= lastRes;
-
- }
- c_rtl_tres_state_end( hRtlTestResult, "trim");
-// return ( res );
-}
-//------------------------------------------------------------------------
-// testing the method toData()
-//------------------------------------------------------------------------
-
-template <class T>
-sal_Bool test_toData( const char** input, int num, sal_Int16 radix,
- const T* expVal,int base,
- const T* _fPrecision,
- rtlTestResult hRtlTestResult)
-{
- (void)_fPrecision;
- sal_Bool res=sal_True;
- sal_Char methName[MAXBUFLENGTH];
- sal_Char *meth = '\0';
- sal_Char* pMeth=methName;
- sal_Int32 i;
- T intRes;
- sal_Bool lastRes=sal_False;
-
- for(i=0;i<num;i++)
- {
- OSL_ENSURE( i < 60, "ERROR: leave aUchar bound");
-
- OUString str;
- str = OUString::createFromAscii(input[i]);
-
-
- if(base==0)
- {
- intRes=static_cast<T>(str.toInt32());
- lastRes=(intRes==expVal[i]);
- meth="toInt32default";
- }
- if(base==1)
- {
- intRes=static_cast<T>(str.toInt32(radix));
- lastRes=(intRes==expVal[i]);
- meth="toInt32normal";
- }
- if(base==2)
- {
- intRes=static_cast<T>(str.toInt64());
- lastRes=(intRes==expVal[i]);
- meth="toInt64default";
- }
- if(base==3)
- {
- intRes=static_cast<T>(str.toInt64(radix));
- lastRes=(intRes==expVal[i]);
- meth="toInt64normal";
- }
- // base 4: does no longer exist, moved to rtl/oustring
- // base 5: dt:20040802 create compile problems within wntmsci10
- if(base==6)
- {
- intRes=str.toChar();
- lastRes=(intRes==expVal[i]);
- meth="toChar";
- }
-
- char buf[MAXBUFLENGTH];
- buf[0] = '\'';
- cpynstr( buf + 1, input[i], MAXBUFLENGTH );
- int length = AStringLen( input[i] );
- buf[length + 1] = '\'';
- buf[length + 2] = 0;
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- buf,
- createName( pMeth,meth, i )
- );
-
- res &= lastRes;
- }
-
- return( res );
-}
-//------------------------------------------------------------------------
-// testing the method toChar()
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_toChar(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "toChar");
- sal_Bool bRes=sal_False;
-
- bRes=c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Unicode>((const char**)inputChar,nCharCount,
- 10,expValChar,6,NULL,hRtlTestResult),
- "toChar",
- "toChar()"
- );
-
- c_rtl_tres_state_end( hRtlTestResult, "toChar");
-// return ( bRes );
-
-}
-//------------------------------------------------------------------------
-// testing the method toBoolean()
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_toBoolean(
- hTestResult hRtlTestResult)
-{
- c_rtl_tres_state_start( hRtlTestResult, "toBoolean");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Bool expVal;
- OUString* input;
-
- ~TestCase() {delete input;}
- }TestCase;
-
- TestCase arrTestCase[]={
-
- {"expected true", sal_True, new OUString("True",4,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)},
- {"expected false", sal_False, new OUString("False",5,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)},
- {"expected true", sal_True, new OUString("1",1,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Bool bRes = arrTestCase[i].input->toBoolean();
- sal_Bool lastRes = (bRes == arrTestCase[i].expVal);
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "toBoolean", i )
-
- );
- res &= lastRes;
- }
- c_rtl_tres_state_end( hRtlTestResult, "toBoolean");
-// return ( res );
-}
-//------------------------------------------------------------------------
-// testing the method toInt32()
-//------------------------------------------------------------------------
-
-sal_Bool SAL_CALL test_rtl_OUString_toInt32_normal(
- hTestResult hRtlTestResult )
-{
- sal_Int32 expValues[kBase36NumsCount];
- sal_Int32 i;
-
- for ( i = 0; i < kBase36NumsCount; i++ )
- expValues[i] = i;
-
- sal_Bool res = c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int32>( kBinaryNumsStr,kBinaryNumsCount,
- kRadixBinary,expValues,1,NULL,hRtlTestResult ),
- "kBinaryNumsStr",
- "toInt32( radix 2 )"
- );
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int32>( kBinaryMaxNumsStr,kInt32MaxNumsCount,
- kRadixBinary,kInt32MaxNums,1,NULL,hRtlTestResult ),
- "kBinaryMaxNumsStr",
- "toInt32_Boundaries( radix 2 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int32>( kOctolNumsStr,kOctolNumsCount,
- kRadixOctol,expValues,1,NULL,hRtlTestResult ),
- "kOctolNumsStr",
- "toInt32( radix 8 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int32>( kOctolMaxNumsStr,kInt32MaxNumsCount,
- kRadixOctol,(sal_Int32*)kInt32MaxNums,1,NULL,hRtlTestResult ),
- "kOctolMaxNumsStr",
- "toInt32_Boundaries( radix 8 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int32>( kDecimalNumsStr,kDecimalNumsCount,
- kRadixDecimal,expValues,1,NULL,hRtlTestResult ),
- "kDecimalNumsStr",
- "toInt32( radix 10 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int32>( kDecimalMaxNumsStr,kInt32MaxNumsCount,
- kRadixDecimal,(sal_Int32*)kInt32MaxNums,1,NULL,hRtlTestResult ),
- "kDecimalMaxNumsStr",
- "toInt32_Boundaries( radix 10 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int32>( kHexDecimalNumsStr,kHexDecimalNumsCount,
- kRadixHexdecimal,expValues,1,NULL,hRtlTestResult ),
- "kHexDecimalNumsStr",
- "toInt32( radix 16 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int32>( kHexDecimalMaxNumsStr,kInt32MaxNumsCount,
- kRadixHexdecimal,(sal_Int32*)kInt32MaxNums,1,NULL,hRtlTestResult ),
- "kHexDecimalMaxNumsStr",
- "toInt32_Boundaries( radix 16 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int32>( kBase36NumsStr,kBase36NumsCount,
- kRadixBase36, expValues,1,NULL,hRtlTestResult ),
- "kBase36NumsStr",
- "toInt32( radix 36 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int32>( kBase36MaxNumsStr,kInt32MaxNumsCount,
- kRadixBase36,(sal_Int32*)kInt32MaxNums,1,NULL,hRtlTestResult ),
- "kBase36MaxNumsStr",
- "toInt32_Boundaries( radix 36 )"
- );
-
- const sal_Int16 nSpecCases = 5;
- static const sal_Char *spString[nSpecCases] =
- {
- "-1",
- "+1",
- " 1",
- " -1",
- "001"
- };
-
- sal_Int32 expSpecVal[nSpecCases] =
- {
- -1,
- 1,
- 1,
- -1,
- 1
- };
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int32>( spString,nSpecCases,
- kRadixDecimal,expSpecVal,1,NULL,hRtlTestResult ),
- "special cases",
- "toInt32( specialcases )"
- );
-
- return ( res );
-}
-sal_Bool SAL_CALL test_rtl_OUString_toInt32_wrongRadix(
- hTestResult hRtlTestResult )
-{
- ::rtl::OUString str("0",1,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString);
-
- sal_Int32 iRes =str.toInt32(-1);
-
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- iRes == 0,
- "wrong radix -1",
- "toInt32( 0, wrong radix -1 )"
- )
- );
-}
-sal_Bool SAL_CALL test_rtl_OUString_toInt32_defaultParam(
- hTestResult hRtlTestResult )
-{
- sal_Int32 expValues[kBase36NumsCount];
- sal_Int32 i;
-
- for ( i = 0; i < kBase36NumsCount; i++ )
- expValues[i] = i;
-
- sal_Bool res = c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int32>( kDecimalNumsStr,kDecimalNumsCount,
- kRadixDecimal,expValues,0,NULL,hRtlTestResult ),
- "kBinaryNumsStr",
- "toInt32( radix 2 )"
- );
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int32>( kDecimalMaxNumsStr,kInt32MaxNumsCount,
- kRadixDecimal,(sal_Int32*)kInt32MaxNums,0,NULL,hRtlTestResult ),
- "kDecimalMaxNumsStr",
- "toInt32_Boundaries( radix 10 )"
- );
- const sal_Int16 nSpecCases = 5;
- static const sal_Char *spString[nSpecCases] =
- {
- "-1",
- "+1",
- " 1",
- " -1",
- "001"
- };
-
- sal_Int32 expSpecVal[nSpecCases] =
- {
- -1,
- 1,
- 1,
- -1,
- 1
- };
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int32>( spString,nSpecCases,
- kRadixDecimal,expSpecVal,0,NULL,hRtlTestResult ),
- "special cases",
- "toInt32( specialcases )"
- );
-
- return ( res );
-}
-
-//------------------------------------------------------------------------
-// testing the method toInt32()
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_toInt32(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "toInt32");
- sal_Bool bTState = test_rtl_OUString_toInt32_normal( hRtlTestResult );
- bTState &= test_rtl_OUString_toInt32_defaultParam( hRtlTestResult );
- bTState &= test_rtl_OUString_toInt32_wrongRadix( hRtlTestResult );
- c_rtl_tres_state_end( hRtlTestResult, "toInt32");
-// return ( bTState );
-}
-//------------------------------------------------------------------------
-// testing the method toInt64( sal_Int16 radix = 2,8,10,16,36 )
-//------------------------------------------------------------------------
-
-sal_Bool SAL_CALL test_rtl_OUString_toInt64_normal(
- hTestResult hRtlTestResult )
-{
- sal_Int64 expValues[kBase36NumsCount];
- sal_Int32 i;
-
- for (i = 0; i < kBase36NumsCount; expValues[i] = i, i++);
-
- sal_Bool res = c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int64>( kBinaryNumsStr,kBinaryNumsCount,
- kRadixBinary,expValues,3,NULL,hRtlTestResult ),
- "kBinaryNumsStr",
- "toInt64( radix 2 )"
- );
-
-/* LLA: does not work within wntmsci8.pro
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int64>( kBinaryMaxNumsStr,kInt64MaxNumsCount,
- kRadixBinary,kInt64MaxNums,3,hRtlTestResult ),
- "kBinaryMaxNumsStr",
- "toInt64_Boundaries( radix 2 )"
- );
-*/
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int64>( kOctolNumsStr,kOctolNumsCount,
- kRadixOctol,expValues,3,NULL,hRtlTestResult ),
- "kOctolNumsStr",
- "toInt64( radix 8 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int64>( kOctolMaxNumsStr,kInt64MaxNumsCount,
- kRadixOctol,(sal_Int64*)kInt64MaxNums,3,NULL,hRtlTestResult ),
- "kOctolMaxNumsStr",
- "toInt64_Boundaries( radix 8 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int64>( kDecimalNumsStr,kDecimalNumsCount,
- kRadixDecimal,expValues,3,NULL,hRtlTestResult ),
- "kDecimalNumsStr",
- "toInt64( radix 10 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int64>( kDecimalMaxNumsStr,kInt64MaxNumsCount,
- kRadixDecimal,(sal_Int64*)kInt64MaxNums,3,NULL,hRtlTestResult ),
- "kDecimalMaxNumsStr",
- "toInt64_Boundaries( radix 10 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int64>( kHexDecimalNumsStr,kHexDecimalNumsCount,
- kRadixHexdecimal,expValues,3,NULL,hRtlTestResult ),
- "kHexDecimalNumsStr",
- "toInt64( radix 16 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int64>( kHexDecimalMaxNumsStr,kInt64MaxNumsCount,
- kRadixHexdecimal,(sal_Int64*)kInt64MaxNums,3,NULL,hRtlTestResult ),
- "kHexDecimalMaxNumsStr",
- "toInt64_Boundaries( radix 16 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int64>( kBase36NumsStr,kBase36NumsCount,
- kRadixBase36, expValues,3,NULL,hRtlTestResult ),
- "kBase36NumsStr",
- "toInt64( radix 36 )"
- );
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int64>( kBase36MaxNumsStr,kInt64MaxNumsCount,
- kRadixBase36,(sal_Int64*)kInt64MaxNums,3,NULL,hRtlTestResult ),
- "kBase36MaxNumsStr",
- "toInt64_Boundaries( radix 36 )"
- );
-
-
-
- const sal_Int16 nSpecCases = 5;
- static const sal_Char *spString[nSpecCases] =
- {
- "-1",
- "+1",
- " 1",
- " -1",
- "001"
- };
-
- sal_Int64 expSpecVal[nSpecCases] =
- {
- -1,
- 1,
- 1,
- -1,
- 1
- };
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int64>( spString,nSpecCases,
- kRadixDecimal,expSpecVal,3,NULL,hRtlTestResult ),
- "special cases",
- "toInt64( specialcases )"
- );
-
- return (res);
-}
-
-sal_Bool SAL_CALL test_rtl_OUString_toInt64_wrongRadix(
- hTestResult hRtlTestResult )
-{
- ::rtl::OUString str("0",1,kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString);
-
- sal_Int64 iRes = str.toInt64(-1);
-
- return (
- c_rtl_tres_state
- (
- hRtlTestResult,
- iRes == 0,
- "wrong radix -1",
- "toInt64( wrong radix -1)"
- )
- );
-}
-sal_Bool SAL_CALL test_rtl_OUString_toInt64_defaultParam(
- hTestResult hRtlTestResult )
-{
- sal_Int64 expValues[kBase36NumsCount];
- sal_Int32 i;
-
- for ( i = 0; i < kBase36NumsCount; i++ )
- expValues[i] = i;
-
- sal_Bool res = c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int64>( kDecimalNumsStr,kDecimalNumsCount,
- kRadixDecimal,expValues,2,NULL,hRtlTestResult ),
- "kBinaryNumsStr",
- "toInt64( radix 10 )"
- );
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int64>( kDecimalMaxNumsStr,kInt64MaxNumsCount,
- kRadixDecimal,(sal_Int64*)kInt64MaxNums,2,NULL,hRtlTestResult ),
- "kDecimalMaxNumsStr",
- "toInt64_Boundaries( radix 10 )"
- );
- const sal_Int16 nSpecCases = 5;
- static const sal_Char *spString[nSpecCases] =
- {
- "-1",
- "+1",
- " 1",
- " -1",
- "001"
- };
-
- sal_Int64 expSpecVal[nSpecCases] =
- {
- -1,
- 1,
- 1,
- -1,
- 1
- };
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- test_toData<sal_Int64>( spString,nSpecCases,
- kRadixDecimal,expSpecVal,2,NULL,hRtlTestResult ),
- "special cases",
- "toInt64( specialcases )"
- );
-
- return ( res );
-}
-
-//------------------------------------------------------------------------
-// testing the method toInt64()
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString_toInt64(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "toInt64");
- sal_Bool bTState = test_rtl_OUString_toInt64_normal( hRtlTestResult );
- bTState &= test_rtl_OUString_toInt64_defaultParam (hRtlTestResult );
- bTState &= test_rtl_OUString_toInt64_wrongRadix( hRtlTestResult );
- c_rtl_tres_state_end( hRtlTestResult, "toInt64");
-// return ( bTState );
-}
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUString( hTestResult hRtlTestResult )
-{
-
- c_rtl_tres_state_start(hRtlTestResult, "rtl_OUString" );
-
- test_rtl_OUString_ctors( hRtlTestResult );
- test_rtl_OUString_getLength( hRtlTestResult );
- test_rtl_OUString_equals( hRtlTestResult );
- test_rtl_OUString_equalsIgnoreAsciiCase( hRtlTestResult );
- test_rtl_OUString_compareTo( hRtlTestResult );
- test_rtl_OUString_match( hRtlTestResult );
- test_rtl_OUString_op_eq( hRtlTestResult );
- test_rtl_OUString_op_peq( hRtlTestResult );
- test_rtl_OUString_csuc( hRtlTestResult );
- test_rtl_OUString_getStr( hRtlTestResult );
- test_rtl_OUString_reverseCompareTo( hRtlTestResult );
- test_rtl_OUString_equalsAscii( hRtlTestResult );
- test_rtl_OUString_equalsAsciiL( hRtlTestResult );
- test_rtl_OUString_compareToAscii( hRtlTestResult );
- test_rtl_OUString_boolean( hRtlTestResult );
- test_rtl_OUString_valueOf_sal_Unicode( hRtlTestResult );
- test_rtl_OUString_valueOf( hRtlTestResult );
- test_rtl_OUString_createFromAscii( hRtlTestResult );
- test_rtl_OUString_indexOf( hRtlTestResult );
- test_rtl_OUString_concat( hRtlTestResult );
- test_rtl_OUString_replaceAt( hRtlTestResult );
- test_rtl_OUString_replace( hRtlTestResult );
- test_rtl_OUString_toAsciiLowerCase( hRtlTestResult );
- test_rtl_OUString_toAsciiUpperCase( hRtlTestResult );
- test_rtl_OUString_trim( hRtlTestResult );
- test_rtl_OUString_toChar( hRtlTestResult );
- test_rtl_OUString_toBoolean( hRtlTestResult );
- test_rtl_OUString_toInt32( hRtlTestResult );
- test_rtl_OUString_toInt64( hRtlTestResult );
-
- c_rtl_tres_state_end(hRtlTestResult, "rtl_OUString");
-}
-// -----------------------------------------------------------------------------
-void RegisterAdditionalFunctions(FktRegFuncPtr _pFunc)
-{
- if (_pFunc)
- {
- (_pFunc)(&test_rtl_OUString, "");
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl_strings/rtl_OUStringBuffer.cxx b/sal/qa/rtl_strings/rtl_OUStringBuffer.cxx
deleted file mode 100644
index 56d8926662c5..000000000000
--- a/sal/qa/rtl_strings/rtl_OUStringBuffer.cxx
+++ /dev/null
@@ -1,1520 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <sal/types.h>
-#include <testshl/tresstatewrapper.hxx>
-#include <rtl/string.hxx>
-#include <rtl/ustring.h>
-#include <rtl/ustring.hxx>
-#include <rtl/ustrbuf.h>
-#include <rtl/ustrbuf.hxx>
-#include <osl/thread.h>
-#include <rtl_String_Const.h>
-#include <rtl_String_Utils.hxx>
-#include "stdio.h"
-
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-
-//------------------------------------------------------------------------
-// test classes
-//------------------------------------------------------------------------
-const int MAXBUFLENGTH = 255;
-//------------------------------------------------------------------------
-// helper functions
-//------------------------------------------------------------------------
-static void unused()
-{
- (void)kBinaryNumsStr;
- (void)kOctolNumsStr;
- (void)kDecimalNumsStr;
- (void)kHexDecimalNumsStr;
- (void)kBase36NumsStr;
- (void)inputChar;
- (void)input1StrDefault;
- (void)input1StrNormal;
- (void)input1StrLastDefault;
- (void)input1StrLastNormal;
- unused();
-}
-
-//------------------------------------------------------------------------
-// testing constructors
-//------------------------------------------------------------------------
-static sal_Bool test_rtl_OUStringBuffer_ctor_001( hTestResult hRtlTestResult )
-{
-
- ::rtl::OUStringBuffer aUStrBuf;
-
- bool b1 =
- aUStrBuf.isEmpty() &&
- ! *(aUStrBuf.getStr()) && aUStrBuf.getCapacity() == 16;
-
- ::rtl::OUStringBuffer aUStrBuf2(0);
-
- bool b2 =
- aUStrBuf2.isEmpty() &&
- ! *(aUStrBuf2.getStr()) && aUStrBuf2.getCapacity() == /* LLA: !!! */ 0;
-
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- b1 && b2,
- "New OUStringBuffer containing no characters",
- "ctor_001"
- )
- );
-}
-
-//------------------------------------------------------------------------
-
-static sal_Bool SAL_CALL test_rtl_OUStringBuffer_ctor_002(
- hTestResult hRtlTestResult )
-{
- ::rtl::OUStringBuffer aUStrBuftmp( aUStr1 );
- ::rtl::OUStringBuffer aUStrBuf( aUStrBuftmp );
- sal_Bool res = cmpustr(aUStrBuftmp.getStr(),aUStrBuf.getStr());
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- aUStrBuf.getLength()==aUStrBuftmp.getLength() &&
- aUStrBuf.getCapacity() == aUStrBuftmp.getCapacity() && res ,
- "New OUStringBuffer from another OUStringBuffer",
- "ctor_002"
- )
- );
-}
-//------------------------------------------------------------------------
-
-/* static */
-sal_Bool SAL_CALL test_rtl_OUStringBuffer_ctor_003(
- hTestResult hRtlTestResult )
-{
- ::rtl::OUStringBuffer aUStrBuf1(kTestStr2Len);
- ::rtl::OUStringBuffer aUStrBuf2(0);
- ::rtl::OUStringBuffer aUStrBuf3(kNonSInt32Max);
-
-
- bool b1 =
- aUStrBuf1.isEmpty() &&
- ! *(aUStrBuf1.getStr()) && aUStrBuf1.getCapacity() == kTestStr2Len ;
-
- bool b2 =
- aUStrBuf2.isEmpty() &&
- ! *(aUStrBuf2.getStr()) && aUStrBuf2.getCapacity() == /* LLA: ??? 16 */ 0;
-
- bool b3 =
- aUStrBuf3.isEmpty() &&
- ! *(aUStrBuf3.getStr()) && aUStrBuf3.getCapacity() == kNonSInt32Max;
-
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- b1 && b2 && b3,
- "New OUStringBuffer containing no characters and contain assigned capacity",
- "ctor_003( will core dump,because the kSInt32Max )"
- )
- );
-
-}
-
-//------------------------------------------------------------------------
-
-static sal_Bool SAL_CALL test_rtl_OUStringBuffer_ctor_004(
- hTestResult hRtlTestResult)
-{
- ::rtl::OUString aUStrtmp( aUStr1 );
- ::rtl::OUStringBuffer aUStrBuf( aUStrtmp );
- sal_Int32 leg = aUStrBuf.getLength();
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- aUStrBuf.getStr() == aUStrtmp &&
- leg == aUStrtmp.pData->length &&
- aUStrBuf.getCapacity() == leg+16 ,
- "New OUStringBuffer from OUstring",
- "ctor_004"
- )
- );
-}
-
-static sal_Bool SAL_CALL test_rtl_OUStringBuffer_ctor_005(
- hTestResult hRtlTestResult)
-{
- ::rtl::OUStringBuffer aUStrBuftmp( aUStr1 );
- ::rtl::OUString aUStrtmp = aUStrBuftmp.makeStringAndClear();
- ::rtl::OUStringBuffer aUStrBuf( aUStrBuftmp );
- sal_Bool res = cmpustr(aUStrBuftmp.getStr(),aUStrBuf.getStr());
- sal_Int32 leg = aUStrBuf.getLength();
- return
- (
- c_rtl_tres_state
- (
- hRtlTestResult,
- aUStrBuf.getLength()==aUStrBuftmp.getLength() &&
- aUStrBuf.getCapacity() == aUStrBuftmp.getCapacity() &&
- res && leg == 0,
- "New OUStringBuffer from another OUStringBuffer after makeClearFromString",
- "ctor_005"
- )
- );
-}
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_ctors(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "ctors");
- sal_Bool DCState = test_ini_uString();
- (void)DCState;
- sal_Bool bTSState = test_rtl_OUStringBuffer_ctor_001( hRtlTestResult );
- bTSState &= test_rtl_OUStringBuffer_ctor_002( hRtlTestResult);
- bTSState &= test_rtl_OUStringBuffer_ctor_003( hRtlTestResult);
- bTSState &= test_rtl_OUStringBuffer_ctor_004( hRtlTestResult);
- bTSState &= test_rtl_OUStringBuffer_ctor_005( hRtlTestResult);
-
- c_rtl_tres_state_end( hRtlTestResult, "ctors");
-// return( bTSState );
-}
-
-//------------------------------------------------------------------------
-// testing the method makeStringAndClear()
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_makeStringAndClear(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "makeStringAndClear");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- OUString* expVal;
- OUStringBuffer* input1;
-
- ~TestCase() { delete input1;}
- } TestCase;
-
- OUString arrOUS[6]={
- OUString( aUStr1 ),
- OUString( aUStr14 ),
- OUString( aUStr25 ),
- OUString( aUStr27 ),
- OUString( aUStr29 ),
- OUString( "\0",1,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString)
- };
-
- TestCase arrTestCase[]={
-
- {"two empty strings(def. constructor)", new OUString(),
- new OUStringBuffer()},
- {"two empty strings(with a argu)", new OUString(),
- new OUStringBuffer(26)},
- {"normal string", new OUString(arrOUS[0]),
- new OUStringBuffer(arrOUS[0])},
- {"string with space ", new OUString(arrOUS[1]),
- new OUStringBuffer(arrOUS[1])},
- {"empty string", new OUString(arrOUS[2]),
- new OUStringBuffer(arrOUS[2])},
- {"string with a character", new OUString(arrOUS[3]),
- new OUStringBuffer(arrOUS[3])},
- {"string with special characters", new OUString(arrOUS[4]),
- new OUStringBuffer(arrOUS[4])},
- {"string only with (\0)", new OUString(arrOUS[5]),
- new OUStringBuffer(arrOUS[5])}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Bool lastRes =
- ( arrTestCase[i].input1->makeStringAndClear() ==
- *( arrTestCase[i].expVal ));
- lastRes = lastRes && ( arrTestCase[i].input1->getCapacity() == 0 );
- lastRes = lastRes && ( *(arrTestCase[i].input1->getStr()) == '\0' );
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "makeStringAndClear", i )
- );
-
- res &= lastRes;
- }
- c_rtl_tres_state_end( hRtlTestResult, "makeStringAndClear");
-// return (res);
-}
-//------------------------------------------------------------------------
-// testing the method getLength
-//------------------------------------------------------------------------
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_getLength(
- hTestResult hRtlTestResult)
-{
- c_rtl_tres_state_start( hRtlTestResult, "getLength");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- OUString arrOUS[6]={OUString( aUStr1 ),
- OUString( "1",1,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString),
- OUString(),
- OUString( "",0,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString),
- OUString( "\0",1,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString),
- OUString( aUStr2 )};
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Int32 expVal;
- OUStringBuffer* input;
- ~TestCase() { delete input;}
- } TestCase;
-
- TestCase arrTestCase[]={
-
- {"length of ascii string", kTestStr1Len,
- new OUStringBuffer(arrOUS[0]) },
- {"length of ascci string of size 1", 1,
- new OUStringBuffer(arrOUS[1])},
- {"length of empty string", 0,
- new OUStringBuffer(arrOUS[2])},
- {"length of empty string (empty ascii string arg)",0,
- new OUStringBuffer(arrOUS[3])},
- {"length of empty string (string arg = \"\\0\")", 1,
- new OUStringBuffer(arrOUS[4])},
- {"length(>16) of ascii string", kTestStr2Len,
- new OUStringBuffer(arrOUS[5]) },
- {"length of empty string (default constructor)", 0,
- new OUStringBuffer()},
- {"length of empty string (with capacity)", 0,
- new OUStringBuffer(26)}
- };
-
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Int32 length = arrTestCase[i].input->getLength();
- sal_Bool lastRes = (length == arrTestCase[i].expVal);
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "getLength", i )
-
- );
- res &= lastRes;
- }
- c_rtl_tres_state_end( hRtlTestResult, "getLength");
-// return ( res );
-}
-//------------------------------------------------------------------------
-// testing the method getCapacity()
-//------------------------------------------------------------------------
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_getCapacity(
- hTestResult hRtlTestResult)
-{
- c_rtl_tres_state_start( hRtlTestResult, "getCapacity");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- OUString arrOUS[6]={OUString( aUStr1 ),
- OUString( "1",1,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString),
- OUString(),
- OUString( "",0,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString),
- OUString( "\0",1,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString),
- OUString( aUStr2 )};
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Int32 expVal;
- OUStringBuffer* input;
- ~TestCase() { delete input;}
- } TestCase;
-
- TestCase arrTestCase[]={
-
- {"capacity of ascii string", kTestStr1Len+16,
- new OUStringBuffer(arrOUS[0]) },
- {"capacity of ascci string of size 1", 1+16,
- new OUStringBuffer(arrOUS[1]) },
- {"capacity of empty string", 0+16,
- new OUStringBuffer(arrOUS[2]) },
- {"capacity of empty string (empty ascii string arg)",0+16,
- new OUStringBuffer(arrOUS[3]) },
- {"capacity of empty string (string arg = \"\\0\")", 1+16,
- new OUStringBuffer(arrOUS[4]) },
- {"capacity(>16) of ascii string", kTestStr2Len+16,
- new OUStringBuffer(arrOUS[5]) },
- {"capacity of empty string (default constructor)", 16,
- new OUStringBuffer() },
- {"capacity of empty string (with capacity -2147483648)", kNonSInt32Max,
- new OUStringBuffer(kNonSInt32Max) },
- {"capacity of empty string (with capacity 16)", 16,
- new OUStringBuffer(16) },
- {"capacity of empty string (with capacity 6)", 6,
- new OUStringBuffer(6) },
- {"capacity of empty string (with capacity 0)", 0,
- new OUStringBuffer(0) },
- {"capacity of empty string (with capacity -2)", -2,
- new OUStringBuffer(-2) }
- };
-
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- sal_Int32 length = arrTestCase[i].input->getCapacity();
- sal_Bool lastRes = (length == arrTestCase[i].expVal);
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "getCapacity", i )
-
- );
- res &= lastRes;
- }
- c_rtl_tres_state_end( hRtlTestResult, "getCapacity");
-// return ( res );
-}
-//------------------------------------------------------------------------
-// testing the method ensureCapacity(sal_Int32 minimumCapacity)
-//------------------------------------------------------------------------
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_ensureCapacity(
- hTestResult hRtlTestResult)
-{
- c_rtl_tres_state_start( hRtlTestResult, "ensureCapacity");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Int32 expVal;
- OUStringBuffer* input1;
- sal_Int32 input2;
- ~TestCase() { delete input1;}
- } TestCase;
-
- TestCase arrTestCase[]={
-
- {"capacity equal to 16, minimum is 5 ", 16,
- new OUStringBuffer(), 5 },
- {"capacity equal to 16, minimum is -5", 16,
- new OUStringBuffer(), -5},
- {"capacity equal to 16, minimum is 0", 16,
- new OUStringBuffer(), 0},
- {"capacity equal to 16, minimum is 20", 20, //the testcase is based on comments
- new OUStringBuffer(), 20},
- {"capacity equal to 16, minimum is 50", 50,
- new OUStringBuffer(), 50},
- {"capacity equal to 6, minimum is 20", 20,
- new OUStringBuffer(6), 20 },
- {"capacity equal to 6, minimum is 2", 6,
- new OUStringBuffer(6), 2},
- {"capacity equal to 6, minimum is -6", 6,
- new OUStringBuffer(6), -6},
- {"capacity equal to 6, minimum is -6", 10, //the testcase is based on comments
- new OUStringBuffer(6), 10},
- {"capacity equal to 0, minimum is 6", 6,
- new OUStringBuffer(0), 6},
- {"capacity equal to 0, minimum is 1", 2, //the testcase is based on comments
- new OUStringBuffer(0), 1},
- /*
- {"capacity equal to 0, minimum is -1", 0,
- new OUStringBuffer(0), -1},
- */
- {"capacity equal to -2147483648, minimum is 65535", 65535,
- new OUStringBuffer(kNonSInt32Max), 65535},
- {"capacity equal to -2147483648, minimum is -1", 2,
- new OUStringBuffer(kNonSInt32Max), -1},
- {"capacity equal to -2147483648, minimum is 0", 2,
- new OUStringBuffer(kNonSInt32Max), 0},
- {"capacity equal to -2147483648, minimum is -2147483648", kNonSInt32Max,
- new OUStringBuffer(kNonSInt32Max), kNonSInt32Max}
- };
-
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- arrTestCase[i].input1->ensureCapacity(arrTestCase[i].input2);
- sal_Int32 length = arrTestCase[i].input1->getCapacity();
- sal_Bool lastRes = (length == arrTestCase[i].expVal);
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "ensureCapacity", i )
-
- );
- res &= lastRes;
- }
- c_rtl_tres_state_end( hRtlTestResult, "ensureCapacity");
-// return ( res );
-}
-//------------------------------------------------------------------------
-// testing the method setLength(sal_Int32 newLength)
-//------------------------------------------------------------------------
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_setLength(
- hTestResult hRtlTestResult)
-{
- c_rtl_tres_state_start( hRtlTestResult, "setLength");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- OUString arrOUS[6]={OUString( aUStr1 ),
- OUString( aUStr27),
- OUString(),
- OUString( "",0,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString),
- OUString( "\0",1,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString),
- OUString( aUStr2 )};
-
- typedef struct TestCase
- {
- sal_Char* comments;
- sal_Int32 expVal1;
- OUString* expVal2;
- sal_Int32 expVal3;
- OUStringBuffer* input1;
- sal_Int32 input2;
- ~TestCase() { delete input1; delete expVal2;}
- } TestCase;
-
- TestCase arrTestCase[]={
-
- {"newLength more than the capacity of OUStringBuffer(aUStr1)",
- 50, new OUString(aUStr1), 50,
- new OUStringBuffer(arrOUS[0]), 50 },
- {"newLength more than the length of OUStringBuffer(aUStr1)",
- kTestStr13Len, new OUString(aUStr1), 32,
- new OUStringBuffer(arrOUS[0]), kTestStr13Len },
- {"newLength equal to the length of OUStringBuffer(aUStr1)",
- kTestStr1Len, new OUString(aUStr1), 32,
- new OUStringBuffer(arrOUS[0]), kTestStr1Len },
- {"newLength less than the length of OUStringBuffer(aUStr1)",
- kTestStr7Len, new OUString(aUStr7), 32,
- new OUStringBuffer(arrOUS[0]), kTestStr7Len},
- {"newLength equal to 0",
- 0, new OUString(), 32,
- new OUStringBuffer(arrOUS[0]), 0},
- {"newLength more than the capacity of OUStringBuffer(1)",
- 25, new OUString(arrOUS[1]), 25,
- new OUStringBuffer(arrOUS[1]), 25},
- {"newLength more than the length of OUStringBuffer(1)",
- 5, new OUString(arrOUS[1]), 17,
- new OUStringBuffer(arrOUS[1]), 5},
- {"newLength equal to the length of OUStringBuffer(1)",
- kTestStr27Len, new OUString(arrOUS[1]), 17,
- new OUStringBuffer(arrOUS[1]), kTestStr27Len},
- {"newLength less than the length of OUStringBuffer(1)",
- 0, new OUString(), 17,
- new OUStringBuffer(arrOUS[1]), 0},
- {"newLength more than the capacity of OUStringBuffer()",
- 20, new OUString(), 20,
- new OUStringBuffer(arrOUS[2]), 20},
- {"newLength more than the length of OUStringBuffer()",
- 3, new OUString(), 16,
- new OUStringBuffer(arrOUS[2]), 3},
- {"newLength less than the length of OUStringBuffer()",
- 0, new OUString(), 16,
- new OUStringBuffer(arrOUS[2]), 0},
- {"newLength more than the capacity of OUStringBuffer("")",
- 20, new OUString(), 20,
- new OUStringBuffer(arrOUS[3]), 20},
- {"newLength more than the length of OUStringBuffer("")",
- 5, new OUString(), 16,
- new OUStringBuffer(arrOUS[3]), 5},
- {"newLength less than the length of OUStringBuffer("")",
- 0, new OUString(), 16,
- new OUStringBuffer(arrOUS[3]), 0},
- {"newLength more than the length of OUStringBuffer(\0)",
- 20, new OUString(), 20,
- new OUStringBuffer(arrOUS[4]), 20},
- {"newLength more than the length of OUStringBuffer(\0)",
- 5, new OUString(), 16,
- new OUStringBuffer(arrOUS[4]), 5},
- {"newLength less than the length of OUStringBuffer(\0)",
- 0, new OUString(), 16,
- new OUStringBuffer(arrOUS[4]), 0},
- {"newLength more than the capacity of OUStringBuffer(aUStr2)",
- 50, new OUString(aUStr2), 66,
- new OUStringBuffer(arrOUS[5]), 50,},
- {"newLength more than the length of OUStringBuffer(aUStr2)",
- 40, new OUString(aUStr2), 48,
- new OUStringBuffer(arrOUS[5]), 40,},
- {"newLength equal to the length of OUStringBuffer(aUStr2)",
- kTestStr2Len, new OUString(aUStr2), 48,
- new OUStringBuffer(arrOUS[5]), kTestStr2Len,},
- {"newLength less than the length of OUStringBuffer(aUStr2)",
- kTestStr7Len, new OUString(aUStr7), 48,
- new OUStringBuffer(arrOUS[5]), kTestStr7Len},
- {"newLength equal to 0",
- 0, new OUString(), 48,
- new OUStringBuffer(arrOUS[5]), 0}
-
- };
-
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- arrTestCase[i].input1->setLength(arrTestCase[i].input2);
- sal_Bool lastRes =
- ( arrTestCase[i].input1->getStr() == *(arrTestCase[i].expVal2) &&
- arrTestCase[i].input1->getLength() == arrTestCase[i].expVal1 &&
- arrTestCase[i].input1->getCapacity() == arrTestCase[i].expVal3 );
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "setLength", i )
-
- );
- res &= lastRes;
- }
- c_rtl_tres_state_end( hRtlTestResult, "setLength");
-// return ( res );
-}
-//------------------------------------------------------------------------
-// testing the operator const sal_Unicode * (csuc for short)
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_csuc(
- hTestResult hRtlTestResult)
-{
- c_rtl_tres_state_start( hRtlTestResult, "csuc");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- const sal_Unicode tmpUC=0x0;
- rtl_uString* tmpUstring = NULL;
- const sal_Char *tmpStr=kTestStr1;
- sal_Int32 tmpLen=(sal_Int32) kTestStr1Len;
- //sal_Int32 cmpLen = 0;
- OUString tempString(aUStr1);
-
- rtl_string2UString( &tmpUstring, tmpStr, tmpLen,
- osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS );
- OSL_ASSERT(tmpUstring != NULL);
-
-
- typedef struct TestCase
- {
- sal_Char* comments;
- const sal_Unicode* expVal;
- sal_Int32 cmpLen;
- OUStringBuffer* input1;
- ~TestCase() { delete input1; }
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"test normal ustring",(*tmpUstring).buffer,kTestStr1Len,
- new OUStringBuffer(tempString)},
- {"test empty ustring",&tmpUC, 1, new OUStringBuffer()}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- const sal_Unicode* pstr = *arrTestCase[i].input1;
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- cmpustr( pstr, arrTestCase[i].expVal, arrTestCase[i].cmpLen ),
- arrTestCase[i].comments,
- createName( pMeth, "const sal_Unicode*", i )
- );
- }
- c_rtl_tres_state_end( hRtlTestResult, "csuc");
-// return ( res );
-}
-//------------------------------------------------------------------------
-// testing the method const sal_Unicode * getStr()
-//------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_getStr(
- hTestResult hRtlTestResult)
-{
- c_rtl_tres_state_start( hRtlTestResult, "getStr");
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- const sal_Unicode tmpUC=0x0;
- rtl_uString* tmpUstring = NULL;
- const sal_Char *tmpStr=kTestStr1;
- sal_Int32 tmpLen=(sal_Int32) kTestStr1Len;
- //sal_Int32 cmpLen = 0;
- OUString tempString(aUStr1);
-
- rtl_string2UString( &tmpUstring, tmpStr, tmpLen,
- osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS );
- OSL_ASSERT(tmpUstring != NULL);
-
-
- typedef struct TestCase
- {
- sal_Char* comments;
- const sal_Unicode* expVal;
- sal_Int32 cmpLen;
- OUStringBuffer* input1;
- ~TestCase() { delete input1;}
- } TestCase;
-
- TestCase arrTestCase[] =
- {
- {"test normal ustring",(*tmpUstring).buffer,kTestStr1Len,
- new OUStringBuffer(tempString)},
- {"test empty ustring",&tmpUC, 1, new OUStringBuffer()}
- };
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
- for(i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- const sal_Unicode* pstr = arrTestCase[i].input1->getStr();
-
- res &= c_rtl_tres_state
- (
- hRtlTestResult,
- cmpustr( pstr, arrTestCase[i].expVal, arrTestCase[i].cmpLen ),
- arrTestCase[i].comments,
- createName( pMeth, "getStr", i )
- );
- }
- c_rtl_tres_state_end( hRtlTestResult, "getStr");
-// return ( res );
-}
-//------------------------------------------------------------------------
-// testing the method append(const OUString &str)
-//------------------------------------------------------------------------
-
-sal_Bool SAL_CALL test_rtl_OUStringBuffer_append_001(
- hTestResult hRtlTestResult)
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- OUString arrOUS[5]={OUString( aUStr7 ),
- OUString(),
- OUString( aUStr25 ),
- OUString( "\0",1,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString),
- OUString( aUStr28 )};
-
- typedef struct TestCase
- {
- sal_Char* comments;
- OUString* expVal;
- OUStringBuffer* input1;
- OUString* input2;
-
- ~TestCase() { delete input1; delete input2; delete expVal; }
- } TestCase;
-
- TestCase arrTestCase[]={
-
- {"Appends the string(length less than 16) to the string buffer arrOUS[0]",
- new OUString(aUStr1),
- new OUStringBuffer(arrOUS[0]), new OUString(aUStr8) },
- {"Appends the string(length more than 16) to the string buffer arrOUS[0]",
- new OUString(aUStr2),
- new OUStringBuffer(arrOUS[0]), new OUString(aUStr36) },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[0]",
- new OUString(aUStr37),
- new OUStringBuffer(arrOUS[0]), new OUString(aUStr23) },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[0]",
- new OUString(aUStr7),
- new OUStringBuffer(arrOUS[0]), new OUString()},
- {"Appends the string(length less than 16) to the string buffer arrOUS[1]",
- new OUString(aUStr7),
- new OUStringBuffer(arrOUS[1]), new OUString(aUStr7)},
- {"Appends the string(length more than 16) to the string buffer arrOUS[1]",
- new OUString(aUStr2),
- new OUStringBuffer(arrOUS[1]), new OUString(aUStr2)},
- {"Appends the string(length equal to 16) to the string buffer arrOUS[1]",
- new OUString(aUStr1),
- new OUStringBuffer(arrOUS[1]), new OUString(aUStr1) },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[1]",
- new OUString(),
- new OUStringBuffer(arrOUS[1]), new OUString()},
- {"Appends the string(length less than 16) to the string buffer arrOUS[2]",
- new OUString(aUStr7),
- new OUStringBuffer(arrOUS[2]), new OUString(aUStr7)},
- {"Appends the string(length more than 16) to the string buffer arrOUS[2]",
- new OUString(aUStr2),
- new OUStringBuffer(arrOUS[2]), new OUString(aUStr2)},
- {"Appends the string(length equal to 16) to the string buffer arrOUS[2]",
- new OUString(aUStr1),
- new OUStringBuffer(arrOUS[2]), new OUString(aUStr1) },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[2]",
- new OUString(),
- new OUStringBuffer(arrOUS[2]), new OUString()},
- {"Appends the string(length less than 16) to the string buffer arrOUS[3]",
- new OUString(aUStr7),
- new OUStringBuffer(arrOUS[3]), new OUString(aUStr7)},
- {"Appends the string(length more than 16) to the string buffer arrOUS[3]",
- new OUString(aUStr2),
- new OUStringBuffer(arrOUS[3]), new OUString(aUStr2)},
- {"Appends the string(length equal to 16) to the string buffer arrOUS[3]",
- new OUString(aUStr1),
- new OUStringBuffer(arrOUS[3]), new OUString(aUStr1) },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[3]",
- new OUString(),
- new OUStringBuffer(arrOUS[3]), new OUString()},
- {"Appends the string(length less than 16) to the string buffer arrOUS[4]",
- new OUString(aUStr29),
- new OUStringBuffer(arrOUS[4]), new OUString(aUStr38)},
- {"Appends the string(length more than 16) to the string buffer arrOUS[4]",
- new OUString(aUStr39),
- new OUStringBuffer(arrOUS[4]), new OUString(aUStr17)},
- {"Appends the string(length equal to 16) to the string buffer arrOUS[4]",
- new OUString(aUStr40),
- new OUStringBuffer(arrOUS[4]), new OUString(aUStr31) },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[4]",
- new OUString(aUStr28),
- new OUStringBuffer(arrOUS[4]), new OUString()}
- };
-
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- arrTestCase[i].input1->append( *(arrTestCase[i].input2) );
- sal_Bool lastRes =
- ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
- arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength() );
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "append(const OUString &str)_001", i )
-
- );
-
- res &= lastRes;
- }
-
- return ( res );
-}
-//------------------------------------------------------------------------
-// testing the method append( const sal_Unicode * str )
-//------------------------------------------------------------------------
-
-sal_Bool SAL_CALL test_rtl_OUStringBuffer_append_002(
- hTestResult hRtlTestResult)
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- OUString arrOUS[5]={OUString( aUStr7 ),
- OUString(),
- OUString( aUStr25 ),
- OUString( "\0",1,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString),
- OUString( aUStr28 )};
-
- typedef struct TestCase
- {
- sal_Char* comments;
- OUString* expVal;
- OUStringBuffer* input1;
- sal_Unicode* input2;
-
- ~TestCase() { delete input1; delete expVal; }
- } TestCase;
-
- TestCase arrTestCase[]={
-
- {"Appends the string(length less than 16) to the string buffer arrOUS[0]",
- new OUString(aUStr1),
- new OUStringBuffer(arrOUS[0]), aUStr8 },
- {"Appends the string(length more than 16) to the string buffer arrOUS[0]",
- new OUString(aUStr2),
- new OUStringBuffer(arrOUS[0]), aUStr36 },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[0]",
- new OUString(aUStr37),
- new OUStringBuffer(arrOUS[0]), aUStr23 },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[0]",
- new OUString(aUStr7),
- new OUStringBuffer(arrOUS[0]), aUStr25 },
- {"Appends the string(length less than 16) to the string buffer arrOUS[1]",
- new OUString(aUStr7),
- new OUStringBuffer(arrOUS[1]), aUStr7 },
- {"Appends the string(length more than 16) to the string buffer arrOUS[1]",
- new OUString(aUStr2),
- new OUStringBuffer(arrOUS[1]), aUStr2 },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[1]",
- new OUString(aUStr1),
- new OUStringBuffer(arrOUS[1]), aUStr1 },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[1]",
- new OUString(),
- new OUStringBuffer(arrOUS[1]), aUStr25 },
- {"Appends the string(length less than 16) to the string buffer arrOUS[2]",
- new OUString(aUStr7),
- new OUStringBuffer(arrOUS[2]), aUStr7 },
- {"Appends the string(length more than 16) to the string buffer arrOUS[2]",
- new OUString(aUStr2),
- new OUStringBuffer(arrOUS[2]), aUStr2 },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[2]",
- new OUString(aUStr1),
- new OUStringBuffer(arrOUS[2]), aUStr1 },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[2]",
- new OUString(),
- new OUStringBuffer(arrOUS[2]), aUStr25 },
- {"Appends the string(length less than 16) to the string buffer arrOUS[3]",
- new OUString(aUStr7),
- new OUStringBuffer(arrOUS[3]), aUStr7 },
- {"Appends the string(length more than 16) to the string buffer arrOUS[3]",
- new OUString(aUStr2),
- new OUStringBuffer(arrOUS[3]), aUStr2 },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[3]",
- new OUString(aUStr1),
- new OUStringBuffer(arrOUS[3]), aUStr1 },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[3]",
- new OUString(),
- new OUStringBuffer(arrOUS[3]), aUStr25 },
- {"Appends the string(length less than 16) to the string buffer arrOUS[4]",
- new OUString(aUStr29),
- new OUStringBuffer(arrOUS[4]), aUStr38 },
- {"Appends the string(length more than 16) to the string buffer arrOUS[4]",
- new OUString(aUStr39),
- new OUStringBuffer(arrOUS[4]), aUStr17 },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[4]",
- new OUString(aUStr40),
- new OUStringBuffer(arrOUS[4]), aUStr31 },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[4]",
- new OUString(aUStr28),
- new OUStringBuffer(arrOUS[4]), aUStr25 }
- };
-
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- arrTestCase[i].input1->append( arrTestCase[i].input2 );
- sal_Bool lastRes =
- ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
- arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength() );
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "append( const sal_Unicode * str )_002", i )
-
- );
-
- res &= lastRes;
- }
-
- return ( res );
-}
-//------------------------------------------------------------------------
-// testing the method append( const sal_Unicode * str, sal_Int32 len)
-//------------------------------------------------------------------------
-
-sal_Bool SAL_CALL test_rtl_OUStringBuffer_append_003(
- hTestResult hRtlTestResult)
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- OUString arrOUS[5]={OUString( aUStr7 ),
- OUString(),
- OUString( aUStr25 ),
- OUString( "\0",1,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString),
- OUString( aUStr28 )};
-
- typedef struct TestCase
- {
- sal_Char* comments;
- OUString* expVal;
- OUStringBuffer* input1;
- sal_Unicode* input2;
- sal_Int32 input3;
-
- ~TestCase() { delete input1; delete expVal; }
- } TestCase;
-
- TestCase arrTestCase[]={
-
- {"Appends the string(length less than 16) to the string buffer arrOUS[0]",
- new OUString(aUStr1),
- new OUStringBuffer(arrOUS[0]), aUStr36, 12 },
- {"Appends the string(length more than 16) to the string buffer arrOUS[0]",
- new OUString(aUStr2),
- new OUStringBuffer(arrOUS[0]), aUStr36, 28 },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[0]",
- new OUString(aUStr37),
- new OUStringBuffer(arrOUS[0]), aUStr23, 16 },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[0]",
- new OUString(aUStr7),
- new OUStringBuffer(arrOUS[0]), aUStr2, 0 },
- /* LLA: input3 must null < 0
- {"Appends the string(length less than 0) to the string buffer arrOUS[0]",
- new OUString(aUStr41),
- new OUStringBuffer(arrOUS[0]), aUStr2, -1 },
- */
- {"Appends the string(length less than 16) to the string buffer arrOUS[1]",
- new OUString(aUStr7),
- new OUStringBuffer(arrOUS[1]), aUStr2, 4 },
- {"Appends the string(length more than 16) to the string buffer arrOUS[1]",
- new OUString(aUStr2),
- new OUStringBuffer(arrOUS[1]), aUStr2, 32 },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[1]",
- new OUString(aUStr1),
- new OUStringBuffer(arrOUS[1]), aUStr2, 16 },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[1]",
- new OUString(),
- new OUStringBuffer(arrOUS[1]), aUStr2, 0 },
- /* LLA: input3 must null < 0
- {"Appends the string(length less than 0) to the string buffer arrOUS[1]",
- new OUString(),
- new OUStringBuffer(arrOUS[1]), aUStr2, -1 },
- */
- {"Appends the string(length less than 16) to the string buffer arrOUS[2]",
- new OUString(aUStr7),
- new OUStringBuffer(arrOUS[2]), aUStr2, 4 },
- {"Appends the string(length more than 16) to the string buffer arrOUS[2]",
- new OUString(aUStr2),
- new OUStringBuffer(arrOUS[2]), aUStr2, 32 },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[2]",
- new OUString(aUStr1),
- new OUStringBuffer(arrOUS[2]), aUStr2, 16 },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[2]",
- new OUString(),
- new OUStringBuffer(arrOUS[2]), aUStr2, 0 },
- /* LLA: input3 must null < 0
- {"Appends the string(length less than 0) to the string buffer arrOUS[2]",
- new OUString(),
- new OUStringBuffer(arrOUS[2]), aUStr2, -1 },
- */
- {"Appends the string(length less than 16) to the string buffer arrOUS[3]",
- new OUString(aUStr7),
- new OUStringBuffer(arrOUS[3]), aUStr2, 4 },
- {"Appends the string(length more than 16) to the string buffer arrOUS[3]",
- new OUString(aUStr2),
- new OUStringBuffer(arrOUS[3]), aUStr2, 32 },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[3]",
- new OUString(aUStr1),
- new OUStringBuffer(arrOUS[3]), aUStr2, 16 },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[3]",
- new OUString(),
- new OUStringBuffer(arrOUS[3]), aUStr2, 0 },
- /* LLA: input3 must null < 0
- {"Appends the string(length less than 0) to the string buffer arrOUS[3]",
- new OUString(),
- new OUStringBuffer(arrOUS[3]), aUStr2, -1 },
- */
- {"Appends the string(length less than 16) to the string buffer arrOUS[4]",
- new OUString(aUStr29),
- new OUStringBuffer(arrOUS[4]), aUStr38, 7 },
- {"Appends the string(length more than 16) to the string buffer arrOUS[4]",
- new OUString(aUStr39),
- new OUStringBuffer(arrOUS[4]), aUStr17, 22 },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[4]",
- new OUString(aUStr40),
- new OUStringBuffer(arrOUS[4]), aUStr31, 16 },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[4]",
- new OUString(aUStr28),
- new OUStringBuffer(arrOUS[4]), aUStr2, 0 },
- };
-
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- arrTestCase[i].input1->append(
- arrTestCase[i].input2, arrTestCase[i].input3);
- sal_Bool lastRes =
- ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
- arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength() );
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "append( const sal_Unicode * str, sal_Int32 len)_003", i )
-
- );
-
- res &= lastRes;
- }
-
- return ( res );
-}
-//------------------------------------------------------------------------
-// testing the method append(sal_Bool b)
-//------------------------------------------------------------------------
-
-sal_Bool SAL_CALL test_rtl_OUStringBuffer_append_004(
- hTestResult hRtlTestResult)
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- OUString arrOUS[5]={OUString( aUStr7 ),
- OUString(),
- OUString( aUStr25 ),
- OUString( "\0",1,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString),
- OUString( aUStr28 )};
-
- typedef struct TestCase
- {
- sal_Char* comments;
- OUString* expVal;
- OUStringBuffer* input1;
- sal_Bool input2;
-
- ~TestCase() { delete input1; delete expVal; }
- } TestCase;
-
- TestCase arrTestCase[]={
-
- {"Appends the sal_Bool(sal_True) to the string buffer arrOUS[0]",
- new OUString(aUStr45),
- new OUStringBuffer(arrOUS[0]), sal_True },
- {"Appends the sal_Bool(sal_False) to the string buffer arrOUS[0]",
- new OUString(aUStr46),
- new OUStringBuffer(arrOUS[0]), sal_False },
- {"Appends the sal_Bool(sal_True) to the string buffer arrOUS[1]",
- new OUString(aUStr47),
- new OUStringBuffer(arrOUS[1]), sal_True },
- {"Appends the sal_Bool(sal_False) to the string buffer arrOUS[1]",
- new OUString(aUStr48),
- new OUStringBuffer(arrOUS[1]), sal_False },
- {"Appends the sal_Bool(sal_True) to the string buffer arrOUS[2]",
- new OUString(aUStr47),
- new OUStringBuffer(arrOUS[2]), sal_True },
- {"Appends the sal_Bool(sal_False) to the string buffer arrOUS[2]",
- new OUString(aUStr48),
- new OUStringBuffer(arrOUS[2]), sal_False },
- {"Appends the sal_Bool(sal_True) to the string buffer arrOUS[3]",
- new OUString(aUStr47),
- new OUStringBuffer(arrOUS[3]), sal_True },
- {"Appends the sal_Bool(sal_False) to the string buffer arrOUS[3]",
- new OUString(aUStr48),
- new OUStringBuffer(arrOUS[3]), sal_False },
- {"Appends the sal_Bool(sal_True) to the string buffer arrOUS[4]",
- new OUString(aUStr49),
- new OUStringBuffer(arrOUS[4]), sal_True },
- {"Appends the sal_Bool(sal_False) to the string buffer arrOUS[4]",
- new OUString(aUStr50),
- new OUStringBuffer(arrOUS[4]), sal_False }
- };
-
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- arrTestCase[i].input1->append(
- arrTestCase[i].input2 );
- sal_Bool lastRes =
- ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
- arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength() );
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "append( sal_Bool b)_004", i )
-
- );
-
- res &= lastRes;
- }
-
- return ( res );
-}
-
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_appends(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "appends");
- sal_Bool bTSState = test_rtl_OUStringBuffer_append_001( hRtlTestResult );
- bTSState &= test_rtl_OUStringBuffer_append_002( hRtlTestResult);
- bTSState &= test_rtl_OUStringBuffer_append_003( hRtlTestResult);
- bTSState &= test_rtl_OUStringBuffer_append_004( hRtlTestResult);
-
- c_rtl_tres_state_end( hRtlTestResult, "appends");
-// return( bTSState );
-}
-//------------------------------------------------------------------------
-// testing the method appendAscii( const sal_Char * str )
-//------------------------------------------------------------------------
-
-sal_Bool SAL_CALL test_rtl_OUStringBuffer_appendAscii_001(
- hTestResult hRtlTestResult)
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- OUString arrOUS[5]={OUString( aUStr7 ),
- OUString(),
- OUString( aUStr25 ),
- OUString( "\0",1,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString),
- OUString( aUStr28 )};
-
- typedef struct TestCase
- {
- sal_Char* comments;
- OUString* expVal;
- OUStringBuffer* input1;
- const sal_Char* input2;
-
- ~TestCase() { delete input1; delete expVal; }
- } TestCase;
-
- TestCase arrTestCase[]={
-
- {"Appends the string(length less than 16) to the string buffer arrOUS[0]",
- new OUString(aUStr1),
- new OUStringBuffer(arrOUS[0]), kTestStr8 },
- {"Appends the string(length more than 16) to the string buffer arrOUS[0]",
- new OUString(aUStr2),
- new OUStringBuffer(arrOUS[0]), kTestStr36 },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[0]",
- new OUString(aUStr37),
- new OUStringBuffer(arrOUS[0]), kTestStr23 },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[0]",
- new OUString(aUStr7),
- new OUStringBuffer(arrOUS[0]), kTestStr25 },
- {"Appends the string(length less than 16) to the string buffer arrOUS[1]",
- new OUString(aUStr7),
- new OUStringBuffer(arrOUS[1]), kTestStr7 },
- {"Appends the string(length more than 16) to the string buffer arrOUS[1]",
- new OUString(aUStr2),
- new OUStringBuffer(arrOUS[1]), kTestStr2 },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[1]",
- new OUString(aUStr1),
- new OUStringBuffer(arrOUS[1]), kTestStr1 },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[1]",
- new OUString(),
- new OUStringBuffer(arrOUS[1]), kTestStr25 },
- {"Appends the string(length less than 16) to the string buffer arrOUS[2]",
- new OUString(aUStr7),
- new OUStringBuffer(arrOUS[2]), kTestStr7 },
- {"Appends the string(length more than 16) to the string buffer arrOUS[2]",
- new OUString(aUStr2),
- new OUStringBuffer(arrOUS[2]), kTestStr2 },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[2]",
- new OUString(aUStr1),
- new OUStringBuffer(arrOUS[2]), kTestStr1 },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[2]",
- new OUString(),
- new OUStringBuffer(arrOUS[2]), kTestStr25 },
- {"Appends the string(length less than 16) to the string buffer arrOUS[3]",
- new OUString(aUStr7),
- new OUStringBuffer(arrOUS[3]), kTestStr7 },
- {"Appends the string(length more than 16) to the string buffer arrOUS[3]",
- new OUString(aUStr2),
- new OUStringBuffer(arrOUS[3]), kTestStr2 },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[3]",
- new OUString(aUStr1),
- new OUStringBuffer(arrOUS[3]), kTestStr1 },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[3]",
- new OUString(),
- new OUStringBuffer(arrOUS[3]), kTestStr25 },
- {"Appends the string(length less than 16) to the string buffer arrOUS[4]",
- new OUString(aUStr29),
- new OUStringBuffer(arrOUS[4]), kTestStr38 },
- {"Appends the string(length more than 16) to the string buffer arrOUS[4]",
- new OUString(aUStr39),
- new OUStringBuffer(arrOUS[4]), kTestStr17 },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[4]",
- new OUString(aUStr40),
- new OUStringBuffer(arrOUS[4]), kTestStr31 },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[4]",
- new OUString(aUStr28),
- new OUStringBuffer(arrOUS[4]), kTestStr25 }
- };
-
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- arrTestCase[i].input1->appendAscii( arrTestCase[i].input2 );
- sal_Bool lastRes =
- ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
- arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength() );
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "appendAscii_001", i )
- );
-
- res &= lastRes;
- }
- return ( res );
-}
-//------------------------------------------------------------------------
-// testing the method appendAscii( const sal_Char * str, sal_Int32 len)
-//------------------------------------------------------------------------
-
-sal_Bool SAL_CALL test_rtl_OUStringBuffer_appendAscii_002(
- hTestResult hRtlTestResult)
-{
- sal_Char methName[MAXBUFLENGTH];
- sal_Char* pMeth = methName;
-
- OUString arrOUS[5]={OUString( aUStr7 ),
- OUString(),
- OUString( aUStr25 ),
- OUString( "\0",1,
- kEncodingRTLTextUSASCII,
- kConvertFlagsOStringToOUString),
- OUString( aUStr28 )};
-
- typedef struct TestCase
- {
- sal_Char* comments;
- OUString* expVal;
- OUStringBuffer* input1;
- const sal_Char* input2;
- sal_Int32 input3;
-
- ~TestCase() { delete input1; delete expVal; }
- } TestCase;
-
- TestCase arrTestCase[]={
-
- {"Appends the string(length less than 16) to the string buffer arrOUS[0]",
- new OUString(aUStr1),
- new OUStringBuffer(arrOUS[0]), kTestStr36, 12 },
- {"Appends the string(length more than 16) to the string buffer arrOUS[0]",
- new OUString(aUStr2),
- new OUStringBuffer(arrOUS[0]), kTestStr36, 28 },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[0]",
- new OUString(aUStr37),
- new OUStringBuffer(arrOUS[0]), kTestStr23, 16 },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[0]",
- new OUString(aUStr7),
- new OUStringBuffer(arrOUS[0]), kTestStr2, 0 },
- /* LLA: input3 must null < 0
- {"Appends the string(length less than 0) to the string buffer arrOUS[0]",
- new OUString(aUStr41),
- new OUStringBuffer(arrOUS[0]), kTestStr2, -1 },
- */
- {"Appends the string(length less than 16) to the string buffer arrOUS[1]",
- new OUString(aUStr7),
- new OUStringBuffer(arrOUS[1]), kTestStr2, 4 },
- {"Appends the string(length more than 16) to the string buffer arrOUS[1]",
- new OUString(aUStr2),
- new OUStringBuffer(arrOUS[1]), kTestStr2, 32 },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[1]",
- new OUString(aUStr1),
- new OUStringBuffer(arrOUS[1]), kTestStr2, 16 },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[1]",
- new OUString(),
- new OUStringBuffer(arrOUS[1]), kTestStr2, 0 },
- /* LLA: input3 must null < 0
- {"Appends the string(length less than 0) to the string buffer arrOUS[1]",
- new OUString(),
- new OUStringBuffer(arrOUS[1]), kTestStr2, -1 },
- */
- {"Appends the string(length less than 16) to the string buffer arrOUS[2]",
- new OUString(aUStr7),
- new OUStringBuffer(arrOUS[2]), kTestStr2, 4 },
- {"Appends the string(length more than 16) to the string buffer arrOUS[2]",
- new OUString(aUStr2),
- new OUStringBuffer(arrOUS[2]), kTestStr2, 32 },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[2]",
- new OUString(aUStr1),
- new OUStringBuffer(arrOUS[2]), kTestStr2, 16 },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[2]",
- new OUString(),
- new OUStringBuffer(arrOUS[2]), kTestStr2, 0 },
- /* LLA: input3 must null < 0
- {"Appends the string(length less than 0) to the string buffer arrOUS[2]",
- new OUString(),
- new OUStringBuffer(arrOUS[2]), kTestStr2, -1 },
- */
- {"Appends the string(length less than 16) to the string buffer arrOUS[3]",
- new OUString(aUStr7),
- new OUStringBuffer(arrOUS[3]), kTestStr2, 4 },
- {"Appends the string(length more than 16) to the string buffer arrOUS[3]",
- new OUString(aUStr2),
- new OUStringBuffer(arrOUS[3]), kTestStr2, 32 },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[3]",
- new OUString(aUStr1),
- new OUStringBuffer(arrOUS[3]), kTestStr2, 16 },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[3]",
- new OUString(),
- new OUStringBuffer(arrOUS[3]), kTestStr2, 0 },
- /* LLA: input3 must null < 0
- {"Appends the string(length less than 0) to the string buffer arrOUS[3]",
- new OUString(),
- new OUStringBuffer(arrOUS[3]), kTestStr2, -1 },
- */
- {"Appends the string(length less than 16) to the string buffer arrOUS[4]",
- new OUString(aUStr29),
- new OUStringBuffer(arrOUS[4]), kTestStr38, 7 },
- {"Appends the string(length more than 16) to the string buffer arrOUS[4]",
- new OUString(aUStr39),
- new OUStringBuffer(arrOUS[4]), kTestStr17, 22 },
- {"Appends the string(length equal to 16) to the string buffer arrOUS[4]",
- new OUString(aUStr40),
- new OUStringBuffer(arrOUS[4]), kTestStr31, 16 },
- {"Appends the string(length equal to 0) to the string buffer arrOUS[4]",
- new OUString(aUStr28),
- new OUStringBuffer(arrOUS[4]), kTestStr2, 0 },
- };
-
-
- sal_Bool res = sal_True;
- sal_uInt32 i;
-
- for (i = 0; i < (sizeof (arrTestCase))/(sizeof (TestCase)); i++)
- {
- arrTestCase[i].input1->appendAscii(
- arrTestCase[i].input2, arrTestCase[i].input3);
- sal_Bool lastRes =
- ( arrTestCase[i].input1->getStr()== *(arrTestCase[i].expVal) &&
- arrTestCase[i].input1->getLength() == arrTestCase[i].expVal->getLength() );
-
- c_rtl_tres_state
- (
- hRtlTestResult,
- lastRes,
- arrTestCase[i].comments,
- createName( pMeth, "appendAscii_002", i )
-
- );
-
- res &= lastRes;
- }
- return ( res );
-}
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer_appendAsciis(
- hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start( hRtlTestResult, "appendAsciis");
- sal_Bool bTSState = test_rtl_OUStringBuffer_appendAscii_001( hRtlTestResult );
- bTSState &= test_rtl_OUStringBuffer_appendAscii_002( hRtlTestResult);
-
- c_rtl_tres_state_end( hRtlTestResult, "appendAsciis");
-// return( bTSState );
-}
-// -----------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_OUStringBuffer( hTestResult hRtlTestResult )
-{
-
- c_rtl_tres_state_start(hRtlTestResult, "rtl_OUStringBuffer" );
-
- test_rtl_OUStringBuffer_ctors( hRtlTestResult );
- test_rtl_OUStringBuffer_makeStringAndClear( hRtlTestResult );
- test_rtl_OUStringBuffer_getLength( hRtlTestResult );
- test_rtl_OUStringBuffer_getCapacity( hRtlTestResult );
- test_rtl_OUStringBuffer_ensureCapacity( hRtlTestResult );
- test_rtl_OUStringBuffer_setLength( hRtlTestResult );
- test_rtl_OUStringBuffer_csuc( hRtlTestResult );
- test_rtl_OUStringBuffer_getStr( hRtlTestResult );
- test_rtl_OUStringBuffer_appends( hRtlTestResult );
- test_rtl_OUStringBuffer_appendAsciis( hRtlTestResult );
-
- c_rtl_tres_state_end(hRtlTestResult, "rtl_OUStringBuffer");
-}
-
-// -----------------------------------------------------------------------------
-void RegisterAdditionalFunctions(FktRegFuncPtr _pFunc)
-{
- if (_pFunc)
- {
- (_pFunc)(&test_rtl_OUStringBuffer, "");
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl_strings/rtl_String_Const.h b/sal/qa/rtl_strings/rtl_String_Const.h
deleted file mode 100644
index bc1fbe8c7545..000000000000
--- a/sal/qa/rtl_strings/rtl_String_Const.h
+++ /dev/null
@@ -1,812 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _RTL_STRING_CONST_H_
-#define _RTL_STRING_CONST_H_
-
-#include <rtl_String_Utils.hxx>
-
-#include <limits.h>
-
-#include <sal/types.h>
-#include <rtl/textenc.h>
-#include <rtl/ustring.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-static const rtl_TextEncoding kEncodingRTLTextUSASCII = RTL_TEXTENCODING_ASCII_US;
-
-static const sal_uInt32 kConvertFlagsOUStringToOString = OUSTRING_TO_OSTRING_CVTFLAGS;
-static const sal_uInt32 kConvertFlagsOStringToOUString = OSTRING_TO_OUSTRING_CVTFLAGS;
-
-static const sal_Char *kTestStr1 = "Sun Microsystems";
-static const sal_Char *kTestStr2 = "Sun Microsystems Java Technology";
-static const sal_Char *kTestStr4 = "SUN MICROSYSTEMS";
-static const sal_Char *kTestStr5 = "sun microsystems";
-static const sal_Char *kTestStr6 = "Java Technology";
-static const sal_Char *kTestStr7 = "Sun ";
-static const sal_Char *kTestStr8 = "Microsystems";
-static const sal_Char *kTestStr9 = "sun microsystems java technology";
-static const sal_Char *kTestStr10 = " Sun Microsystems";
-static const sal_Char *kTestStr11 = "Sun Microsystems ";
-static const sal_Char *kTestStr12 = " Sun Microsystems ";
-static const sal_Char *kTestStr13 = "Sun Microsystems ";
-static const sal_Char *kTestStr14 = " Sun Microsystems";
-static const sal_Char *kTestStr15 = " Sun Microsystems ";
-static const sal_Char *kTestStr16 = " Sun Microsystems ";
-static const sal_Char *kTestStr17 = " Sun Microsystems ";
-static const sal_Char *kTestStr18 = "sUN MICROsYsTEMs";
-static const sal_Char *kTestStr19 = "---Sun-Microsystems---";
-static const sal_Char *kTestStr20 = "sun";
-static const sal_Char *kTestStr21 = "SUN";
-static const sal_Char *kTestStr22 = "SUN MICROSYSTEMS JAVA TECHNOLOGY";
-static const sal_Char *kTestStr23 = " Java Technology";
-static const sal_Char *kTestStr24 = "Sun Microsystems Java Technolog";
-static const sal_Char *kTestStr25 = "";
-static const sal_Char *kTestStr26 = " Mic";
-static const sal_Char *kTestStr27 = "s";
-static const sal_Char *kTestStr28 = "\50\3\5\7\11\13\15\17sun";
-static const sal_Char *kTestStr29 = "\50\3\5\7\11\13\15\17sun\21\23\25\27\31\33\50";
-static const sal_Char *kTestStr30 = "sun\21\23\25\27\31\33\50";
-static const sal_Char *kTestStr31 = "sun Microsystems";
-static const sal_Char *kTestStr36 = "Microsystems Java Technology";
-static const sal_Char *kTestStr37 = "Sun Java Technology";
-static const sal_Char *kTestStr38 = "\21\23\25\27\31\33\50";
-static const sal_Char *kTestStr39 = "\50\3\5\7\11\13\15\17sun Sun Microsystems ";
-static const sal_Char *kTestStr40 = "\50\3\5\7\11\13\15\17sunsun Microsystems";
-static const sal_Char *kTestStr41 = "Sun";
-static const sal_Char *kTestStr42 = "\50\3\5\7\11\13\15\17su";
-static const sal_Char *kTestStr43 = "\50\3\5\7\11\13\15\17sun\256\345";
-static const sal_Char *kTestStr44 = "\256\345";
-static const sal_Char *kTestStr45 = "Sun true";
-static const sal_Char *kTestStr46 = "Sun false";
-static const sal_Char *kTestStr47 = "true";
-static const sal_Char *kTestStr48 = "false";
-static const sal_Char *kTestStr49 = "\50\3\5\7\11\13\15\17suntrue";
-static const sal_Char *kTestStr50 = "\50\3\5\7\11\13\15\17sunfalse";
-static const sal_Char *kTestStr51 = "Sun M";
-//static const sal_Char *kTestStr52 = "Sun \077777";
-//static const sal_Char *kTestStr53 = "Sun \100000";
-//static const sal_Char *kTestStr54 = "\77777";
-//static const sal_Char *kTestStr55 = "\100000";
-static const sal_Char *kTestStr56 = "\50\3\5\7\11\13\15\17suns";
-//static const sal_Char *kTestStr57 = "\50\3\5\7\11\13\15\17sun\77777";
-//static const sal_Char *kTestStr58 = "\50\3\5\7\11\13\15\17sun\10000";
-static const sal_Char *kTestStr1PlusStr6 = "Sun Microsystems" "Java Technology";
-
-static const sal_Int32 kTestStr1Len = 16;
-static const sal_Int32 kTestStr2Len = 32;
-static const sal_Int32 kTestStr3Len = 16;
-static const sal_Int32 kTestStr4Len = 16;
-static const sal_Int32 kTestStr5Len = 16;
-static const sal_Int32 kTestStr6Len = 15;
-static const sal_Int32 kTestStr7Len = 4;
-static const sal_Int32 kTestStr8Len = 12;
-static const sal_Int32 kTestStr9Len = 32;
-static const sal_Int32 kTestStr10Len = 17;
-static const sal_Int32 kTestStr11Len = 17;
-static const sal_Int32 kTestStr12Len = 18;
-static const sal_Int32 kTestStr13Len = 19;
-static const sal_Int32 kTestStr14Len = 19;
-static const sal_Int32 kTestStr15Len = 20;
-static const sal_Int32 kTestStr16Len = 20;
-static const sal_Int32 kTestStr17Len = 22;
-static const sal_Int32 kTestStr18Len = 16;
-static const sal_Int32 kTestStr19Len = 22;
-static const sal_Int32 kTestStr20Len = 3;
-static const sal_Int32 kTestStr21Len = 3;
-static const sal_Int32 kTestStr22Len = 32;
-static const sal_Int32 kTestStr23Len = 16;
-static const sal_Int32 kTestStr24Len = 31;
-static const sal_Int32 kTestStr25Len = 0;
-static const sal_Int32 kTestStr26Len = 4;
-static const sal_Int32 kTestStr27Len = 1;
-static const sal_Int32 kTestStr28Len = 11;
-static const sal_Int32 kTestStr29Len = 18;
-static const sal_Int32 kTestStr30Len = 10;
-static const sal_Int32 kTestStr31Len = 16;
-static const sal_Int32 kTestStr32Len = 16;
-static const sal_Int32 kTestStr33Len = 1;
-static const sal_Int32 kTestStr34Len = 11;
-static const sal_Int32 kTestStr35Len = 11;
-static const sal_Int32 kTestStr36Len = 28;
-static const sal_Int32 kTestStr37Len = 20;
-static const sal_Int32 kTestStr38Len = 7;
-static const sal_Int32 kTestStr39Len = 33;
-static const sal_Int32 kTestStr40Len = 27;
-static const sal_Int32 kTestStr41Len = 3;
-static const sal_Int32 kTestStr42Len = 10;
-static const sal_Int32 kTestStr43Len = 13;
-static const sal_Int32 kTestStr44Len = 2;
-static const sal_Int32 kTestStr45Len = 8;
-static const sal_Int32 kTestStr46Len = 9;
-static const sal_Int32 kTestStr47Len = 4;
-static const sal_Int32 kTestStr48Len = 5;
-static const sal_Int32 kTestStr49Len = 15;
-static const sal_Int32 kTestStr50Len = 16;
-static const sal_Int32 kTestStr51Len = 5;
-static const sal_Int32 kTestStr52Len = 5;
-static const sal_Int32 kTestStr53Len = 5;
-static const sal_Int32 kTestStr54Len = 1;
-static const sal_Int32 kTestStr55Len = 1;
-static const sal_Int32 kTestStr56Len = 12;
-static const sal_Int32 kTestStr57Len = 12;
-static const sal_Int32 kTestStr58Len = 12;
-static const sal_Int32 kTestStr1PlusStr6Len = kTestStr1Len + kTestStr6Len;
-
- static sal_Unicode aUStr1[kTestStr1Len+1];
- static sal_Unicode aUStr2[kTestStr2Len+1];
- static sal_Unicode aUStr3[kTestStr3Len+1];
- static sal_Unicode aUStr4[kTestStr4Len+1];
- static sal_Unicode aUStr5[kTestStr5Len+1];
- static sal_Unicode aUStr6[kTestStr6Len+1];
- static sal_Unicode aUStr7[kTestStr7Len+1];
- static sal_Unicode aUStr8[kTestStr8Len+1];
- static sal_Unicode aUStr9[kTestStr9Len+1];
- static sal_Unicode aUStr10[kTestStr10Len+1];
- static sal_Unicode aUStr11[kTestStr11Len+1];
- static sal_Unicode aUStr12[kTestStr12Len+1];
- static sal_Unicode aUStr13[kTestStr13Len+1];
- static sal_Unicode aUStr14[kTestStr14Len+1];
- static sal_Unicode aUStr15[kTestStr15Len+1];
- static sal_Unicode aUStr16[kTestStr16Len+1];
- static sal_Unicode aUStr17[kTestStr17Len+1];
- static sal_Unicode aUStr18[kTestStr18Len+1];
- static sal_Unicode aUStr19[kTestStr19Len+1];
- static sal_Unicode aUStr20[kTestStr20Len+1];
- static sal_Unicode aUStr21[kTestStr21Len+1];
- static sal_Unicode aUStr22[kTestStr22Len+1];
- static sal_Unicode aUStr23[kTestStr23Len+1];
- static sal_Unicode aUStr24[kTestStr24Len+1];
- static sal_Unicode aUStr25[kTestStr25Len+1];
- static sal_Unicode aUStr26[kTestStr26Len+1];
- static sal_Unicode aUStr27[kTestStr27Len+1];
- static sal_Unicode aUStr28[kTestStr28Len+1];
- static sal_Unicode aUStr29[kTestStr29Len+1];
- static sal_Unicode aUStr30[kTestStr30Len+1];
- static sal_Unicode aUStr31[kTestStr31Len+1];
- static sal_Unicode aUStr32[kTestStr32Len+1];
- static sal_Unicode aUStr33[kTestStr33Len+1];
- static sal_Unicode aUStr34[kTestStr34Len+1];
- static sal_Unicode aUStr35[kTestStr35Len+1];
- static sal_Unicode aUStr36[kTestStr36Len+1];
- static sal_Unicode aUStr37[kTestStr37Len+1];
- static sal_Unicode aUStr38[kTestStr38Len+1];
- static sal_Unicode aUStr39[kTestStr39Len+1];
- static sal_Unicode aUStr40[kTestStr40Len+1];
- static sal_Unicode aUStr41[kTestStr41Len+1];
- static sal_Unicode aUStr42[kTestStr42Len+1];
- static sal_Unicode aUStr43[kTestStr43Len+1];
- static sal_Unicode aUStr44[kTestStr44Len+1];
- static sal_Unicode aUStr45[kTestStr45Len+1];
- static sal_Unicode aUStr46[kTestStr46Len+1];
- static sal_Unicode aUStr47[kTestStr47Len+1];
- static sal_Unicode aUStr48[kTestStr48Len+1];
- static sal_Unicode aUStr49[kTestStr49Len+1];
- static sal_Unicode aUStr50[kTestStr50Len+1];
- static sal_Unicode aUStr51[kTestStr51Len+1];
-// static sal_Unicode aUStr52[kTestStr52Len+1]={83,117,110,32,32767};
-// static sal_Unicode aUStr53[kTestStr53Len+1]={83,117,110,32,SAL_MIN_INT16 /*-32768*/};
-// static sal_Unicode aUStr54[kTestStr54Len+1]={32767};
-// static sal_Unicode aUStr55[kTestStr55Len+1]={SAL_MIN_INT16 /*-32768*/};
- static sal_Unicode aUStr56[kTestStr56Len+1];
-// static sal_Unicode aUStr57[kTestStr57Len+1]={40,3,5,7,9,11,13,15,115,117,110,32767};
-// static sal_Unicode aUStr58[kTestStr58Len+1]={40,3,5,7,9,11,13,15,115,117,110,SAL_MIN_INT16 /*-32768*/};
- static sal_Unicode aUStr1PlusUStr6[kTestStr1Len + kTestStr6Len + 1];
-
-// we are already in "C"
-
-static sal_Bool SAL_CALL test_ini_uString()
-{
-
- sal_Bool iniResult= sal_True;
-
- iniResult &=AStringToUStringNCopy( aUStr1, kTestStr1, kTestStr1Len );
-
- iniResult &=AStringToUStringNCopy( aUStr2, kTestStr2, kTestStr2Len );
-
- iniResult &=AStringToUStringNCopy( aUStr3, kTestStr3, kTestStr3Len );
-
- iniResult &=AStringToUStringNCopy( aUStr4, kTestStr4, kTestStr4Len );
-
- iniResult &=AStringToUStringNCopy( aUStr5, kTestStr5, kTestStr5Len );
-
- iniResult &=AStringToUStringNCopy( aUStr6, kTestStr6, kTestStr6Len );
-
- iniResult &=AStringToUStringNCopy( aUStr7, kTestStr7, kTestStr7Len );
-
- iniResult &=AStringToUStringNCopy( aUStr8, kTestStr8, kTestStr8Len );
-
- iniResult &=AStringToUStringNCopy( aUStr9, kTestStr9, kTestStr9Len );
-
- iniResult &=AStringToUStringNCopy( aUStr10, kTestStr10, kTestStr10Len );
-
- iniResult &=AStringToUStringNCopy( aUStr11, kTestStr11, kTestStr11Len );
-
- iniResult &=AStringToUStringNCopy( aUStr12, kTestStr12, kTestStr12Len );
-
- iniResult &=AStringToUStringNCopy( aUStr13, kTestStr13, kTestStr13Len );
-
- iniResult &=AStringToUStringNCopy( aUStr14, kTestStr14, kTestStr14Len );
-
- iniResult &=AStringToUStringNCopy( aUStr15, kTestStr15, kTestStr15Len );
-
- iniResult &=AStringToUStringNCopy( aUStr16, kTestStr16, kTestStr16Len );
-
- iniResult &=AStringToUStringNCopy( aUStr17, kTestStr17, kTestStr17Len );
-
- iniResult &=AStringToUStringNCopy( aUStr18, kTestStr18, kTestStr18Len );
-
- iniResult &=AStringToUStringNCopy( aUStr19, kTestStr19, kTestStr19Len );
-
- iniResult &=AStringToUStringNCopy( aUStr20, kTestStr20, kTestStr20Len );
-
- iniResult &=AStringToUStringNCopy( aUStr21, kTestStr21, kTestStr21Len );
-
- iniResult &=AStringToUStringNCopy( aUStr22, kTestStr22, kTestStr22Len );
-
- iniResult &=AStringToUStringNCopy( aUStr23, kTestStr23, kTestStr23Len );
-
- iniResult &=AStringToUStringNCopy( aUStr1PlusUStr6, kTestStr1PlusStr6, kTestStr1PlusStr6Len );
-
- iniResult &=AStringToUStringNCopy( aUStr24, kTestStr24, kTestStr24Len );
-
- iniResult &=AStringToUStringNCopy( aUStr25, kTestStr25, kTestStr25Len );
-
- iniResult &=AStringToUStringNCopy( aUStr26, kTestStr26, kTestStr26Len );
-
- iniResult &=AStringToUStringNCopy( aUStr27, kTestStr27, kTestStr27Len );
-
- iniResult &=AStringToUStringNCopy( aUStr28, kTestStr28, kTestStr28Len );
-
- iniResult &=AStringToUStringNCopy( aUStr29, kTestStr29, kTestStr29Len );
-
- iniResult &=AStringToUStringNCopy( aUStr30, kTestStr30, kTestStr30Len );
-
- iniResult &=AStringToUStringNCopy( aUStr31, kTestStr31, kTestStr31Len );
-
- iniResult &=AStringToUStringNCopy( aUStr32, kTestStr32, kTestStr32Len );
-
- iniResult &=AStringToUStringNCopy( aUStr33, kTestStr33, kTestStr33Len );
-
- iniResult &=AStringToUStringNCopy( aUStr34, kTestStr34, kTestStr34Len );
-
- iniResult &=AStringToUStringNCopy( aUStr35, kTestStr35, kTestStr35Len );
-
- iniResult &=AStringToUStringNCopy( aUStr36, kTestStr36, kTestStr36Len );
-
- iniResult &=AStringToUStringNCopy( aUStr37, kTestStr37, kTestStr37Len );
-
- iniResult &=AStringToUStringNCopy( aUStr38, kTestStr38, kTestStr38Len );
-
- iniResult &=AStringToUStringNCopy( aUStr39, kTestStr39, kTestStr39Len );
-
- iniResult &=AStringToUStringNCopy( aUStr40, kTestStr40, kTestStr40Len );
-
- iniResult &=AStringToUStringNCopy( aUStr41, kTestStr41, kTestStr41Len );
-
- iniResult &=AStringToUStringNCopy( aUStr42, kTestStr42, kTestStr42Len );
-
- iniResult &=AStringToUStringNCopy( aUStr43, kTestStr43, kTestStr43Len );
-
- iniResult &=AStringToUStringNCopy( aUStr44, kTestStr44, kTestStr44Len );
-
- iniResult &=AStringToUStringNCopy( aUStr45, kTestStr45, kTestStr45Len );
-
- iniResult &=AStringToUStringNCopy( aUStr46, kTestStr46, kTestStr46Len );
-
- iniResult &=AStringToUStringNCopy( aUStr47, kTestStr47, kTestStr47Len );
-
- iniResult &=AStringToUStringNCopy( aUStr48, kTestStr48, kTestStr48Len );
-
- iniResult &=AStringToUStringNCopy( aUStr49, kTestStr49, kTestStr49Len );
-
- iniResult &=AStringToUStringNCopy( aUStr50, kTestStr50, kTestStr50Len );
-
- iniResult &=AStringToUStringNCopy( aUStr51, kTestStr51, kTestStr51Len );
-
- //iniResult &=AStringToUStringNCopy( aUStr52, kTestStr52, kTestStr52Len );
-
- // iniResult &=AStringToUStringNCopy( aUStr53, kTestStr53, kTestStr53Len );
-
- //iniResult &=AStringToUStringNCopy( aUStr54, kTestStr54, kTestStr54Len );
-
- //iniResult &=AStringToUStringNCopy( aUStr55, kTestStr55, kTestStr55Len );
-
- iniResult &=AStringToUStringNCopy( aUStr56, kTestStr56, kTestStr56Len );
-
- // iniResult &=AStringToUStringNCopy( aUStr57, kTestStr57, kTestStr57Len );
-
- //iniResult &=AStringToUStringNCopy( aUStr58, kTestStr58, kTestStr58Len );
- return iniResult;
-
-}
-
-
-
-
-static const sal_Int32 uTestStr1Len = 16;
-static const sal_Int32 uTestStr2Len = 32;
-static const sal_Int32 uTestStr3Len = 16;
-static const sal_Int32 uTestStr4Len = 16;
-static const sal_Int32 uTestStr5Len = 16;
-static const sal_Int32 uTestStr9Len = 32;
-static const sal_Int32 uTestStr22Len = 32;
-
-const sal_Unicode uTestStr31[]= {0x400,0x410,0x4DF};
-const sal_Unicode uTestStr32[]= {0x9F9F,0xA000,0x8F80,0x9AD9};
-
-static const sal_Int32 uTestStr31Len = 3;
-static const sal_Int32 uTestStr32Len = 4;
-
-static const sal_Int16 kRadixBinary = 2;
-static const sal_Int16 kRadixOctol = 8;
-static const sal_Int16 kRadixDecimal = 10;
-static const sal_Int16 kRadixHexdecimal = 16;
-static const sal_Int16 kRadixBase36 = 36;
-
-static const sal_Int8 kSInt8Max = SCHAR_MAX;
-static const sal_Int16 kUInt8Max = UCHAR_MAX;
-static const sal_Int16 kSInt16Max = SHRT_MAX;
-static const sal_Int32 kUInt16Max = USHRT_MAX;
-static const sal_Int32 kSInt32Max = INT_MAX;
-static const sal_Int64 kUInt32Max = UINT_MAX;
-#if (defined UNX)
-static const sal_Int64 kSInt64Max = 9223372036854775807LL;
-#else
-static const sal_Int64 kSInt64Max = 9223372036854775807;
-#endif
-//------------------------------------------------------------------------
-
-static const sal_Int32 kInt32MaxNumsCount = 5;
-
-static const sal_Int32 kInt32MaxNums[kInt32MaxNumsCount] =
- {
- kSInt8Max, kUInt8Max,
- kSInt16Max, kUInt16Max,
- kSInt32Max
- };
-
-static const sal_Int32 kInt64MaxNumsCount = 7;
-
-static const sal_Int64 kInt64MaxNums[kInt64MaxNumsCount] =
- {
- kSInt8Max, kUInt8Max,
- kSInt16Max, kUInt16Max,
- kSInt32Max, kUInt32Max,
- kSInt64Max
- };
-
-static const sal_Char *kSInt8MaxBinaryStr = "1111111";
-static const sal_Char *kUInt8MaxBinaryStr = "11111111";
-static const sal_Char *kSInt16MaxBinaryStr = "111111111111111";
-static const sal_Char *kUInt16MaxBinaryStr = "1111111111111111";
-static const sal_Char *kSInt32MaxBinaryStr =
- "1111111111111111111111111111111";
-static const sal_Char *kUInt32MaxBinaryStr =
- "11111111111111111111111111111111";
-static const sal_Char *kSInt64MaxBinaryStr =
- "111111111111111111111111111111111111111111111111111111111111111";
-
-//------------------------------------------------------------------------
-
-static const sal_Char *kSInt8MaxOctolStr = "177";
-static const sal_Char *kUInt8MaxOctolStr = "377";
-static const sal_Char *kSInt16MaxOctolStr = "77777";
-static const sal_Char *kUInt16MaxOctolStr = "177777";
-static const sal_Char *kSInt32MaxOctolStr = "17777777777";
-static const sal_Char *kUInt32MaxOctolStr = "37777777777";
-static const sal_Char *kSInt64MaxOctolStr = "777777777777777777777";
-
-//------------------------------------------------------------------------
-
-static const sal_Char *kSInt8MaxDecimalStr = "127";
-static const sal_Char *kUInt8MaxDecimalStr = "255";
-static const sal_Char *kSInt16MaxDecimalStr = "32767";
-static const sal_Char *kUInt16MaxDecimalStr = "65535";
-static const sal_Char *kSInt32MaxDecimalStr = "2147483647";
-static const sal_Char *kUInt32MaxDecimalStr = "4294967295";
-static const sal_Char *kSInt64MaxDecimalStr = "9223372036854775807";
-
-//------------------------------------------------------------------------
-
-static const sal_Char *kSInt8MaxHexDecimalStr = "7f";
-static const sal_Char *kUInt8MaxHexDecimalStr = "ff";
-static const sal_Char *kSInt16MaxHexDecimalStr = "7fff";
-static const sal_Char *kUInt16MaxHexDecimalStr = "ffff";
-static const sal_Char *kSInt32MaxHexDecimalStr = "7fffffff";
-static const sal_Char *kUInt32MaxHexDecimalStr = "ffffffff";
-static const sal_Char *kSInt64MaxHexDecimalStr = "7fffffffffffffff";
-
-//------------------------------------------------------------------------
-
-static const sal_Char *kSInt8MaxBase36Str = "3j";
-static const sal_Char *kUInt8MaxBase36Str = "73";
-static const sal_Char *kSInt16MaxBase36Str = "pa7";
-static const sal_Char *kUInt16MaxBase36Str = "1ekf";
-static const sal_Char *kSInt32MaxBase36Str = "zik0zj";
-static const sal_Char *kUInt32MaxBase36Str = "1z141z3";
-static const sal_Char *kSInt64MaxBase36Str = "1y2p0ij32e8e7";
-
-static const sal_Int32 kBinaryNumsCount = 16;
-
-static const sal_Char *kBinaryNumsStr[kBinaryNumsCount] =
- {
- "0", "1", "10", "11",
- "100", "101", "110", "111",
- "1000", "1001", "1010", "1011",
- "1100", "1101", "1110", "1111"
- };
-
-static const sal_Int32 kBinaryMaxNumsCount = 7;
-
-static const sal_Char *kBinaryMaxNumsStr[kBinaryMaxNumsCount] =
- {
- kSInt8MaxBinaryStr,
- kUInt8MaxBinaryStr,
- kSInt16MaxBinaryStr,
- kUInt16MaxBinaryStr,
- kSInt32MaxBinaryStr,
- kUInt32MaxBinaryStr,
- kSInt64MaxBinaryStr
- };
-
-//------------------------------------------------------------------------
-
-static const sal_Int32 kOctolNumsCount = 16;
-
-static const sal_Char *kOctolNumsStr[kOctolNumsCount] =
- {
- "0", "1", "2", "3",
- "4", "5", "6", "7",
- "10", "11", "12", "13",
- "14", "15", "16", "17"
- };
-
-static const sal_Int32 kOctolMaxNumsCount = 7;
-
-static const sal_Char *kOctolMaxNumsStr[kOctolMaxNumsCount] =
- {
- kSInt8MaxOctolStr,
- kUInt8MaxOctolStr,
- kSInt16MaxOctolStr,
- kUInt16MaxOctolStr,
- kSInt32MaxOctolStr,
- kUInt32MaxOctolStr,
- kSInt64MaxOctolStr
- };
-
-//------------------------------------------------------------------------
-
-static const sal_Int32 kDecimalNumsCount = 16;
-
-static const sal_Char *kDecimalNumsStr[kDecimalNumsCount] =
- {
- "0", "1", "2", "3",
- "4", "5", "6", "7",
- "8", "9", "10", "11",
- "12", "13", "14", "15"
- };
-
-static const sal_Int32 kDecimalMaxNumsCount = 7;
-
-static const sal_Char *kDecimalMaxNumsStr[kDecimalMaxNumsCount] =
- {
- kSInt8MaxDecimalStr,
- kUInt8MaxDecimalStr,
- kSInt16MaxDecimalStr,
- kUInt16MaxDecimalStr,
- kSInt32MaxDecimalStr,
- kUInt32MaxDecimalStr,
- kSInt64MaxDecimalStr
- };
-
-//------------------------------------------------------------------------
-
-static const sal_Int32 kHexDecimalNumsCount = 16;
-
-static const sal_Char *kHexDecimalNumsStr[kHexDecimalNumsCount] =
- {
- "0", "1", "2", "3",
- "4", "5", "6", "7",
- "8", "9", "a", "b",
- "c", "d", "e", "f"
- };
-
-static const sal_Int32 kHexDecimalMaxNumsCount = 7;
-
-static const sal_Char *kHexDecimalMaxNumsStr[kHexDecimalMaxNumsCount] =
- {
- kSInt8MaxHexDecimalStr,
- kUInt8MaxHexDecimalStr,
- kSInt16MaxHexDecimalStr,
- kUInt16MaxHexDecimalStr,
- kSInt32MaxHexDecimalStr,
- kUInt32MaxHexDecimalStr,
- kSInt64MaxHexDecimalStr
- };
-
-//------------------------------------------------------------------------
-
-static const sal_Int32 kBase36NumsCount = 36;
-
-static const sal_Char *kBase36NumsStr[kBase36NumsCount] =
- {
- "0", "1", "2", "3",
- "4", "5", "6", "7",
- "8", "9", "a", "b",
- "c", "d", "e", "f",
- "g", "h", "i", "j",
- "k", "l", "m", "n",
- "o", "p", "q", "r",
- "s", "t", "u", "v",
- "w", "x", "y", "z"
- };
-
-static const sal_Int32 kBase36MaxNumsCount = 7;
-
-static const sal_Char *kBase36MaxNumsStr[kBase36MaxNumsCount] =
- {
- kSInt8MaxBase36Str,
- kUInt8MaxBase36Str,
- kSInt16MaxBase36Str,
- kUInt16MaxBase36Str,
- kSInt32MaxBase36Str,
- kUInt32MaxBase36Str,
- kSInt64MaxBase36Str
- };
-
-static const sal_Int32 nDoubleCount=24;
-// static const sal_Char *inputDouble[nDoubleCount] =
-// {
-// "3","3.1","3.1415","3.1415926535","3.141592653589793",
-// "3.1415926535897932","3.14159265358979323","+3.1",
-// "3.141592653589793238462643","9.1096e-31","2.997925e8","6.241e18","5.381e+18",
-// "1.7e-309","6.5822e-16","1.7e+307","2.2e30","03.1"," 3.1","-3.1",
-// "-0.0","0.0","","1.00e308"
-// };
-static const double expValDouble[nDoubleCount]=
- {
- 3.0,3.1,3.1415,3.1415926535,3.141592653589793,
- 3.1415926535897932,3.14159265358979323,3.1,
- 3.141592653589793238462643,9.1096e-31,2.997925e8,6.241e18,5.381e18,
- 1.7e-309,6.5822e-16,1.7e+307,2.2e30,3.1,3.1,-3.1,
- 0.0,0.0,0.0,1.00e+308
- };
-//------------------------------------------------------------------------
-static const sal_Int32 nFloatCount=22;
-// static const sal_Char *inputFloat[nFloatCount] =
-// {
-// "3",
-// "3.1",
-// "3.1415",
-// "3.14159",
-// "3.141592",
-// "3.1415926",
-// "3.14159265",
-// "3.141592653589793238462643",
-// "6.5822e-16",
-// "9.1096e-31",
-// "2.997925e8",
-// "6.241e18",
-// "1.00e38",
-// "6.241e-37",
-// "6.241e37",
-// "03.1",
-// " 3.1",
-// "-3.1",
-// "+3.1",
-// "-0.0",
-// "0.0",
-// ""
-// };
-static const float expValFloat[nFloatCount] =
- {
- 3.0f,
- 3.1f,
- 3.1415f,
- 3.14159f,
- 3.141592f,
- 3.1415926f,
- 3.14159265f,
- 3.141592653589793238462643f,
- 6.5822e-16f,
- 9.1096e-31f,
- 2.997925e8f,
- 6.241e18f,
- 1.00e38f,
- 6.241e-37f,
- 6.241e37f,
- 3.1f,
- 3.1f,
- -3.1f,
- 3.1f,
- 0.0f,
- 0.0f,
- 0.0f
- };
-static const float fPrecision[nFloatCount] =
- {
- 3e-7f,
- 3e-7f,
- 3e-7f,
- 3e-7f,
- 3e-7f,
- 3e-7f,
- 3e-7f,
- 3e-7f,
- 6e-16f * 1e-7f,
- 9e-31f * 1e-7f,
- 3e8f * 1e-7f,
- 6e18f * 1e-7f,
- 1e38f * 1e-7f,
- 6e-37f * 1e-7f,
- 6e37f * 1e-7f,
- 3e-7f,
- 3e-7f,
- 3e-7f,
- 3e-7f,
- 1e-7f,
- 1e-7f,
- 1e-7f
- };
-//------------------------------------------------------------------------
-static const sal_Int32 nCharCount=15;
-static const sal_Char *inputChar[nCharCount] =
- {
- "A","a","0","-","_",
- "\25","\33","\35",
- "@","\n","\'","\"",
- "\0","","Sun Microsystems"
- };
-static const sal_Unicode expValChar[nCharCount] =
- {
- 65,97,48,45,95,
- 21,27,29,
- 64,10,39,34,
- 0,0,83
- };
-//------------------------------------------------------------------------
-static const sal_Int32 nDefaultCount=6;
-static const sal_Unicode input1Default[nDefaultCount] =
- {
- 77,115,85,119,32,0
- };
-static const sal_Int32 input2Default[nDefaultCount] =
- {
- 0,0,0,0,0,0
- };
-static const sal_Int32 expValDefault[nDefaultCount] =
- {
- 4,9,-1,-1,3,-1
- };
-//------------------------------------------------------------------------
-static const sal_Int32 nNormalCount=10;
-static const sal_Unicode input1Normal[nNormalCount] =
- {
- 77,77,77,115,115,115,119,119,0,0
- };
-static const sal_Int32 input2Normal[nNormalCount] =
- {
- 0,32,80,0,13,20,0,80,0,32
- };
-static const sal_Int32 expValNormal[nNormalCount] =
- {
- 4,-1,-1,9,15,-1,-1,-1,-1,-1
- };
-//------------------------------------------------------------------------
-static const sal_Int32 nlastDefaultCount=5;
-static const sal_Unicode input1lastDefault[nlastDefaultCount] =
- {
- 77,115,119,32,0
- };
-static const sal_Int32 input2lastDefault[nlastDefaultCount] =
- {
- 31,31,31,31,31
- };
-static const sal_Int32 expVallastDefault[nlastDefaultCount] =
- {
- 4,15,-1,21,-1
- };
-//------------------------------------------------------------------------
-static const sal_Int32 nlastNormalCount=8;
-static const sal_Unicode input1lastNormal[nlastNormalCount] =
- {
- 77,77,77,115,115,119,119,0
- };
-static const sal_Int32 input2lastNormal[nlastNormalCount] =
- {
- 29,0,80,31,3,31,80,31
- };
-static const sal_Int32 expVallastNormal[nlastNormalCount] =
- {
- 4,-1,4,15,-1,-1,-1,-1
- };
-//------------------------------------------------------------------------
-static const sal_Int32 nStrDefaultCount=6;
-static const sal_Unicode *input1StrDefault[nStrDefaultCount] =
- {
- aUStr7,aUStr8,aUStr21,
- aUStr30,aUStr25,aUStr26
- };
-static const sal_Int32 input2StrDefault[nStrDefaultCount] =
- {
- 0,0,0,0,0,0
- };
-static const sal_Int32 expValStrDefault[nStrDefaultCount] =
- {
- 0,4,-1,-1,-1,3
- };
-//------------------------------------------------------------------------
-static const sal_Int32 nStrNormalCount=9;
-static const sal_Unicode *input1StrNormal[nStrNormalCount] =
- {
- aUStr7,aUStr7,aUStr8,aUStr8,aUStr21,aUStr30,aUStr25,aUStr25,aUStr26
- };
-static const sal_Int32 input2StrNormal[nStrNormalCount] =
- {
- 0,32,0,30,0,0,0,32,0
- };
-static const sal_Int32 expValStrNormal[nStrNormalCount] =
- {
- 0,-1,4,-1,-1,-1,-1,-1,3
- };
-//------------------------------------------------------------------------
-static const sal_Int32 nStrLastDefaultCount=6;
-static const sal_Unicode *input1StrLastDefault[nStrLastDefaultCount] =
- {
- aUStr7,aUStr8,aUStr21,aUStr30,aUStr25,aUStr26
- };
-static const sal_Int32 input2StrLastDefault[nStrLastDefaultCount] =
- {
- 31,31,31,31,31,31
- };
-static const sal_Int32 expValStrLastDefault[nStrLastDefaultCount] =
- {
- 0,4,-1,-1,-1,3
- };
-//------------------------------------------------------------------------
-static const sal_Int32 nStrLastNormalCount=12;
-static const sal_Unicode *input1StrLastNormal[nStrLastNormalCount] =
- {
- aUStr7,aUStr7,aUStr7,aUStr8,aUStr8,aUStr21,aUStr30,
- aUStr25,aUStr25,aUStr26,aUStr27,aUStr27
- };
-static const sal_Int32 input2StrLastNormal[nStrLastNormalCount] =
- {
- 31,0,80,31,2,31,31,31,0,31,31,14
- };
-static const sal_Int32 expValStrLastNormal[nStrLastNormalCount] =
- {
- 0,-1,0,4,-1,-1,-1,-1,-1,3,15,11
- };
-//------------------------------------------------------------------------
-static const sal_Int32 kNonSInt32Max = INT_MIN;
-static const sal_Int32 kNonSInt16Max = SHRT_MIN;
-//------------------------------------------------------------------------
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _RTL_STRING_CONST_H_ */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl_strings/rtl_String_Utils.cxx b/sal/qa/rtl_strings/rtl_String_Utils.cxx
deleted file mode 100644
index af324fd33324..000000000000
--- a/sal/qa/rtl_strings/rtl_String_Utils.cxx
+++ /dev/null
@@ -1,164 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <math.h>
-#include <stdlib.h>
-#include <sal/types.h>
-#include <rtl/ustring.h>
-#include <rtl/string.hxx>
-#include <rtl_String_Utils_Const.h>
-
-using ::rtl::OString;
-sal_uInt32 AStringLen( const sal_Char *pAStr )
-{
- sal_uInt32 nStrLen = 0;
-
- if ( pAStr != NULL )
- {
- const sal_Char *pTempStr = pAStr;
-
- while( *pTempStr )
- {
- pTempStr++;
- } // while
-
- nStrLen = (sal_uInt32)( pTempStr - pAStr );
- } // if
-
- return nStrLen;
-} // AStringLen
-sal_Char* cpystr( sal_Char* dst, const sal_Char* src )
-{
- const sal_Char* psrc = src;
- sal_Char* pdst = dst;
-
- while( *pdst++ = *psrc++ );
- return ( dst );
-}
-
-sal_Char* cpynstr( sal_Char* dst, const sal_Char* src, sal_uInt32 cnt )
-{
-
- const sal_Char* psrc = src;
- sal_Char* pdst = dst;
- sal_uInt32 len = cnt;
- sal_uInt32 i;
-
- if ( len >= AStringLen(src) )
- {
- return( cpystr( dst, src ) );
- }
-
- // copy string by char
- for( i = 0; i < len; i++ )
- *pdst++ = *psrc++;
- *pdst = '\0';
-
- return ( dst );
-}
-
-//------------------------------------------------------------------------
-sal_Bool cmpstr( const sal_Char* str1, const sal_Char* str2, sal_uInt32 len )
-{
- const sal_Char* pBuf1 = str1;
- const sal_Char* pBuf2 = str2;
- sal_uInt32 i = 0;
-
- while ( (*pBuf1 == *pBuf2) && i < len )
- {
- (pBuf1)++;
- (pBuf2)++;
- i++;
- }
- return( i == len );
-}
-//------------------------------------------------------------------------
-sal_Bool cmpustr( const sal_Unicode* str1, const sal_Unicode* str2, sal_uInt32 len )
-{
- const sal_Unicode* pBuf1 = str1;
- const sal_Unicode* pBuf2 = str2;
- sal_uInt32 i = 0;
-
- while ( (*pBuf1 == *pBuf2) && i < len )
- {
- (pBuf1)++;
- (pBuf2)++;
- i++;
- }
- return( i == len );
-}
-
-//-----------------------------------------------------------------------
-sal_Bool cmpustr( const sal_Unicode* str1, const sal_Unicode* str2 )
-{
- const sal_Unicode* pBuf1 = str1;
- const sal_Unicode* pBuf2 = str2;
- sal_Bool res = sal_True;
-
- while ( (*pBuf1 == *pBuf2) && *pBuf1 !='\0' && *pBuf2 != '\0')
- {
- (pBuf1)++;
- (pBuf2)++;
- }
- if (*pBuf1 == '\0' && *pBuf2 == '\0')
- res = sal_True;
- else
- res = sal_False;
- return (res);
-}
-
-sal_Char* createName( sal_Char* dst, const sal_Char* meth, sal_uInt32 cnt )
-{
- sal_Char* pdst = dst;
- sal_Char nstr[16];
- sal_Char* pstr = nstr;
- rtl_str_valueOfInt32( pstr, cnt, 10 );
-
- cpystr( pdst, meth );
- cpystr( pdst+ AStringLen(meth), "_" );
-
- if ( cnt < 100 )
- {
- cpystr(pdst + AStringLen(pdst), "0" );
- }
- if ( cnt < 10 )
- {
- cpystr(pdst + AStringLen(pdst), "0" );
- }
-
- cpystr( pdst + AStringLen(pdst), nstr );
- return( pdst );
-}
-
-//------------------------------------------------------------------------
-
-static inline sal_Int32 ACharToUCharCompare( const sal_Unicode *pUStr,
- const sal_Char *pAStr
- )
-{
- sal_Int32 nCmp = 0;
- sal_Int32 nUChar = (sal_Int32)*pUStr;
- sal_Int32 nChar = (sal_Int32)((unsigned char)*pAStr);
-
- nCmp = nUChar - nChar;
-
- return nCmp;
-} // ACharToUCharCompare
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl_strings/rtl_String_Utils.hxx b/sal/qa/rtl_strings/rtl_String_Utils.hxx
deleted file mode 100644
index 811386f3966c..000000000000
--- a/sal/qa/rtl_strings/rtl_String_Utils.hxx
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _RTL_STRING_UTILS_HXX_
-#define _RTL_STRING_UTILS_HXX_
-
-#ifdef __cplusplus
-
-#include <math.h>
-#include <stdlib.h>
-
-#include <sal/types.h>
-#include <rtl/ustring.h>
-#include <rtl/string.hxx>
-
-sal_Char* cpystr( sal_Char* dst, const sal_Char* src );
-sal_Char* cpynstr( sal_Char* dst, const sal_Char* src, sal_uInt32 cnt );
-
-sal_Bool cmpstr( const sal_Char* str1, const sal_Char* str2, sal_uInt32 len );
-sal_Bool cmpustr( const sal_Unicode* str1, const sal_Unicode* str2, sal_uInt32 len );
-sal_Bool cmpustr( const sal_Unicode* str1, const sal_Unicode* str2 );
-
-sal_Char* createName( sal_Char* dst, const sal_Char* src, sal_uInt32 cnt );
-
-
-sal_uInt32 AStringLen( const sal_Char *pAStr );
-
-//------------------------------------------------------------------------
-
-sal_Bool AStringNIsValid( const sal_Char *pAStr,
- const sal_uInt32 nStrLen
- );
-
-//------------------------------------------------------------------------
-
-sal_Int32 AStringToUStringCompare( const sal_Unicode *pUStr,
- const sal_Char *pAStr
- );
-
-sal_Int32 AStringToUStringNCompare( const sal_Unicode *pUStr,
- const sal_Char *pAStr,
- const sal_uInt32 nAStrCount
- );
-
-#endif /* __cplusplus */
-
-#endif /* _RTL_STRING_UTILS_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl_strings/rtl_String_Utils_Const.h b/sal/qa/rtl_strings/rtl_String_Utils_Const.h
deleted file mode 100644
index e855199455b9..000000000000
--- a/sal/qa/rtl_strings/rtl_String_Utils_Const.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _RTL_STRING_UTILS_CONST_H_
-#define _RTL_STRING_UTILS_CONST_H_
-
-#include <sal/types.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-static const sal_Int32 kErrCompareAStringToUString = -2;
-static const sal_Int32 kErrCompareNAStringToUString = -3;
-static const sal_Int32 kErrCompareAStringToRTLUString = -4;
-static const sal_Int32 kErrCompareNAStringToRTLUString = -5;
-static const sal_Int32 kErrAStringToByteStringCompare = -6;
-static const sal_Int32 kErrAStringToByteStringNCompare = -7;
-static const sal_Int32 kErrCompareAStringToString = -8;
-static const sal_Int32 kErrCompareNAStringToString = -9;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _RTL_STRING_UTILS_CONST_H_ */
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl_strings/rtl_old_testostring.cxx b/sal/qa/rtl_strings/rtl_old_testostring.cxx
deleted file mode 100644
index 6d0c75d29d9d..000000000000
--- a/sal/qa/rtl_strings/rtl_old_testostring.cxx
+++ /dev/null
@@ -1,234 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-// LLA:
-// this file is converted to use with testshl2
-// original was placed in sal/test/textenc.cxx
-
-#include <string.h>
-#include <stdio.h>
-
-#include <rtl/string.hxx>
-
-#include <testshl/simpleheader.hxx>
-
-#define TEST_ENSURE(c, m) CPPUNIT_ASSERT_MESSAGE((m), (c))
-using ::rtl::OString;
-namespace rtl_OString
-{
- class oldtests : public CppUnit::TestFixture
- {
- public:
- void test_OString();
-
- CPPUNIT_TEST_SUITE( oldtests );
- CPPUNIT_TEST( test_OString );
- CPPUNIT_TEST_SUITE_END( );
- };
-
-
-#ifdef WNT
-#pragma warning( disable : 4723 )
-#endif
-
-void oldtests::test_OString()
-{
- TEST_ENSURE( sal_True, "_USENAMEPSACE defined");
-
- // "Mein erster RTL OString\n"
- // | | | | |
- // Index 0 5 10 15 20
- OString s1("Mein erster RTL OString\n");
- TEST_ENSURE( s1 == "Mein erster RTL OString\n", "test_OString error 1");
- TEST_ENSURE( s1.getLength() == 24, "test_OString error 2");
-
- OString s2 = s1;
- TEST_ENSURE( s2[16] == 'O', "test_OString error 3");
- TEST_ENSURE( s2.equals(s1), "test_OString error 4");
- TEST_ENSURE( s2.indexOf('O') == 16, "test_OString error 5");
- TEST_ENSURE( s2.indexOf('O', 5) == 16, "test_OString error 5a");
- TEST_ENSURE( s2.lastIndexOf('r') == 19, "test_OString error 6");
- TEST_ENSURE( s2[19] == 'r', "test_OString error 7");
- TEST_ENSURE( s2[23] == '\n', "test_OString error 8");
- TEST_ENSURE( s2.lastIndexOf('\n') == 23, "test_OString error 9");
- TEST_ENSURE( s2.lastIndexOf('M') == 0, "test_OString error 10");
- TEST_ENSURE( s2.lastIndexOf('t', s2.getLength() - 8) == 8, "test_OString error 9");
-
- // "Mein erster RTL OString ist ein String aus der RTL Library\n"
- // | | | | | | | | | | | |
- // Index 0 5 10 15 20 25 30 35 40 45 50 55
- OString s3 = s2.copy(0, s2.getLength() - 1);
- OString s4 = s3.concat(" ist ein String aus der RTL Library\n");
- TEST_ENSURE( s4.getLength() == 59, "test_OString error 11");
-
- s1 = s4.copy(0, 38);
- OString s5;
- s5 = s1 + " aus der RTL Library\n";
- TEST_ENSURE( s5.compareTo(s4) == 0 , "test_OString error 12");
- TEST_ENSURE( s5.indexOf("RTL") == 12, "test_OString error 13");
- TEST_ENSURE( s5.lastIndexOf("RTL") == 47, "test_OString error 13");
-
- sal_Bool b = sal_False;
- OString s6 = s5.valueOf(b);
- TEST_ENSURE( s6.compareTo("false") == 0, "test_OString error 14");
- s6 = s5.valueOf('H');
- TEST_ENSURE( s6.compareTo("H") == 0, "test_OString error 15");
- sal_Int32 n = 123456789L;
- s6 = s5.valueOf(n);
- TEST_ENSURE( s6.compareTo("123456789") == 0, "test_OString error 16");
-
-#ifdef SAL_UNX
- sal_Int64 m = -3223372036854775807LL;
-#else
- sal_Int64 m = -3223372036854775807;
-#endif
- s6 = s5.valueOf(m);
- TEST_ENSURE( s6.compareTo("-3223372036854775807") == 0, "test_OString error 17");
-
- OString s7("HaLLo");
- s7 = s7.toAsciiLowerCase();
- TEST_ENSURE( s7 == "hallo", "test_OString error 19");
- s7 = s7.toAsciiUpperCase();
- TEST_ENSURE( s7 == "HALLO", "test_OString error 20");
-
- OString s8("HaLLo ICH BIn eIn StRiNg");
- s7 = s8.toAsciiLowerCase();
-
- TEST_ENSURE( s8.equalsIgnoreAsciiCase(s7), "test_OString error 21");
-
- s8 = s7.toAsciiUpperCase();
- TEST_ENSURE( s8 == "HALLO ICH BIN EIN STRING", "test_OString error 22");
-
- s7 = " ";
- s8 = s7 + s8 + " ";
- TEST_ENSURE( s8 == " HALLO ICH BIN EIN STRING ",
- "test_OString error 23");
-
- s7 = s8.trim();
- TEST_ENSURE( s7 == "HALLO ICH BIN EIN STRING", "test_OString error 24");
- TEST_ENSURE( strcmp(s7.getStr(), "HALLO ICH BIN EIN STRING") == 0,
- "test_OString error 25");
-
- s7 = "Hallo";
- s8 = "aber Hallo";
-
- TEST_ENSURE( s7 < s8, "test_OString error 26");
- TEST_ENSURE( s8 > s7, "test_OString error 27");
- TEST_ENSURE( s7 != s8, "test_OString error 28");
- TEST_ENSURE( s7 != "blabla", "test_OString error 29");
- TEST_ENSURE( "blabla" != s7, "test_OString error 30");
-
- s8 = "Hallo";
- TEST_ENSURE( s7 <= s8, "test_OString error 31");
- TEST_ENSURE( s7 >= s8, "test_OString error 32");
-
- s8 = s8.replace('l', 'r');
- TEST_ENSURE( s8 == "Harro", "test_OString error 33");
-
- sal_Int32 nIndex = 0;
- s8 = "|hallo1|hallo2|hallo3|hallo4|hallo5|hallo6|hallo7|hallo8|";
- TEST_ENSURE( s8.getToken(3,'|', nIndex) == "hallo3", "test_OString error 40");
-
- char* Tokens[10] = { "", "hallo1", "hallo2", "hallo3", "hallo4",
- "hallo5", "hallo6", "hallo7", "hallo8", "" };
-
- nIndex = 0;
- sal_Int32 i = 0;
- do
- {
- TEST_ENSURE( s8.getToken(0,'|',nIndex) == Tokens[i], "test_OString error 40e");
- i++;
- }
- while ( nIndex >= 0 );
-
- s7 = "";
- s7 += s8;
- TEST_ENSURE( s7 == s8, "test_OString error 41");
-
- s7 = s8.replaceAt(8, 6, "mmmmmmmmmm");
- TEST_ENSURE( s7.getLength() == 61, "test_OString error 42");
-
- s8 = s7.replaceAt(8, 11, "");
- TEST_ENSURE( s8.getLength() == 50, "test_OString error 43");
-
- s7 = s8.replaceAt(8, 0, "hallo2|");
- TEST_ENSURE( s7.getLength() == 57, "test_OString error 44");
-
- sal_Int32 pos = 0;
- while ((pos = s7.indexOf("|")) >= 0)
- {
- s8 = s7.replaceAt(pos, 1, "**");
- s7 = s8;
- }
- TEST_ENSURE( s7.getLength() == 66, "test_OString error 45");
-
- TEST_ENSURE( OString( "aaa" ).compareTo( OString( "bbb" ) ) < 0, "test_OString error 46" );
- TEST_ENSURE( OString( "aaa" ).compareTo( OString( "aaa" ) ) == 0, "test_OString error 47" );
- TEST_ENSURE( OString( "bbb" ).compareTo( OString( "aaa" ) ) > 0, "test_OString error 48" );
- TEST_ENSURE( OString( "aaaa" ).compareTo( OString( "bbb" ) ) < 0, "test_OString error 49" );
- TEST_ENSURE( OString( "aaa" ).compareTo( OString( "bbbb" ) ) < 0, "test_OString error 50" );
- TEST_ENSURE( OString( "aaa" ).compareTo( OString( "aaaa" ) ) < 0, "test_OString error 51" );
- TEST_ENSURE( OString( "aaaa" ).compareTo( OString( "aaa" ) ) > 0, "test_OString error 52" );
- TEST_ENSURE( OString( "bbbb" ).compareTo( OString( "bbb" ) ) > 0, "test_OString error 53" );
- TEST_ENSURE( OString( "bbb" ) == OString( "bbb" ), "test_OString error 54" );
- TEST_ENSURE( OString( "bbb" ) == "bbb", "test_OString error 55" );
-
-/*
- * As clarified in #104229#, calling copy with invalid arguments causes
- * undefined behaviour, so the following test does no longer work:
-
- s7 = "Hallo jetzt komm ich";
- s8 = s7.copy(0, s7.indexOf(':'));
- TEST_ENSURE( s8.getLength() == 0, "test_OString error 56");
- TEST_ENSURE( s8.compareTo("") == 0, "test_OString error 57");
-*/
-
- double f = OString("1.7e-10").toDouble();
- TEST_ENSURE(f > 1E-10 && f < 2E-10, "1.7e-10 problem");
- f = OString("1.7e+10").toDouble();
- TEST_ENSURE(f > 1E10 && f < 2E10, "1.7e+10 problem");
- f = OString("1.7e10").toDouble();
- TEST_ENSURE(f > 1E10 && f < 2E10, "1.7e308 problem");
-
- {
- float f0 = 0;
- float f1 = 1;
- float fInf = f1 / f0;
- OString aStr1(OString::valueOf(fInf));
- OString aStr2("1.#INF");
- bool bSuccess = aStr1 == aStr2;
- if (!bSuccess)
- printf("ERROR: OString::valueOf(1f/0f): %s\n", aStr1.getStr());
- TEST_ENSURE(bSuccess, "OString::valueOf(1f/0f)");
- }
-
- printf("test_OString OK !!!\n");
- return;
-}
-
-} // namespace rtl_OString
-
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( rtl_OString::oldtests, "rtl_OString" );
-
-// -----------------------------------------------------------------------------
-NOADDITIONAL;
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl_strings/rtl_old_testowstring.cxx b/sal/qa/rtl_strings/rtl_old_testowstring.cxx
deleted file mode 100644
index f23287a5a25b..000000000000
--- a/sal/qa/rtl_strings/rtl_old_testowstring.cxx
+++ /dev/null
@@ -1,303 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-// LLA:
-// this file is converted to use with testshl2
-// original was placed in sal/test/textenc.cxx
-
-#include <string.h>
-#include <stdio.h>
-
-#ifdef UNX
-#include <wchar.h>
-#endif
-
-#include <rtl/ustring.hxx>
-
-#include <rtl/string.hxx>
-
-#include <testshl/simpleheader.hxx>
-
-#define TEST_ENSURE(c, m) CPPUNIT_ASSERT_MESSAGE((m), (c))
-
-using ::rtl::OUString;
-using ::rtl::OUStringToOString;
-using ::rtl::OStringToOUString;
-
-namespace rtl_OUString
-{
- class oldtests : public CppUnit::TestFixture
- {
- public:
- void test_OUString();
- void test_OString2OUStringAndViceVersa();
-
- CPPUNIT_TEST_SUITE( oldtests );
- CPPUNIT_TEST( test_OUString );
- CPPUNIT_TEST( test_OString2OUStringAndViceVersa );
- CPPUNIT_TEST_SUITE_END( );
- };
-
-
-void oldtests::test_OUString()
-{
- // "Mein erster RTL OUString\n"
- // | | | | |
- // Index 0 5 10 15 20
- OUString s1(OUString("Mein erster RTL OUString\n"));
- TEST_ENSURE( s1 == OUString("Mein erster RTL OUString\n"), "test_OWString error 1");
- TEST_ENSURE( s1.getLength() == 25, "test_OWString error 2");
-
- OUString s2 = s1;
- TEST_ENSURE( s2[16] == (sal_Unicode)'O', "test_OWString error 3");
- TEST_ENSURE( s2.equals(s1), "test_OWString error 4");
- TEST_ENSURE( OUString( OUString("hallo")) == OUString("hallo"), "test_OWString error 4");
- TEST_ENSURE( s2.indexOf((sal_Unicode)'O') == 16, "test_OWString error 5");
- TEST_ENSURE( s2.indexOf((sal_Unicode)'O', 5) == 16, "test_OWString error 5a");
- TEST_ENSURE( s2.lastIndexOf((sal_Unicode)'r') == 20, "test_OWString error 6");
- TEST_ENSURE( s2[20] == (sal_Unicode)'r', "test_OWString error 7");
- TEST_ENSURE( s2[24] == (sal_Unicode)'\n', "test_OWString error 8");
- TEST_ENSURE( s2.lastIndexOf((sal_Unicode)'\n') == 24, "test_OWString error 9");
- TEST_ENSURE( s2.lastIndexOf((sal_Unicode)'M') == 0, "test_OWString error 10");
- TEST_ENSURE( s2.lastIndexOf((sal_Unicode)'t', s2.getLength() - 8) == 8, "test_OWString error 9");
-
-
- // "Mein erster RTL OUString ist ein String aus der RTL Library\n"
- // | | | | | | | | | | | |
- // Index 0 5 10 15 20 25 30 35 40 45 50 55
- OUString s3 = s2.copy(0, s2.getLength() - 1);
- OUString s4 = s3.concat( OUString(" ist ein String aus der RTL Library\n") );
- TEST_ENSURE( s4.getLength() == 60, "test_OWString error 11");
-
- s1 = s4.copy(0, 39);
- OUString s5;
- s5 = s1 + OUString(" aus der RTL Library\n");
- TEST_ENSURE( s5.compareTo(s4) == 0 , "test_OWString error 12");
- TEST_ENSURE( s5.indexOf(OUString("RTL")) == 12, "test_OWString error 13");
- TEST_ENSURE( s5.lastIndexOf(OUString("RTL")) == 48, "test_OWString error 13");
-
- sal_Bool b = sal_False;
- OUString s6 = s5.valueOf(b);
-// TEST_ENSURE( s6.compareTo(OUString("False")) == 0, "test_OWString error 14");
- s6 = s5.valueOf((sal_Unicode)'H');
- TEST_ENSURE( s6.compareTo(OUString("H")) == 0, "test_OWString error 15");
- sal_Int32 n = 123456789L;
- s6 = s5.valueOf(n);
- TEST_ENSURE( s6.compareTo(OUString("123456789")) == 0, "test_OWString error 16");
-
-#ifdef SAL_UNX
- sal_Int64 m = -3223372036854775807LL;
-#else
- sal_Int64 m = -3223372036854775807;
-#endif
- s6 = s5.valueOf(m);
- TEST_ENSURE( s6.compareTo( OUString("-3223372036854775807") ) == 0, "test_OWString error 17");
-
- OUString s7;
- OUString s8(OUString("HALLO ICH BIN EIN SS"));
- s7 = OUString(" ");
- s8 = s7 + s8 + OUString(" ");
- TEST_ENSURE( s8 == OUString(" HALLO ICH BIN EIN SS "),
- "test_OWString error 22");
-
- s7 = s8.trim();
- TEST_ENSURE( s7 == OUString("HALLO ICH BIN EIN SS"), "test_OWString error 23");
-
- s7 = OUString("Hallo");
- s8 = OUString("aber Hallo");
-
- TEST_ENSURE( s7 < s8, "test_OWString error 25");
- TEST_ENSURE( s8 > s7, "test_OWString error 26");
- TEST_ENSURE( s7 != s8, "test_OWString error 27");
- TEST_ENSURE( s7 != OUString("blabla"), "test_OWString error 28");
- TEST_ENSURE( OUString("blabla") != s7, "test_OWString error 29");
-
- s8 = OUString("Hallo");
- TEST_ENSURE( s7 <= s8, "test_OWString error 30");
- TEST_ENSURE( s7 >= s8, "test_OwString error 31");
-
- s8 = s8.replace((sal_Unicode)'l', (sal_Unicode)'r');
- TEST_ENSURE( s8 == OUString("Harro"), "test_OWString error 32");
-
- // "Ich bin ein String mit einem A und C und vielen m, m, m, m"
- // | | | | | | | | | | | |
- //index 0 5 10 15 20 25 30 35 40 45 50 55
- s8 = OUString("Ich bin ein String mit einem A und C und vielen m, m, m, m");
-
- TEST_ENSURE( OUString("aaa").compareTo( OUString("bbb") ) < 0, "test_OWString error 46" );
- TEST_ENSURE( OUString("aaa").compareTo( OUString("aaa") ) == 0, "test_OWString error 46" );
- TEST_ENSURE( OUString("bbb").compareTo( OUString("aaa") ) > 0, "test_OWString error 47" );
- TEST_ENSURE( OUString("aaaa").compareTo( OUString("bbb") ) < 0, "test_OWString error 48" );
- TEST_ENSURE( OUString("aaa").compareTo( OUString("bbbb") ) < 0, "test_OWString error 49" );
- TEST_ENSURE( OUString("aaa").compareTo( OUString("aaaa") ) < 0, "test_OWString error 50" );
- TEST_ENSURE( OUString("aaaa").compareTo( OUString("aaa") ) > 0, "test_OWString error 51" );
- TEST_ENSURE( OUString("bbbb").compareTo( OUString("bbb") ) > 0, "test_OWString error 52" );
- TEST_ENSURE( OUString("bbb") == OUString("bbb"), "test_OWString error 53" );
- TEST_ENSURE( OUString("bbb") == OUString("bbb"), "test_OWString error 54" );
-
- {
- OUString uStr = OUString("Hallo");
- TEST_ENSURE( uStr.compareTo( OUString("Hallo"), 5 ) == 0, "test_OWString error 54.2.1" );
- TEST_ENSURE( uStr.compareTo( OUString("Halloa"), 6 ) < 0 , "test_OWString error 54.2.2" );
- TEST_ENSURE( uStr.compareTo( OUString("1Hallo"), 6 ) > 0, "test_OWString error 54.2.3" );
- TEST_ENSURE( uStr.compareTo( OUString("Aallo"), 5 ) > 0, "test_OWString error 54.2.4" );
- TEST_ENSURE( uStr.compareTo( OUString("Halla"), 5 ) > 0, "test_OWString error 54.2.5" );
- TEST_ENSURE( uStr.compareTo( OUString("Mallo"), 5 ) < 0, "test_OWString error 54.2.6" );
- TEST_ENSURE( uStr.compareTo( OUString("Hallp"), 5 ) < 0, "test_OWString error 54.2.7" );
- }
-
-#if OSL_DEBUG_LEVEL == 0
-//YD will fail copy assert on indexes, because ':' returns -1
- s7 = OUString("Hallo jetzt komm ich");
- s8 = s7.copy(0, s7.indexOf((sal_Unicode)':'));
- TEST_ENSURE( s8.isEmpty(), "test_OWString error 55");
- TEST_ENSURE( s8.compareTo(OUString()) == 0, "test_OWString error 56");
-#endif
-
- // ASCII-Schnittstellen, AB 15.10.1999
-
- // "Ich bin ein reiner ASCII-String mit ein paar Zahlen 0123456789 und Zeichen"
- // | | | | | | | | | | | | | | |
- //index 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70
- //
- // "Ich bin ein weiterer ASCII-String"
- // | | | | | | |
- //index 0 5 10 15 20 25 30
- sal_Char ascii_str1[] = "Ich bin ein reiner ASCII-String mit ein paar Zahlen 0123456789 und Zeichen";
- sal_Char ascii_str2[] = "Ich bin ein weiterer ASCII-String";
- OUString OWAsciiStr1 = OUString::createFromAscii( ascii_str1 );
- sal_Int32 nLen1 = OWAsciiStr1.getLength();
- TEST_ENSURE( nLen1 == 74, "test_OWString error 57" );
- OUString OWAsciiStr2 = OUString::createFromAscii( ascii_str2 );
- sal_Int32 nLen2 = OWAsciiStr2.getLength();
- TEST_ENSURE( nLen2 == 33, "test_OWString error 58" );
-
- sal_Int32 nCompareResult11 = OWAsciiStr1.compareToAscii( ascii_str1 );
- TEST_ENSURE( nCompareResult11 == 0, "test_OWString error 59" );
- sal_Int32 nCompareResult12 = OWAsciiStr1.compareToAscii( ascii_str2 );
- TEST_ENSURE( nCompareResult12 < 0, "test_OWString error 60" );
-
- sal_Int32 nCompareResult21 = OWAsciiStr2.compareToAscii( ascii_str1 );
- TEST_ENSURE( nCompareResult21 > 0, "test_OWString error 61" );
- sal_Int32 nCompareResult22 = OWAsciiStr2.compareToAscii( ascii_str2 );
- TEST_ENSURE( nCompareResult22 == 0, "test_OWString error 62" );
-
- sal_Int32 nCompareResult12_Len12 = OWAsciiStr1.compareToAscii( ascii_str2, 12 );
- TEST_ENSURE( nCompareResult12_Len12 == 0, "test_OWString error 63" );
- sal_Int32 nCompareResult12_Len13 = OWAsciiStr1.compareToAscii( ascii_str2, 13 );
- TEST_ENSURE( nCompareResult12_Len13 < 0, "test_OWString error 64" );
-
- sal_Int32 nCompareResult21_Len12 = OWAsciiStr2.compareToAscii( ascii_str1, 12 );
- TEST_ENSURE( nCompareResult21_Len12 == 0, "test_OWString error 65" );
- sal_Int32 nCompareResult21_Len13 = OWAsciiStr2.compareToAscii( ascii_str1, 13 );
- TEST_ENSURE( nCompareResult21_Len13 > 0, "test_OWString error 66" );
-
- {
- OUString uStr = OUString("Hallo");
- TEST_ENSURE( uStr.equalsAsciiL( "Hallo", 5 ), "test_OWString error 66.1.1" );
- TEST_ENSURE( !uStr.equalsAsciiL( "Hallo1", 6 ), "test_OWString error 66.1.2" );
- TEST_ENSURE( !uStr.equalsAsciiL( "1Hallo", 6 ), "test_OWString error 66.1.3" );
- TEST_ENSURE( !uStr.equalsAsciiL( "aallo", 5 ), "test_OWString error 66.1.2" );
- TEST_ENSURE( !uStr.equalsAsciiL( "Halla", 5 ), "test_OWString error 66.1.3" );
-
- TEST_ENSURE( uStr.reverseCompareToAsciiL( "Hallo", 5 ) == 0, "test_OWString error 66.2.1" );
- TEST_ENSURE( uStr.reverseCompareToAsciiL( "Halloa", 6 ) > 0 , "test_OWString error 66.2.2" );
- TEST_ENSURE( uStr.reverseCompareToAsciiL( "1Hallo", 6 ) < 0, "test_OWString error 66.2.3" );
- TEST_ENSURE( uStr.reverseCompareToAsciiL( "Aallo", 5 ) > 0, "test_OWString error 66.2.4" );
- TEST_ENSURE( uStr.reverseCompareToAsciiL( "Halla", 5 ) > 0, "test_OWString error 66.2.5" );
- TEST_ENSURE( uStr.reverseCompareToAsciiL( "Mallo", 5 ) < 0, "test_OWString error 66.2.6" );
- TEST_ENSURE( uStr.reverseCompareToAsciiL( "Hallp", 5 ) < 0, "test_OWString error 66.2.7" );
- }
-
- // toInt64
- OUString s9( OUString(" -3223372036854775807") );
- sal_Int64 ln1 = s9.toInt64();
-#if (defined UNX)
- TEST_ENSURE( ln1 == -3223372036854775807LL, "test_OWString error 67" );
-#else
- TEST_ENSURE( ln1 == -3223372036854775807, "test_OWString error 67" );
-#endif
- OUString s10( OUString("13243A65f1H45") );
- sal_Int64 ln2 = s10.toInt64();
- TEST_ENSURE( ln2 == 13243, "test_OWString error 68" );
-
- sal_Int64 ln3 = s10.toInt64( 16 );
-#if (defined UNX)
- TEST_ENSURE( ln3 == 0x13243A65F1LL, "test_OWString error 69" );
-#else
- TEST_ENSURE( ln3 == 0x13243A65F1, "test_OWString error 69" );
-#endif
- // Exotic base
- OUString s11( OUString("H4A") );
- sal_Int64 ln4 = s11.toInt64( 23 );
- TEST_ENSURE( ln4 == 23*23*17 + 4 * 23 + 10, "test_OWString error 70" );
-
- // toInt32
- OUString s12( OUString(" -220368507") );
- sal_Int32 n1 = s12.toInt32();
- TEST_ENSURE( n1 == -220368507, "test_OWString error 71" );
-
- OUString s13( OUString("4423A61H45") );
- sal_Int64 n2 = s13.toInt32();
- TEST_ENSURE( n2 == 4423, "test_OWString error 72" );
-
- sal_Int64 n3 = s13.toInt64( 16 );
- TEST_ENSURE( n3 == 0x4423A61, "test_OWString error 73" );
-
- printf("test_OWString OK !!!\n");
- return;
-}
-
-// -----------------------------------------------------------------------------
-
-void oldtests::test_OString2OUStringAndViceVersa()
-{
- OString s1("Hallo jetzt komm ich");
- OUString u1 = OStringToOUString(s1, RTL_TEXTENCODING_MS_1252);
- TEST_ENSURE( u1 == "Hallo jetzt komm ich", "test_OString2OWStringAndViceVersa error 1" );
- u1 = OStringToOUString(s1, RTL_TEXTENCODING_IBM_850);
- TEST_ENSURE( u1 == "Hallo jetzt komm ich", "test_OString2OWStringAndViceVersa error 2" );
- u1 = OStringToOUString(s1, RTL_TEXTENCODING_ISO_8859_15);
- TEST_ENSURE( u1 == "Hallo jetzt komm ich", "test_OString2OWStringAndViceVersa error 3" );
- u1 = OStringToOUString(s1, RTL_TEXTENCODING_ASCII_US);
- TEST_ENSURE( u1 == "Hallo jetzt komm ich", "test_OString2OWStringAndViceVersa error 4" );
-
- OString s2 = OUStringToOString(u1, RTL_TEXTENCODING_MS_1252);
- TEST_ENSURE( s2.equals("Hallo jetzt komm ich"), "test_OString2OWStringAndViceVersa error 5" );
- s2 = OUStringToOString(u1, RTL_TEXTENCODING_IBM_850);
- TEST_ENSURE( s2.equals("Hallo jetzt komm ich"), "test_OString2OWStringAndViceVersa error 6" );
- s2 = OUStringToOString(u1, RTL_TEXTENCODING_ISO_8859_15);
- TEST_ENSURE( s2.equals("Hallo jetzt komm ich"), "test_OString2OWStringAndViceVersa error 7" );
- s2 = OUStringToOString(u1, RTL_TEXTENCODING_ASCII_US);
- TEST_ENSURE( s2.equals("Hallo jetzt komm ich"), "test_OString2OWStringAndViceVersa error 8" );
-
- printf("test_OString2OWStringAndViceVersa OK !!!\n");
-}
-
-} // namespace rtl_OUString
-
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( rtl_OUString::oldtests, "rtl_OUString" );
-
-// -----------------------------------------------------------------------------
-NOADDITIONAL;
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl_strings/rtl_old_teststrbuf.cxx b/sal/qa/rtl_strings/rtl_old_teststrbuf.cxx
deleted file mode 100644
index 15a0851e6c8a..000000000000
--- a/sal/qa/rtl_strings/rtl_old_teststrbuf.cxx
+++ /dev/null
@@ -1,232 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-// LLA:
-// this file is converted to use with testshl2
-// original was placed in sal/test/textenc.cxx
-
-#include <string.h>
-#include <stdio.h>
-
-#include <rtl/strbuf.hxx>
-
-#include <rtl/ustrbuf.hxx>
-
-#include <testshl/simpleheader.hxx>
-
-using ::rtl::OUString;
-using ::rtl::OString;
-using ::rtl::OUStringBuffer;
-using ::rtl::OStringBuffer;
-#define TEST_ENSURE(c, m) CPPUNIT_ASSERT_MESSAGE((m), (c))
-
-
-namespace rtl_OStringBuffer
-{
- class oldtests : public CppUnit::TestFixture
- {
- public:
- void test_OStringBuffer();
-
- CPPUNIT_TEST_SUITE( oldtests );
- CPPUNIT_TEST( test_OStringBuffer );
- CPPUNIT_TEST_SUITE_END( );
- };
-
-
-void oldtests::test_OStringBuffer()
-{
- // "Mein erster RTL OString\n"
- // | | | | |
- // Index 0 5 10 15 20
- OString s1("Mein erster RTL OString\n");
-
- OStringBuffer b1(s1);
-
- TEST_ENSURE( b1.getCapacity() == 16 + s1.getLength(), "test_OStringBuffer error 1");
-
- b1.insert(b1.getLength() - 1, "Buffer");
- s1 = "Mein erster RTL OStringBuffer\n";
- TEST_ENSURE( s1 == b1.getStr(), "test_OStringBuffer error 2");
-
- b1.insert(b1.getLength() - 1, " ist viel zu gross fuer den alten Buffer");
- TEST_ENSURE( b1.getCapacity() == b1.getLength(), "test_OStringBuffer error 3");
-
- OStringBuffer b2(30);
-
- s1 = "false";
- sal_Bool b = sal_False;
- b2.append(b);
- TEST_ENSURE( s1 == b2.getStr(), "test_OStringBuffer error 4");
-
- sal_Int32 n = 123456789L;
- s1 += " 123456789";
- b2.append(" ");
- b2.append(n);
- TEST_ENSURE( s1 == b2.getStr(), "test_OStringBuffer error 5");
-
-#ifdef SAL_UNX
- sal_Int64 m = -3223372036854775807LL;
-#else
- sal_Int64 m = -3223372036854775807;
-#endif
- s1 += " -3223372036854775807";
- b2.append(" ");
- b2.append(m);
- TEST_ENSURE( s1 == b2.getStr(), "test_OStringBuffer error 6");
-
- OString s2(b2.makeStringAndClear());
- TEST_ENSURE( s1 == s2, "test_OStringBuffer error 7");
-
- b2.ensureCapacity(50);
- TEST_ENSURE( b2.getCapacity() == 50, "test_OStringBuffer error 8");
-
- b2.append("Hier fuege ich jetzt ein > <\n");
- b2.insert(26, " Hallo");
- s2 = "Hier fuege ich jetzt ein > Hallo <\n";
- TEST_ENSURE( s2 == b2.getStr(), "test_OStringBuffer error 9");
-
- b2.insert(26, b);
- b2.insert(26, " ");
- s2 = "Hier fuege ich jetzt ein > false Hallo <\n";
- TEST_ENSURE( s2 == b2.getStr(), "test_OStringBuffer error 10");
-
- b2.insert(26, n);
- b2.insert(26, " ");
- s2 = "Hier fuege ich jetzt ein > 123456789 false Hallo <\n";
- TEST_ENSURE( s2 == b2.getStr(), "test_OStringBuffer error 11");
-
- b2.insert(26, m);
- b2.insert(26, " ");
- s2 = "Hier fuege ich jetzt ein > -3223372036854775807 123456789 false Hallo <\n";
- TEST_ENSURE( s2 == b2.getStr(), "test_OStringBuffer error 12");
-
- printf("test_OStringBuffer OK !!!\n");
- return;
-}
-} // namespace rtl_OStringBuffer
-
-// -----------------------------------------------------------------------------
-
-namespace rtl_OUStringBuffer
-{
- class oldtests : public CppUnit::TestFixture
- {
- public:
- void test_OUStringBuffer();
-
- CPPUNIT_TEST_SUITE( oldtests );
- CPPUNIT_TEST( test_OUStringBuffer );
- CPPUNIT_TEST_SUITE_END( );
- };
-
-
-void oldtests::test_OUStringBuffer()
-{
- // "Mein erster RTL OUString\n"
- // | | | | |
- // Index 0 5 10 15 20
- OUString s1(OUString("Mein erster RTL OUString\n"));
-
- OUStringBuffer b1(s1);
-
- TEST_ENSURE( b1.getCapacity() == 16 + s1.getLength(), "test_OWStringBuffer error 1");
-
- b1.insert(b1.getLength() - 1, OUString("Buffer"));
- s1 = OUString("Mein erster RTL OUStringBuffer\n");
- TEST_ENSURE( s1 == b1.getStr(), "test_OWStringBuffer error 2");
-
- b1.insert(b1.getLength() - 1, OUString(" ist viel zu gross fuer den alten Buffer"));
- //TEST_ENSURE( b1.getCapacity() == b1.getLength(), "test_OWStringBuffer error 3");
-
- OUStringBuffer b2(30);
-
- s1 = OUString("false");
- sal_Bool b = sal_False;
- b2.append(b);
- TEST_ENSURE( s1 == b2.getStr(), "test_OWStringBuffer error 4");
-
- sal_Int32 n = 123456789L;
- s1 += " 123456789";
- b2.append(OUString(" "));
- b2.append(n);
- TEST_ENSURE( s1 == b2.getStr(), "test_OWStringBuffer error 5");
-
-#ifdef SAL_UNX
- sal_Int64 m = -3223372036854775807LL;
-#else
- sal_Int64 m = -3223372036854775807;
-#endif
- s1 += " -3223372036854775807";
- b2.append(OUString(" "));
- b2.append(m);
- TEST_ENSURE( s1 == b2.getStr(), "test_OWStringBuffer error 6");
-
- OUString s2(b2.makeStringAndClear());
- TEST_ENSURE( s1 == s2, "test_OWStringBuffer error 7");
-
- b2.ensureCapacity(50);
- TEST_ENSURE( b2.getCapacity() == 50, "test_OWStringBuffer error 8");
-
- b2.append(OUString("Hier fuege ich jetzt ein > <\n"));
- b2.insert(26, OUString(" Hallo"));
- s2 = OUString("Hier fuege ich jetzt ein > Hallo <\n");
- TEST_ENSURE( s2 == b2.getStr(), "test_OWStringBuffer error 9");
-
- b2.insert(26, b);
- b2.insert(26, OUString(" "));
- s2 = OUString("Hier fuege ich jetzt ein > false Hallo <\n");
- TEST_ENSURE( s2 == b2.getStr(), "test_OWStringBuffer error 10");
-
- b2.insert(26, n);
- b2.insert(26, OUString(" "));
- s2 = OUString("Hier fuege ich jetzt ein > 123456789 false Hallo <\n");
- TEST_ENSURE( s2 == b2.getStr(), "test_OWStringBuffer error 11");
-
- b2.insert(26, m);
- b2.insert(26, OUString(" "));
- s2 = OUString("Hier fuege ich jetzt ein > -3223372036854775807 123456789 false Hallo <\n");
- TEST_ENSURE( s2 == b2.getStr(), "test_OWStringBuffer error 12");
-
- // ASCII-Schnittstelle, AB 15.10.1999
- OUString s3(OUString("Noch'n RTL OUString"));
- OUStringBuffer b3(s3);
- sal_Char aAsciiStr[] = " mit appendetem ASCII\n";
- b3.appendAscii( aAsciiStr );
- s3 = OUString("Noch'n RTL OUString mit appendetem ASCII\n");
- TEST_ENSURE( b3.getStr() == s3 , "test_OWStringBuffer error 13");
-
-
-
- printf("test_OWStringBuffer OK !!!\n");
- return;
-}
-
-} // namespace rtl_OUStringBuffer
-
-
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( rtl_OUStringBuffer::oldtests, "rtl_OUStringBuffer" );
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( rtl_OStringBuffer::oldtests, "rtl_OStringBuffer" );
-
-// -----------------------------------------------------------------------------
-NOADDITIONAL;
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */