summaryrefslogtreecommitdiff
path: root/sal/qa/rtl
diff options
context:
space:
mode:
Diffstat (limited to 'sal/qa/rtl')
-rwxr-xr-xsal/qa/rtl/alloc/makefile.mk63
-rw-r--r--sal/qa/rtl/alloc/rtl_alloc.cxx158
-rw-r--r--sal/qa/rtl/bootstrap/bootstrap_process.cxx121
-rw-r--r--sal/qa/rtl/bootstrap/makefile.mk75
-rw-r--r--sal/qa/rtl/bootstrap/rtl_Bootstrap.cxx946
-rw-r--r--sal/qa/rtl/bootstrap/rtl_Bootstrap.xsce7
-rw-r--r--sal/qa/rtl/cipher/makefile.mk68
-rw-r--r--sal/qa/rtl/cipher/rtl_cipher.cxx664
-rwxr-xr-xsal/qa/rtl/crc32/makefile.mk66
-rw-r--r--sal/qa/rtl/crc32/rtl_crc32.cxx186
-rw-r--r--sal/qa/rtl/digest/makefile.mk61
-rw-r--r--sal/qa/rtl/digest/rtl_digest.cxx1453
-rw-r--r--sal/qa/rtl/doublelock/makefile.mk67
-rw-r--r--sal/qa/rtl/doublelock/rtl_doublelocking.cxx260
-rw-r--r--sal/qa/rtl/locale/makefile.mk66
-rw-r--r--sal/qa/rtl/locale/rtl_locale.cxx347
-rw-r--r--sal/qa/rtl/logfile/makefile.mk63
-rw-r--r--sal/qa/rtl/logfile/rtl_logfile.cxx255
-rw-r--r--sal/qa/rtl/math/rtl_math.cxx631
-rw-r--r--sal/qa/rtl/math/test-rtl-math.cxx72
-rw-r--r--sal/qa/rtl/math/test_rtl_math.cxx657
-rw-r--r--sal/qa/rtl/ostring/makefile.mk92
-rw-r--r--sal/qa/rtl/ostring/rtl_OString2.cxx575
-rw-r--r--sal/qa/rtl/ostring/rtl_str.cxx899
-rw-r--r--sal/qa/rtl/ostring/rtl_str.xsce26
-rw-r--r--sal/qa/rtl/ostring/rtl_string.cxx192
-rw-r--r--sal/qa/rtl/ostring/rtl_string.xsce1
-rw-r--r--sal/qa/rtl/oustring/joblist.txt10
-rw-r--r--sal/qa/rtl/oustring/makefile.mk81
-rw-r--r--sal/qa/rtl/oustring/rtl_OUString2.cxx1283
-rw-r--r--sal/qa/rtl/oustring/rtl_ustr.cxx1426
-rw-r--r--sal/qa/rtl/oustring/rtl_ustr.xsce33
-rw-r--r--sal/qa/rtl/oustringbuffer/makefile.mk57
-rw-r--r--sal/qa/rtl/oustringbuffer/test_oustringbuffer_noadditional.cxx36
-rw-r--r--sal/qa/rtl/oustringbuffer/test_oustringbuffer_tostring.cxx64
-rw-r--r--sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx136
-rw-r--r--sal/qa/rtl/process/child_process.cxx74
-rw-r--r--sal/qa/rtl/process/child_process_id.cxx66
-rw-r--r--sal/qa/rtl/process/makefile.mk76
-rw-r--r--sal/qa/rtl/process/rtl_Process.cxx302
-rw-r--r--sal/qa/rtl/process/rtl_Process_Const.h28
-rw-r--r--sal/qa/rtl/random/makefile.add19
-rw-r--r--sal/qa/rtl/random/makefile.mk58
-rw-r--r--sal/qa/rtl/random/random.txt5
-rw-r--r--sal/qa/rtl/random/rtl_random.cxx418
-rw-r--r--sal/qa/rtl/strings/makefile.mk58
-rw-r--r--sal/qa/rtl/strings/test_oustring_compare.cxx71
-rw-r--r--sal/qa/rtl/strings/test_oustring_convert.cxx188
-rw-r--r--sal/qa/rtl/strings/test_oustring_endswith.cxx126
-rw-r--r--sal/qa/rtl/strings/test_oustring_noadditional.cxx36
-rw-r--r--sal/qa/rtl/textenc/makefile.mk75
-rw-r--r--sal/qa/rtl/textenc/rtl_tencinfo.cxx1904
-rw-r--r--sal/qa/rtl/textenc/rtl_textcvt.cxx2905
-rw-r--r--sal/qa/rtl/uri/makefile.mk75
-rw-r--r--sal/qa/rtl/uri/rtl_Uri.cxx300
-rw-r--r--sal/qa/rtl/uri/rtl_testuri.cxx548
-rw-r--r--sal/qa/rtl/uuid/makefile.mk67
-rw-r--r--sal/qa/rtl/uuid/rtl_Uuid.cxx231
58 files changed, 0 insertions, 18827 deletions
diff --git a/sal/qa/rtl/alloc/makefile.mk b/sal/qa/rtl/alloc/makefile.mk
deleted file mode 100755
index 1a015da3b..000000000
--- a/sal/qa/rtl/alloc/makefile.mk
+++ /dev/null
@@ -1,63 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-PRJ=..$/..$/..
-
-PRJNAME=sal
-TARGET=qa_rtl_alloc
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-.IF "$(OS)" == "IOS"
-CFLAGSCXX += -DCPPUNIT_PLUGIN_EXPORTED_NAME=cppunitTest_$(TARGET)
-.ENDIF
-
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
-
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-
-SHL1OBJS= $(SLO)$/rtl_alloc.obj
-
-SHL1TARGET= rtl_Alloc
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-
-DEF1NAME =$(SHL1TARGET)
-SHL1VERSIONMAP= $(PRJ)$/qa$/export.map
-
-#------------------------------- All object files -------------------------------
-SLOFILES=$(SHL1OBJS)
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/alloc/rtl_alloc.cxx b/sal/qa/rtl/alloc/rtl_alloc.cxx
deleted file mode 100644
index ca4166a4f..000000000
--- a/sal/qa/rtl/alloc/rtl_alloc.cxx
+++ /dev/null
@@ -1,158 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-// autogenerated file with codegen.pl
-
-#include <rtl/alloc.h>
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
-
-#include <memory.h>
-
-namespace rtl_alloc
-{
-
- // small memory check routine, which return false, if there is a problem
-
- bool checkMemory(char* _pMemory, sal_uInt32 _nSize, char _n)
- {
- bool bOk = true;
-
- for (sal_uInt32 i=0;i<_nSize;i++)
- {
- if (_pMemory[i] != _n)
- {
- bOk = false;
- }
- }
- return bOk;
- }
-
-class Memory : public CppUnit::TestFixture
-{
- // for normal alloc functions
- char *m_pMemory;
- sal_uInt32 m_nSizeOfMemory;
-
-public:
- Memory()
- : m_pMemory(NULL)
- , m_nSizeOfMemory(1024)
- {
- }
-
- // initialise your test code values here.
- void setUp()
- {
- m_pMemory = (char*) rtl_allocateMemory( m_nSizeOfMemory );
- }
-
- void tearDown()
- {
- rtl_freeMemory(m_pMemory);
- m_pMemory = NULL;
- }
-
- void rtl_allocateMemory_001()
- {
- CPPUNIT_ASSERT_MESSAGE( "Can get zero memory.", m_pMemory != NULL);
- memset(m_pMemory, 1, m_nSizeOfMemory);
- CPPUNIT_ASSERT_MESSAGE( "memory contains wrong value.", checkMemory(m_pMemory, m_nSizeOfMemory, 1) == true);
- }
-
- void rtl_reallocateMemory_001()
- {
- sal_uInt32 nSize = 2 * 1024;
- m_pMemory = (char*)rtl_reallocateMemory(m_pMemory, nSize);
-
- CPPUNIT_ASSERT_MESSAGE( "Can reallocate memory.", m_pMemory != NULL);
- memset(m_pMemory, 2, nSize);
- CPPUNIT_ASSERT_MESSAGE( "memory contains wrong value.", checkMemory(m_pMemory, nSize, 2) == true);
- }
-
- CPPUNIT_TEST_SUITE(Memory);
- CPPUNIT_TEST(rtl_allocateMemory_001);
- CPPUNIT_TEST(rtl_reallocateMemory_001);
- CPPUNIT_TEST_SUITE_END();
-}; // class test
-
-class ZeroMemory : public CppUnit::TestFixture
-{
- // for zero functions
- char *m_pZeroMemory;
- sal_uInt32 m_nSizeOfZeroMemory;
-
-public:
- ZeroMemory()
- : m_pZeroMemory(NULL)
- , m_nSizeOfZeroMemory( 50 * 1024 * 1024 )
- {
- }
-
- // initialise your test code values here.
- void setUp()
- {
- m_pZeroMemory = (char*) rtl_allocateZeroMemory( m_nSizeOfZeroMemory );
- }
-
- void tearDown()
- {
- rtl_freeZeroMemory(m_pZeroMemory, m_nSizeOfZeroMemory);
- // LLA: no check possible, may GPF if there is something wrong.
- // CPPUNIT_ASSERT_MESSAGE( "Can get zero memory.", pZeroMemory != NULL);
- }
-
- // insert your test code here.
-
- void rtl_allocateZeroMemory_001()
- {
- CPPUNIT_ASSERT_MESSAGE( "Can get zero memory.", m_pZeroMemory != NULL);
- CPPUNIT_ASSERT_MESSAGE( "memory contains wrong value.", checkMemory(m_pZeroMemory, m_nSizeOfZeroMemory, 0) == true);
-
- memset(m_pZeroMemory, 3, m_nSizeOfZeroMemory);
- CPPUNIT_ASSERT_MESSAGE( "memory contains wrong value.", checkMemory(m_pZeroMemory, m_nSizeOfZeroMemory, 3) == true);
- }
-
- CPPUNIT_TEST_SUITE(ZeroMemory);
- CPPUNIT_TEST(rtl_allocateZeroMemory_001);
- CPPUNIT_TEST_SUITE_END();
-};
-
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_alloc::Memory);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_alloc::ZeroMemory);
-} // namespace rtl_alloc
-
-
-CPPUNIT_PLUGIN_IMPLEMENT();
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/bootstrap/bootstrap_process.cxx b/sal/qa/rtl/bootstrap/bootstrap_process.cxx
deleted file mode 100644
index cc3746e4f..000000000
--- a/sal/qa/rtl/bootstrap/bootstrap_process.cxx
+++ /dev/null
@@ -1,121 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-#include <stdlib.h>
-#include <stdio.h>
-#include "sal/main.h"
-#include <rtl/bootstrap.hxx>
-#include <rtl/ustring.h>
-#include <rtl/ustring.hxx>
-
-using namespace ::rtl;
-
-// ----------------------------------- Main -----------------------------------
-SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
-{
- (void)argc;
- Bootstrap aBootstrap;
- //custom .ini/rc file
- Bootstrap aBs_custom( OUString::createFromAscii(argv[3]) );
- OUString suValue;
- OUString suDefault( RTL_CONSTASCII_USTRINGPARAM("mydefault") );
- int flag = atoi( argv[1] );
-
- switch( flag ) {
- case 1:
- // parameters may be passed by command line arguments
- aBootstrap.getFrom(
- OUString(RTL_CONSTASCII_USTRINGPARAM("UNO_SERVICES")),
- suValue );
- if (suValue.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("service.rdb")) )
- {
- return 10;
- }
- else
- return 11;
- case 2:
- // parameters may be passed by ini file
- aBootstrap.getFrom(
- OUString(RTL_CONSTASCII_USTRINGPARAM("EXECUTABLE_RC")),
- suValue );
- if (suValue.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("true")) )
- {
- return 20;
- }
- else
- return 21;
- case 3:
- // parameters may be passed by command line arguments
- aBootstrap.getFrom(
- OUString(RTL_CONSTASCII_USTRINGPARAM("QADEV_BOOTSTRAP")),
- suValue );
- if (suValue.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sun&ms")) )
- {
- return 30;
- }
- else
- return 31;
- case 4:
- // parameters may be passed by custom .ini/rc file
- aBs_custom.getFrom(
- OUString(RTL_CONSTASCII_USTRINGPARAM("RTLVALUE")),
- suValue );
- if (suValue.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("qadev17")) )
- {
- return 40;
- }
- else
- return 41;
- case 5:
- // parameters may be passed by inheritance
- aBs_custom.getFrom(
- OUString(RTL_CONSTASCII_USTRINGPARAM("EXECUTABLE_RC")),
- suValue );
- if (suValue.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("true")) )
- {
- return 50;
- }
- else
- return 51;
- default:
- // parameters may be passed by inheritance
- aBs_custom.getFrom(
- OUString(RTL_CONSTASCII_USTRINGPARAM("ABCDE")),
- suValue, suDefault );
- if (suValue.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("mydefault")) )
- {
- return 60;
- }
- else
- return 61;
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/bootstrap/makefile.mk b/sal/qa/rtl/bootstrap/makefile.mk
deleted file mode 100644
index c1b9c2f3e..000000000
--- a/sal/qa/rtl/bootstrap/makefile.mk
+++ /dev/null
@@ -1,75 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-INCPRE+= $(PRJ)$/qa$/inc
-
-PRJNAME=sal
-TARGET=rtl_bootstrap
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-.IF "$(GUI)"=="WNT"
-BOOTSTRAPINI=testshl2.ini
-MY_SCRIPTCAT=cat
-.ELSE
-BOOTSTRAPINI=testshl2rc
-MY_SCRIPTCAT=tr -d "\015" <
-.ENDIF
-
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
-
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-
-# BEGIN ----------------------------------------------------------------
-# auto generated Target:joblist by codegen.pl
-SHL1OBJS= \
- $(SLO)$/rtl_Bootstrap.obj
-
-SHL1TARGET= rtl_Bootstrap
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-
-DEF1NAME =$(SHL1TARGET)
-SHL1VERSIONMAP= $(PRJ)$/qa$/export.map
-# END ------------------------------------------------------------------
-
-OBJ2FILES=$(OBJ)$/bootstrap_process.obj
-APP2TARGET=bootstrap_process
-APP2OBJS=$(OBJ2FILES)
-APP2STDLIBS=$(SALLIB)
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/bootstrap/rtl_Bootstrap.cxx b/sal/qa/rtl/bootstrap/rtl_Bootstrap.cxx
deleted file mode 100644
index 7a432d542..000000000
--- a/sal/qa/rtl/bootstrap/rtl_Bootstrap.cxx
+++ /dev/null
@@ -1,946 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-// Documentation about bootstraping can be found at:
-// http://udk.openoffice.org/common/man/concept/micro_deployment.html
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <algorithm> // STL
-
-#include "testshl/stringhelper.hxx"
-
-#include <testshl/simpleheader.hxx>
-#include <rtl/bootstrap.hxx>
-
-#include <rtl/ustrbuf.hxx>
-#include <rtl/ustring.h>
-#include <rtl/ustring.hxx>
-#include <osl/file.hxx>
-#include <osl/module.hxx>
-#include <osl/process.h> /* osl_getExecutableFile() */
-
-#include <osl/thread.hxx>
-
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::rtl::OUStringToOString;
-using ::rtl::OString;
-#define TESTSHL2_INI "testshl2"
-#define PSEUDO_INI "pseudo"
-
-/** print a UNI_CODE String. And also print some comments of the string.
- */
-inline void printUString( const ::rtl::OUString & str, const sal_Char * msg = "" )
-{
-
- if (msg && msg[0] != 0)
- {
- t_print("%s: ", msg );
- }
- rtl::OString aString;
- aString = ::rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US );
- t_print("%s\n", (char *)aString.getStr( ) );
-}
-
-/** if the file exist
- */
-bool t_fileExist(rtl::OUString const& _sFilename)
-{
- ::osl::FileBase::RC nError1;
- ::osl::File aTestFile( _sFilename );
- nError1 = aTestFile.open ( osl_File_OpenFlag_Read );
- if ( ( ::osl::FileBase::E_NOENT != nError1 ) && ( ::osl::FileBase::E_ACCES != nError1 ) )
- {
- aTestFile.close( );
- return true;
- }
- return false;
-}
-
-/** get the exectutable path ( here is bootstrap_process), on Linux, such as "sal/unxlngi4.pro/bin/"
- */
-inline ::rtl::OUString getModulePath( void )
-{
- ::rtl::OUString suDirPath;
- ::osl::Module::getUrlFromAddress( ( oslGenericFunction ) &getModulePath, suDirPath );
-
- suDirPath = suDirPath.copy( 0, suDirPath.lastIndexOf('/') );
- suDirPath = suDirPath.copy( 0, suDirPath.lastIndexOf('/') + 1);
- suDirPath += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bin"));
- return suDirPath;
-}
-
-#define TESTSHL2_INI "testshl2"
-#define PSEUDO_INI "pseudo"
-
-
-static rtl::OUString getExecutableDirectory()
-{
- rtl::OUString fileName;
- osl_getExecutableFile(&fileName.pData);
-
- sal_Int32 nDirEnd = fileName.lastIndexOf('/');
-
- OSL_ENSURE(nDirEnd >= 0, "Cannot locate executable directory");
-
- rtl::OUString aDirURL = fileName.copy(0, nDirEnd);
- return aDirURL;
-}
-
-
-// get the URL of testshl2rc/rtlrc/pseudorc
-inline rtl::OUString t_getSourcePath(rtl::OString const& _sFilename)
-{
-
- rtl::OUString aDirURL(getExecutableDirectory());
- aDirURL += OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
- aDirURL += OUString::createFromAscii( _sFilename.getStr() );
-#if defined(WNT)
- aDirURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".ini"));
-#else
- aDirURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rc"));
-#endif
- return aDirURL;
-}
-
-void thread_sleep_tenth_sec(sal_Int32 _nTenthSec)
-{
-#ifdef WNT //Windows
- Sleep(_nTenthSec * 100 );
-#endif
-#if ( defined UNX )
- TimeValue nTV;
- nTV.Seconds = static_cast<sal_uInt32>( _nTenthSec/10 );
- nTV.Nanosec = ( (_nTenthSec%10 ) * 100000000 );
- osl_waitThread(&nTV);
-#endif
-}
-
-// -----------------------------------------------------------------------------
-
-namespace rtl_Bootstrap
-{
- class ctor : public CppUnit::TestFixture
- {
- public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- // ctor with ini name
- void ctor_001()
- {
- rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
- printUString( suIniname );
- Bootstrap aBootstrap( suIniname );
- rtl::OUString suGetname; // = rtl::OUString();
- aBootstrap.getIniName( suGetname );
- printUString( suGetname );
-
- // LLA: first: this seems to be a wrong test.
- // second: there seems to be a design hole, if I give a absolute path ini file,
- // but try to use ${file::KEYVALUE} than 'file' will only used out of the 'executable path'/file
- // not from the path given from the absolute path.
-
- // Due to the fact, we create at this position a file (createTestshl2rc() ), we check for existance
- bool bFileExist = t_fileExist( suGetname );
- CPPUNIT_ASSERT_MESSAGE("ctor error with initial file.", bFileExist == true );
- }
-
- void ctor_002()
- {
- rtl::Bootstrap aBootstrap;
- rtl::OUString suGetname;
- aBootstrap.getIniName( suGetname );
- printUString( suGetname );
- CPPUNIT_ASSERT_MESSAGE("ctor error without initial file.", suGetname.getLength() != 0 );
- }
-
- CPPUNIT_TEST_SUITE(ctor);
- CPPUNIT_TEST(ctor_001);
- CPPUNIT_TEST(ctor_002);
- CPPUNIT_TEST_SUITE_END();
- }; // class ctor
-
- class getFrom : public CppUnit::TestFixture
- {
- public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
- // get the value of env variable
- void getFrom_001()
- {
- Bootstrap aBootstrap;
- rtl::OUString suValue;
- rtl::OUString suValuename (RTL_CONSTASCII_USTRINGPARAM("SOLAR_JAVA"));
- //aBootstrap.getFrom( suValuename, suValue );
- aBootstrap.getFrom( suValuename, suValue );
- sal_Char * pStr = getenv("SOLAR_JAVA");
- // printUString( suGetname );
- CPPUNIT_ASSERT_MESSAGE("get the value of environment variable.", suValue.compareToAscii( pStr ) == 0 );
- }
- /* Notes on Windows:
- void getFrom_001_1()
- {
- Bootstrap aBootstrap;
- rtl::OUString suValue;
- rtl::OUString suValuename (RTL_CONSTASCII_USTRINGPARAM("SRC_ROOT"));
- //aBootstrap.getFrom( suValuename, suValue );
- aBootstrap.getFrom( suValuename, suValue );
- sal_Char * pStr = getenv("SRC_ROOT");
- // printUString( suGetname );
- CPPUNIT_ASSERT_MESSAGE("get the value of environment variable.", suValue.compareToAscii( pStr ) == 0 );
- }
- The result on Windows:
- # # the SRC_ROOT is e:\Qadev\cvs\m19
- # # suValue is e:Qadevcvsm19
- reason:
- The problem is that the internally getenv()ed variable SRC_ROOT is macro expanded,
- thus every \ will introduce an escape.
- */
-
- // get the value of a variable in ini file
- void getFrom_002()
- {
- rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
- Bootstrap aBootstrap( suIniname );
- rtl::OUString suGetname;
- rtl::OUString suValuename (RTL_CONSTASCII_USTRINGPARAM("INHERITED_VALUE"));
- aBootstrap.getFrom( suValuename, suGetname );
- printUString( suGetname );
- CPPUNIT_ASSERT_MESSAGE("get the value of a variable in ini file.", suGetname.getLength() != 0 );
- }
-
- //use defaut value
- void getFrom_003()
- {
- rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
- Bootstrap aBootstrap( suIniname );
- rtl::OUString suGetname;
- rtl::OUString suValuename(RTL_CONSTASCII_USTRINGPARAM("MY_VALUE"));
- rtl::OUString myDefault(RTL_CONSTASCII_USTRINGPARAM("2"));
- aBootstrap.getFrom( suValuename, suGetname, myDefault );
- CPPUNIT_ASSERT_MESSAGE("getFrom use default.", suGetname.compareTo( myDefault ) == 0 );
- }
-
- void getFrom_004()
- {
- t_print("1\n");
- // initialise Bootstrap with an own ini file
- // PSEUDO_INI is pseudo(rc|.ini) created be create_pseudorc()
- rtl::OUString suIniname = t_getSourcePath(PSEUDO_INI);
- Bootstrap aBootstrap( suIniname );
-
- rtl::OUString suGetIniName;
- aBootstrap.getIniName( suGetIniName );
-
- printUString(suGetIniName, "Current bootstrap file");
- sal_Int32 nIndex = suGetIniName.indexOf(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("pseudo")));
- CPPUNIT_ASSERT_MESSAGE("ini name must have 'pseudo' in name.", nIndex > 0);
-
- rtl::OUString suValue;
- rtl::OUString suKeyName(RTL_CONSTASCII_USTRINGPARAM("FILE"));
- aBootstrap.getFrom( suKeyName, suValue );
- printUString( suValue );
- sal_Int32 nCompare = suValue.compareTo( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("pseudo file")) );
-
- CPPUNIT_ASSERT_MESSAGE("<Bootstrap('pseudo')>.getFrom('FILE', ...) result is unexpected.", nCompare == 0);
- }
- void getFrom_004_1()
- {
- // get the same key out of the default context
- rtl::OUString suKeyName(RTL_CONSTASCII_USTRINGPARAM("FILE"));
- rtl::OUString suGetValue;
- Bootstrap::get( suKeyName, suGetValue );
- printUString( suGetValue );
-
- CPPUNIT_ASSERT_MESSAGE("Bootstrap::get('FILE', ...)", suGetValue.compareTo( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("testshl2 file")) ) == 0 );
- }
-
- /** helper function: return the child process's ret value( typedef sal_uInt32 oslProcessExitCode;)
- * param1 is the process's name(only file name, not include path)
- */
- oslProcessExitCode ini_execProcess( const sal_Char* process_name, const sal_Char * flag )
- {
- rtl::OUString suCWD = getModulePath();
- oslProcess hProcess = NULL;
- rtl::OUString suFileURL = suCWD;
- suFileURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + rtl::OUString::createFromAscii(process_name) ;
-#if defined(WNT)
- suFileURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".exe"));
-#endif
- const int nParameterCount = 3;
- rtl_uString* pParameters[ nParameterCount ];
- OUString suFlag( OUString::createFromAscii(flag) );
- OUString suEnv1( RTL_CONSTASCII_USTRINGPARAM("-env:UNO_SERVICES=service.rdb") );
- OUString suIniname = t_getSourcePath("rtl");
- printUString( suIniname, "rtl path:");
-
- pParameters[0] = suFlag.pData;
- pParameters[1] = suEnv1.pData;
- // the custom ini/rc file's URL
- pParameters[2] = suIniname.pData;
-
- oslProcessError osl_error = osl_executeProcess(
- suFileURL.pData,
- pParameters,
- nParameterCount,
- osl_Process_WAIT,
- 0,
- suCWD.pData,
- NULL,
- 0,
- &hProcess );
-
- CPPUNIT_ASSERT_MESSAGE
- (
- "osl_createProcess failed",
- osl_error == osl_Process_E_None
- );
- osl_joinProcess(hProcess);
- oslProcessInfo* pInfo = new oslProcessInfo;
- pInfo->Size = sizeof( oslProcessInfo );
- osl_error = osl_getProcessInfo( hProcess, osl_Process_EXITCODE, pInfo );
- CPPUNIT_ASSERT_MESSAGE
- (
- "osl_getProcessInfo returned with failure",
- osl_Process_E_None == osl_error
- );
-
- t_print("the exit code is %d.\n", pInfo->Code );
- oslProcessExitCode nCode = pInfo->Code;
- delete pInfo;
- return nCode;
- }
-
- void getFrom_005_1()
- {
- oslProcessExitCode nExitCode = ini_execProcess( "bootstrap_process", "1" );
- CPPUNIT_ASSERT_MESSAGE("Parameters passed by command line can not be gotten!",
- nExitCode == 10 );
- }
- void getFrom_005_2()
- {
- oslProcessExitCode nExitCode = ini_execProcess( "bootstrap_process", "2" );
- CPPUNIT_ASSERT_MESSAGE("Parameters passed by .ini/rc file can not be gotten!",
- nExitCode == 20 );
- }
- void getFrom_005_3()
- {
-#if (defined WNT) || (defined SOLARIS)
- putenv(const_cast< char * >("QADEV_BOOTSTRAP=sun&ms"));
-#else
- setenv("QADEV_BOOTSTRAP", "sun&ms", 0);
-#endif
- oslProcessExitCode nExitCode = ini_execProcess( "bootstrap_process", "3" );
- CPPUNIT_ASSERT_MESSAGE("Parameters passed by environment variables can not be gotten!",
- nExitCode == 30 );
- }
- void getFrom_005_4()
- {
- oslProcessExitCode nExitCode = ini_execProcess( "bootstrap_process", "4" );
- CPPUNIT_ASSERT_MESSAGE("Parameters passed by customed .ini/rc file can not be gotten!",
- nExitCode == 40 );
- }
- void getFrom_005_5()
- {
- oslProcessExitCode nExitCode = ini_execProcess( "bootstrap_process", "5" );
- CPPUNIT_ASSERT_MESSAGE("Parameters passed by inheritance can not be gotten!",
- nExitCode == 50 );
- }
- void getFrom_005_6()
- {
- oslProcessExitCode nExitCode = ini_execProcess( "bootstrap_process", "6" );
- CPPUNIT_ASSERT_MESSAGE("Parameters passed by default can not be gotten!",
- nExitCode == 60 );
- }
-
- CPPUNIT_TEST_SUITE(getFrom);
- CPPUNIT_TEST(getFrom_001);
- CPPUNIT_TEST(getFrom_002);
- CPPUNIT_TEST(getFrom_003);
- CPPUNIT_TEST(getFrom_004);
- CPPUNIT_TEST(getFrom_004_1);
- CPPUNIT_TEST(getFrom_005_1);
- CPPUNIT_TEST(getFrom_005_2);
- CPPUNIT_TEST(getFrom_005_3);
- CPPUNIT_TEST(getFrom_005_4);
- CPPUNIT_TEST(getFrom_005_5);
- CPPUNIT_TEST(getFrom_005_6);
- CPPUNIT_TEST_SUITE_END();
- }; // class getFrom
-
- class setIniFilename : public CppUnit::TestFixture
- {
- public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void setIniFilename_001()
- {
- Bootstrap aBootstrap;
-
- rtl::OUString suGetIniname;
- aBootstrap.getIniName( suGetIniname );
- //which should be .....testshl2rc
-
- rtl::OUString suIniname = t_getSourcePath(PSEUDO_INI);
- Bootstrap::setIniFilename( suIniname );
-
- rtl::OUString suGetname;
- aBootstrap.getIniName( suGetname );
-
- printUString( suGetname );
- CPPUNIT_ASSERT_MESSAGE("setIniFilename then get it.", suGetname.compareTo( suIniname ) == 0
- && suGetname.compareTo( suGetIniname ) != 0 );
- }
-
- void setIniFilename_002()
- {
- rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
-
- Bootstrap::setIniFilename( suIniname );
- rtl::OUString suGetname;
- rtl::OUString suValuename(RTL_CONSTASCII_USTRINGPARAM("INHERITED_VALUE"));
- Bootstrap::get( suValuename, suGetname );
- printUString( suGetname );
- CPPUNIT_ASSERT_MESSAGE("setIniFilename and get value of the argument.", suGetname.getLength() != 0 );
- }
-
- CPPUNIT_TEST_SUITE(setIniFilename);
- CPPUNIT_TEST(setIniFilename_001);
- CPPUNIT_TEST(setIniFilename_002);
- CPPUNIT_TEST_SUITE_END();
- }; // class setIniFilename
-
- class getHandle : public CppUnit::TestFixture
- {
- public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void getHandle_001()
- {
- rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
- Bootstrap aBootstrap;
- rtlBootstrapHandle bsHandle = aBootstrap.getHandle();
- CPPUNIT_ASSERT_MESSAGE("getHandle should return 0 if the bootstrap has no ini file!", bsHandle == 0 );
- }
- void getHandle_002()
- {
- rtl::OUString suIniname = t_getSourcePath(PSEUDO_INI);
- Bootstrap aBootstrap( suIniname );
-
- rtlBootstrapHandle bsHandle = aBootstrap.getHandle();
- CPPUNIT_ASSERT_MESSAGE("getHandle return NULL!", bsHandle != 0);
-
- rtl::OUString suValue;
- rtl::OUString suKeyName(RTL_CONSTASCII_USTRINGPARAM("PSEUDOFILE"));
- rtl_bootstrap_get_from_handle(bsHandle, suKeyName.pData, &suValue.pData, NULL);
- printUString( suValue);
-
- CPPUNIT_ASSERT_MESSAGE("Can not use the handle which is returned by getHandle!", suValue.equals( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("be pseudo")) ) == sal_True );
- }
-
- CPPUNIT_TEST_SUITE(getHandle);
- CPPUNIT_TEST(getHandle_001);
- CPPUNIT_TEST(getHandle_002);
- CPPUNIT_TEST_SUITE_END();
- }; // class getHandle
-
- class set : public CppUnit::TestFixture
- {
- public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void set_001()
- {
- //in ini fle, INHERITED_VALUE=inherited_value
- rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
- Bootstrap aBootstrap( suIniname);
- rtl::OUString suName(RTL_CONSTASCII_USTRINGPARAM("INHERITED_VALUE"));
- rtl::OUString suValue(RTL_CONSTASCII_USTRINGPARAM("ok"));
- // set to another value
- Bootstrap::set( suName, suValue );
- rtl::OUString suGetValue;
- Bootstrap::get( suName, suGetValue);
- CPPUNIT_ASSERT_MESSAGE("set and get argument failed.", suGetValue.compareTo(suValue) == 0 );
- }
- void set_002()
- {
- rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
- Bootstrap myBootstrap( suIniname);
- rtl::OUString suName(RTL_CONSTASCII_USTRINGPARAM("INHERITED_VALUE"));
- rtl::OUString suGetOrientValue;
- Bootstrap::get( suName, suGetOrientValue);
- // ?? INHERITED_VALUE = ok now, which is set in set_001
- printUString( suGetOrientValue );
-
- rtl::OUString suValue(RTL_CONSTASCII_USTRINGPARAM( TESTSHL2_INI ));
- // set to another value
- Bootstrap::set( suName, suValue );
- rtl::OUString suGetValue;
- Bootstrap::get( suName, suGetValue);
- CPPUNIT_ASSERT_MESSAGE("set and get argument failed.", suGetValue.compareTo(suValue) == 0 );
- }
-
- CPPUNIT_TEST_SUITE(set);
- CPPUNIT_TEST(set_001);
- CPPUNIT_TEST(set_002);
- CPPUNIT_TEST_SUITE_END();
- }; // class set
-
- class expandMacrosFrom : public CppUnit::TestFixture
- {
- public:
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
- void expandMacrosFrom_001()
- {
- rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
- Bootstrap aBootstrap( suIniname);
- rtl::OUString suMacro(RTL_CONSTASCII_USTRINGPARAM("$MYVAR/expand1"));
- //expandMacro now
- aBootstrap.expandMacrosFrom( suMacro );
- rtl::OUString suExpectedMacro(RTL_CONSTASCII_USTRINGPARAM("src680_test/expand1"));
- CPPUNIT_ASSERT_MESSAGE("expandMacrosFrom failed.", suMacro.compareTo(suExpectedMacro) == 0 );
- }
-
- /** here a special macro should expand
- * if rtlrc is under sal/qa/rtl/bootstrap/, "${rtlrc:Bootstrap:RTLVALUE}" could be expanded
- * else rtlrc is under solver/680/unxlngi4.pro/bin/, "${file:/// ....solver/680/unxlngi4.pro/bin/rtlrc:Bootstrap:RTLVALUE}"
- * could not be expanded
- */
- void expandMacrosFrom_002()
- {
- // Build a string with '${rtl.ini:RTLVALUE}' and try to expand it.
- // In function 'create_rtlrc() is the content of the rtl.ini file.
-
- rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
- t_print("inifile is:");
- printUString( suIniname );
- Bootstrap aBootstrap( suIniname) ;
- rtl::OUString suMacro(RTL_CONSTASCII_USTRINGPARAM("${")); //rtlrc:Bootstrap:RTLVALUE}");
-
- rtl::OUString aDirURL(RTL_CONSTASCII_USTRINGPARAM("$ORIGIN"));
- aDirURL += OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
- aDirURL += OUString(RTL_CONSTASCII_USTRINGPARAM("rtl"));
-#if defined(WNT)
- aDirURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".ini"));
-#else
- aDirURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rc"));
-#endif
-
- suMacro += aDirURL;//t_getSourcePath("rtl");
- suMacro += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("::RTLVALUE}"));
-
- t_print("created macro is: ");
- printUString( suMacro );
- aBootstrap.expandMacrosFrom( suMacro );
- t_print("expanded macro is:");
- printUString( suMacro );
- rtl::OUString suExpectedMacro(RTL_CONSTASCII_USTRINGPARAM("qadev17"));
- CPPUNIT_ASSERT_MESSAGE("failed, can't expand '${file:///.../" SAL_CONFIGFILE("rtl") "::RTLVALUE}' to 'qadev17'", suMacro.compareTo(suExpectedMacro) == 0 );
- }
- void expandMacrosFrom_002_1()
- {
- rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
- t_print("inifile is:");
- printUString( suIniname );
- Bootstrap aBootstrap( suIniname);
-
- rtl::OUString suMacro;
- // just a simple test, if this really work.
- aBootstrap.getFrom(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SOFROMVALUE2")), suMacro );
- t_print("SOFROMVALUE2:");
- printUString( suMacro );
- CPPUNIT_ASSERT_MESSAGE("'SOFROMVALUE2' seems to do not exist.", suMacro.getLength() > 0 );
-
- aBootstrap.getFrom(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SOFROMVALUE")), suMacro );
-
- t_print("SOFROMVALUE:");
- printUString( suMacro );
-
- //expandMacro now
- // seems to be, that getFrom() already expand the string
- rtl::OUString suExpectedMacro(RTL_CONSTASCII_USTRINGPARAM("src680_qadev"));
- CPPUNIT_ASSERT_MESSAGE("failed, can't expand '${" SAL_CONFIGFILE("rtl") "::SOVALUE}' to 'src680_qadev'", suMacro.compareTo(suExpectedMacro) == 0 );
- }
- void expandMacrosFrom_002_2()
- {
- // test, to read and expand SOFROMVALUE3
- // SOFROMVALUE3 is 'rtl(.ini|rc)::TESTSHL_SOVALUE' which should expand to 'rtlfile' if all is ok.
-
- rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
- t_print("inifile is:");
- printUString( suIniname );
- Bootstrap aBootstrap( suIniname);
-
- rtl::OUString suMacro;
- aBootstrap.getFrom(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SOFROMVALUE3")), suMacro );
-
- t_print("SOFROMVALUE3:");
- printUString( suMacro );
-
- if (suMacro.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("testshl2_file")) ) == sal_True)
- {
- CPPUNIT_ASSERT_MESSAGE("Value 'SOFROMVALUE3' is read from the wrong ini file.", 0 );
- }
- else
- {
- CPPUNIT_ASSERT_MESSAGE("SOFROMVALUE3 should contain 'rtlfile'.", suMacro.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rtlfile")) ) == sal_True );
- }
- }
- void expandMacrosFrom_003()
- {
- rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
- Bootstrap aBootstrap( suIniname);
- rtl::OUString suMacro[4];
- suMacro[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$SYSUSERCONFIG"));
- suMacro[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$SYSUSERHOME"));
- suMacro[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$SYSBINDIR"));
- suMacro[3] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$ORIGIN"));
-
- for ( int i = 0; i < 4; i++ )
- {
- aBootstrap.expandMacrosFrom( suMacro[i] );
- printUString(suMacro[i]);
- }
- CPPUNIT_ASSERT_MESSAGE("some integral variables.", suMacro[0].getLength() > 0 &&
- suMacro[1].getLength() > 0 &&
- suMacro[2].getLength() > 0 &&
- suMacro[3].getLength() > 0);
- }
-
- void testRecursion() {
- rtl::OUString t(RTL_CONSTASCII_USTRINGPARAM("$RECURSIVE"));
- Bootstrap(t_getSourcePath(TESTSHL2_INI)).expandMacrosFrom(t);
- CPPUNIT_ASSERT_MESSAGE(
- "recursion detection",
- t.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM("***RECURSION DETECTED***")));
- }
-
- void testLink() {
- rtl::OUString t(RTL_CONSTASCII_USTRINGPARAM("$LINKED"));
- Bootstrap(t_getSourcePath(TESTSHL2_INI)).expandMacrosFrom(t);
- CPPUNIT_ASSERT_MESSAGE(
- "link file",
- t.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("qadev17")));
- }
-
- void testOverride() {
- rtl::OUString t1(
- RTL_CONSTASCII_USTRINGPARAM(
- "${.override:$ORIGIN/" SAL_CONFIGFILE("rtl") ":ORIGIN}"));
- Bootstrap(t_getSourcePath("rtl")).expandMacrosFrom(t1);
- CPPUNIT_ASSERT_MESSAGE(
- "override ORIGIN",
- t1.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("direct")));
- rtl::OUString t2(
- RTL_CONSTASCII_USTRINGPARAM(
- "${.override:$ORIGIN/" SAL_CONFIGFILE("none") ":MYVAR}"));
- Bootstrap::expandMacros(t2);
- CPPUNIT_ASSERT_MESSAGE(
- "override MYVAR",
- t2.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("src680_test")));
- }
-
- void testNonexisting() {
- rtl::OUString t(
- RTL_CONSTASCII_USTRINGPARAM(
- "${$ORIGIN/" SAL_CONFIGFILE("none") ":MYVAR}"));
- Bootstrap::expandMacros(t);
- CPPUNIT_ASSERT_MESSAGE(
- "nonexisting",
- t.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("src680_test")));
- }
-
- void testSection() {
- rtl::OUStringBuffer b;
- b.appendAscii(RTL_CONSTASCII_STRINGPARAM("${"));
- rtl::OUString p(t_getSourcePath(TESTSHL2_INI));
- for (sal_Int32 i = 0; i < p.getLength(); ++i) {
- if (p[i] != 'u') {
- b.append(static_cast< sal_Unicode >('\\'));
- }
- b.append(p[i]);
- }
- b.appendAscii(RTL_CONSTASCII_STRINGPARAM(":Other_Section:EXPAND}"));
- rtl::OUString t(b.makeStringAndClear());
- Bootstrap(t_getSourcePath(TESTSHL2_INI)).expandMacrosFrom(t);
- CPPUNIT_ASSERT_MESSAGE(
- "section expansion",
- t.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM("$FILE")));
- // the correct answer would be "testshl2 file" instead, but
- // expansion including a section currently erroneously does not
- // recursively expand macros in the resulting replacement text
- }
-
- CPPUNIT_TEST_SUITE(expandMacrosFrom);
- CPPUNIT_TEST(expandMacrosFrom_001);
- CPPUNIT_TEST(expandMacrosFrom_002);
- CPPUNIT_TEST(expandMacrosFrom_002_1);
- CPPUNIT_TEST(expandMacrosFrom_002_2);
- CPPUNIT_TEST(expandMacrosFrom_003);
- CPPUNIT_TEST(testRecursion);
- CPPUNIT_TEST(testLink);
- CPPUNIT_TEST(testOverride);
- CPPUNIT_TEST(testNonexisting);
- CPPUNIT_TEST(testSection);
- CPPUNIT_TEST_SUITE_END();
- }; // class expandMacrosFrom
-
- class expandMacros : public CppUnit::TestFixture
- {
- public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void expandMacros_001()
- {
- rtl::OUString suIniname = t_getSourcePath(TESTSHL2_INI);
- Bootstrap aBootstrap( suIniname) ;
- rtl::OUString suMacro(RTL_CONSTASCII_USTRINGPARAM("$INHERITED_VALUE/well"));
- Bootstrap::expandMacros( suMacro );
-
- rtl::OUString suName(RTL_CONSTASCII_USTRINGPARAM("INHERITED_VALUE"));
- OUString suGetValue;
- Bootstrap::get( suName, suGetValue );
- suGetValue += OUString(RTL_CONSTASCII_USTRINGPARAM("/well"));
- CPPUNIT_ASSERT_MESSAGE("expandMacros failed.", suGetValue.compareTo(suMacro) == 0 );
- }
-
- CPPUNIT_TEST_SUITE(expandMacros);
- CPPUNIT_TEST(expandMacros_001);
- // CPPUNIT_TEST(expandMacros_002);
- CPPUNIT_TEST_SUITE_END();
- }; // class expandMacros
-
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Bootstrap::ctor, "rtl_Bootstrap");
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Bootstrap::getFrom, "rtl_Bootstrap");
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Bootstrap::setIniFilename, "rtl_Bootstrap");
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Bootstrap::getHandle, "rtl_Bootstrap");
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Bootstrap::set, "rtl_Bootstrap");
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Bootstrap::expandMacrosFrom, "rtl_Bootstrap");
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Bootstrap::expandMacros, "rtl_Bootstrap");
-
-} // namespace rtl_Bootstrap
-
-// -----------------------------------------------------------------------------
-
-static void removeAndCreateFile(rtl::OUString const& _suFileURL, rtl::OString const& _sContent)
-{
- osl::File::remove(_suFileURL);
-
- ::std::auto_ptr<osl::File> pFile( new osl::File( _suFileURL ) );
- ::osl::FileBase::RC nError = pFile->open( osl_File_OpenFlag_Write | osl_File_OpenFlag_Create );
- if ( ::osl::FileBase::E_None == nError || ::osl::FileBase::E_EXIST == nError )
- {
- t_print(T_VERBOSE, "%s\n" , OString(_suFileURL, _suFileURL.getLength(), RTL_TEXTENCODING_ASCII_US).getStr());
- sal_uInt64 nWritenBytes;
- pFile->write(_sContent.getStr(), _sContent.getLength(), nWritenBytes);
-
- rtl::OString sError = "can't write enough bytes to file";
- sError += OString(_suFileURL, _suFileURL.getLength(), RTL_TEXTENCODING_ASCII_US);
- OSL_ENSURE(nWritenBytes == _sContent.getLength(), sError.getStr());
-
- pFile->close();
- }
- else
- {
- rtl::OString sError = "can't create file URL: '";
- rtl::OString sFile;
- sFile <<= _suFileURL;
- sError += sFile;
- sError += "' maybe no write access. If it is true with no write access, please create a local environment and start these tests again. rtl::Bootstrap test must quit.";
- t_print("%s\n", sError.getStr() );
- exit(1);
- }
- OSL_ASSERT(t_fileExist(_suFileURL) == true);
-}
-
-// -----------------------------------------------------------------------------
-static void create_rtlrc()
-{
- rtl::OUString aFileURL(getExecutableDirectory());
-#if defined(WNT)
- aFileURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/rtl.ini"));
-#else
- aFileURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/rtlrc"));
-#endif
-
- rtl::OString sLines;
- sLines += "[Bootstrap]\n";
- sLines += "SOVALUE=src680_qadev\n";
- sLines += "RTLVALUE=qadev17\n";
- sLines += "TESTSHL_SOVALUE=rtlfile\n";
- sLines += "RECURSIVE=${$ORIGIN/" SAL_CONFIGFILE("testshl2") ":RECURSIVE}\n";
- sLines += "ORIGIN=direct\n";
- sLines += "[Other_Section]\n";
- sLines += "TESTSHL_SOVALUE=rtlfile_other\n";
-
- removeAndCreateFile(aFileURL, sLines);
-}
-
-// -----------------------------------------------------------------------------
-static void create_testshl2rc()
-{
- rtl::OUString aFileURL(getExecutableDirectory());
-#if defined(WNT)
- aFileURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/testshl2.ini"));
-#else
- aFileURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/testshl2rc"));
-#endif
- rtl::OString sLines;
- sLines += "[Bootstrap]\n";
- sLines += "FILE=testshl2 file\n";
- sLines += "MYBOOTSTRAPTESTVALUE=file\n";
- sLines += "INHERITED_VALUE=inherited_value\n";
- sLines += "INHERITED_OVERWRITTEN_VALUE=not_overwritten\n";
- sLines += "MYVAR=src680_test\n";
- sLines += "SOFROMVALUE=${$ORIGIN/" SAL_CONFIGFILE("rtl") "::SOVALUE}\n";
- sLines += "SOFROMVALUE2=test\n";
- sLines += "SOFROMVALUE3=${$ORIGIN/" SAL_CONFIGFILE("rtl") "::TESTSHL_SOVALUE}\n";
- sLines += "TESTSHL_SOVALUE=testshl2_file\n";
- sLines += "ILLEGAL VALUE=test\n";
- sLines += "ILLEGAL.DOT=test\n";
- sLines += "ILLEGAL;SEMICOLON=test\n";
- sLines += "ILLEGAL:COLON=test\n";
- sLines += " KEY_FOR_TRIM_TEST = value for trim test \n";
- sLines += "RECURSIVE=${$ORIGIN/" SAL_CONFIGFILE("rtl") ":RECURSIVE}\n";
- sLines += "LINKED=${${.link:$ORIGIN/testshl2-link}:RTLVALUE}\n";
- sLines += "[Other_Section]\n";
- sLines += "FILE=testshl2 file other\n";
- sLines += "EXPAND=$FILE\n";
-
- removeAndCreateFile(aFileURL, sLines);
-
- removeAndCreateFile(
- (getExecutableDirectory() +
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/testshl2-link"))),
- SAL_CONFIGFILE("rtl"));
-}
-
-// -----------------------------------------------------------------------------
-
-static void create_pseudorc()
-{
- rtl::OUString aFileURL(getExecutableDirectory());
-#if defined(WNT)
- aFileURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/pseudo.ini"));
-#else
- aFileURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/pseudorc"));
-#endif
- rtl::OString sLines;
- sLines += "[Bootstrap]\n";
- sLines += "FILE=pseudo file\n";
- sLines += "PSEUDOFILE=be pseudo\n";
-
- removeAndCreateFile(aFileURL, sLines);
-}
-
-// -----------------------------------------------------------------------------
-void create_bootstrap_processrc()
-{
- rtl::OUString aDirURL(getModulePath());
-#if defined(WNT)
- aDirURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/bootstrap_process.ini"));
-#else
- aDirURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/bootstrap_processrc"));
-#endif
- rtl::OString sLines;
- sLines += "[Bootstrap]\n";
- sLines += "EXECUTABLE_RC=true\n";
- sLines += "IF_CUSTOM_RC=false\n";
-
- removeAndCreateFile(aDirURL, sLines);
-}
-// -----------------------------------------------------------------------------
-
-void RegisterAdditionalFunctions(FktRegFuncPtr _pFunc)
-{
- (void) _pFunc;
- // start message
- t_print(T_VERBOSE, "Initializing ...\n" );
- create_rtlrc();
- create_testshl2rc();
- create_pseudorc();
- create_bootstrap_processrc();
-
- t_print(T_VERBOSE, "Initialization Done.\n" );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/bootstrap/rtl_Bootstrap.xsce b/sal/qa/rtl/bootstrap/rtl_Bootstrap.xsce
deleted file mode 100644
index df7366961..000000000
--- a/sal/qa/rtl/bootstrap/rtl_Bootstrap.xsce
+++ /dev/null
@@ -1,7 +0,0 @@
-#i27888#
-rtl_Bootstrap.getFrom.getFrom_004
-
-#i27893#
-#rtl_Bootstrap.expandMacrosFrom.expandMacrosFrom_002
-#rtl_Bootstrap.expandMacrosFrom.expandMacrosFrom_002_1
-rtl_Bootstrap.expandMacrosFrom.expandMacrosFrom_002_2
diff --git a/sal/qa/rtl/cipher/makefile.mk b/sal/qa/rtl/cipher/makefile.mk
deleted file mode 100644
index fd95355ac..000000000
--- a/sal/qa/rtl/cipher/makefile.mk
+++ /dev/null
@@ -1,68 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-INCPRE+= $(PRJ)$/qa$/inc
-
-PRJNAME=sal
-TARGET=qa_rtl_cipher
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-.IF "$(OS)" == "IOS"
-CFLAGSCXX += -DCPPUNIT_PLUGIN_EXPORTED_NAME=cppunitTest_$(TARGET)
-.ENDIF
-
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
-
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-
-SHL1OBJS= \
- $(SLO)$/rtl_cipher.obj
-
-SHL1TARGET= rtl_cipher
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-# SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME =$(SHL1TARGET)
-# DEF2EXPORTFILE= export.exp
-SHL1VERSIONMAP= $(PRJ)$/qa$/export.map
-
-#------------------------------- All object files -------------------------------
-SLOFILES=$(SHL1OBJS)
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/cipher/rtl_cipher.cxx b/sal/qa/rtl/cipher/rtl_cipher.cxx
deleted file mode 100644
index 647d0f547..000000000
--- a/sal/qa/rtl/cipher/rtl_cipher.cxx
+++ /dev/null
@@ -1,664 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-#include <cstring>
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
-
-#include <rtl/strbuf.hxx>
-#include <rtl/cipher.h>
-
-// -----------------------------------------------------------------------------
-namespace rtl_cipher
-{
-
-rtl::OString createHex(sal_uInt8 *_pKeyBuffer, sal_uInt32 _nKeyLen)
-{
- // Create hex-value string from the value to keep the string size minimal
- rtl::OStringBuffer aBuffer( _nKeyLen * 2 + 1 );
- for ( sal_uInt32 i = 0; i < _nKeyLen; i++ )
- {
- sal_Int32 nValue = (sal_Int32)_pKeyBuffer[i];
- if (nValue < 16) // maximul hex value for 1 byte
- {
- sal_Int32 nil = sal_Int32(0);
- aBuffer.append( nil, 16 /* radix */ );
- }
- aBuffer.append( nValue, 16 /* radix */ );
- }
-
- return aBuffer.makeStringAndClear();
-}
-
-// -----------------------------------------------------------------------------
-
-class create : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void create_001()
- {
- rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeECB);
- CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
- rtl_cipher_destroy(aCipher);
- }
- void create_002()
- {
- rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmInvalid, rtl_Cipher_ModeECB);
- CPPUNIT_ASSERT_MESSAGE("create provide wrong object.", aCipher == NULL);
- }
- void create_003()
- {
- rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeCBC);
- CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
- rtl_cipher_destroy(aCipher);
- }
- void create_004()
- {
- rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmInvalid, rtl_Cipher_ModeCBC);
- CPPUNIT_ASSERT_MESSAGE("create provide wrong object.", aCipher == NULL);
- }
- void create_005()
- {
- rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream);
- CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
- rtl_cipher_destroy(aCipher);
- }
- void create_006()
- {
- rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmInvalid, rtl_Cipher_ModeStream);
- CPPUNIT_ASSERT_MESSAGE("create provide wrong object.", aCipher == NULL);
- }
- void create_007()
- {
- rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeInvalid);
- CPPUNIT_ASSERT_MESSAGE("create provide wrong object.", aCipher == NULL);
- }
- void create_008()
- {
- rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmInvalid, rtl_Cipher_ModeInvalid);
- CPPUNIT_ASSERT_MESSAGE("create provide wrong object.", aCipher == NULL);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(create);
- CPPUNIT_TEST(create_001);
- CPPUNIT_TEST(create_002);
- CPPUNIT_TEST(create_003);
- CPPUNIT_TEST(create_004);
- CPPUNIT_TEST(create_005);
- CPPUNIT_TEST(create_006);
- CPPUNIT_TEST(create_007);
- CPPUNIT_TEST(create_008);
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-
-// -----------------------------------------------------------------------------
-class createBF : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void createBF_001()
- {
- rtlCipher aCipher = rtl_cipher_createBF(rtl_Cipher_ModeECB);
- CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
- rtl_cipher_destroy(aCipher);
- }
- void createBF_002()
- {
- rtlCipher aCipher = rtl_cipher_createBF(rtl_Cipher_ModeCBC);
- CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
- rtl_cipher_destroy(aCipher);
- }
- void createBF_003()
- {
- rtlCipher aCipher = rtl_cipher_createBF(rtl_Cipher_ModeStream);
- CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
- rtl_cipher_destroy(aCipher);
- }
- void createBF_004()
- {
- rtlCipher aCipher = rtl_cipher_createBF(rtl_Cipher_ModeInvalid);
- CPPUNIT_ASSERT_MESSAGE("create provide wrong object.", aCipher == NULL);
- // rtl_cipher_destroy(aCipher);
- }
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(createBF);
- CPPUNIT_TEST(createBF_001);
- CPPUNIT_TEST(createBF_002);
- CPPUNIT_TEST(createBF_003);
- CPPUNIT_TEST(createBF_004);
- CPPUNIT_TEST_SUITE_END();
-}; // class createBF
-// -----------------------------------------------------------------------------
-class decode : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void test_encode(sal_uInt8 _nKeyValue, sal_uInt8 _nArgValue, rtl::OString const& _sPlainTextStr)
- {
- rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeECB);
- CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
-
- sal_uInt32 nKeyLen = 16;
- sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
- memset(pKeyBuffer, 0, nKeyLen);
- pKeyBuffer[0] = _nKeyValue;
-
- sal_uInt32 nArgLen = 16;
- sal_uInt8 *pArgBuffer = new sal_uInt8[ nArgLen ];
- memset(pArgBuffer, 0, nArgLen);
- pArgBuffer[0] = _nArgValue;
-
- rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
- CPPUNIT_ASSERT_MESSAGE("wrong init", aError == rtl_Cipher_E_None);
-
- sal_uInt32 nPlainTextLen = 16;
- sal_uInt8 *pPlainTextBuffer = new sal_uInt8[ nPlainTextLen ];
- memset(pPlainTextBuffer, 0, nPlainTextLen);
- strncpy((char*)pPlainTextBuffer, _sPlainTextStr.getStr(), 16);
-
- sal_uInt32 nCipherLen = 16;
- sal_uInt8 *pCipherBuffer = new sal_uInt8[ nCipherLen ];
- memset(pCipherBuffer, 0, nCipherLen);
-
- /* rtlCipherError */ aError = rtl_cipher_encode(aCipher, pPlainTextBuffer, nPlainTextLen, pCipherBuffer, nCipherLen);
- CPPUNIT_ASSERT_MESSAGE("wrong encode", aError == rtl_Cipher_E_None);
-
- sal_uInt32 nPlainText2Len = 16;
- sal_uInt8 *pPlainText2Buffer = new sal_uInt8[ nPlainText2Len ];
- memset(pPlainText2Buffer, 0, nPlainText2Len);
-
- /* rtlCipherError */ aError = rtl_cipher_decode(aCipher, pCipherBuffer, nCipherLen, pPlainText2Buffer, nPlainText2Len);
- CPPUNIT_ASSERT_MESSAGE("decode should not work", aError != rtl_Cipher_E_None);
-
- delete [] pPlainText2Buffer;
-
- delete [] pCipherBuffer;
- delete [] pPlainTextBuffer;
-
- delete [] pArgBuffer;
- delete [] pKeyBuffer;
-
- rtl_cipher_destroy(aCipher);
- }
-
- void test_encode_and_decode(sal_uInt8 _nKeyValue, sal_uInt8 _nArgValue, rtl::OString const& _sPlainTextStr)
- {
- rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeECB);
- CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
-
- sal_uInt32 nKeyLen = 16;
- sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
- memset(pKeyBuffer, 0, nKeyLen);
- pKeyBuffer[0] = _nKeyValue;
-
- sal_uInt32 nArgLen = 16;
- sal_uInt8 *pArgBuffer = new sal_uInt8[ nArgLen ];
- memset(pArgBuffer, 0, nArgLen);
- pArgBuffer[0] = _nArgValue;
-
- rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionBoth, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
- CPPUNIT_ASSERT_MESSAGE("wrong init", aError == rtl_Cipher_E_None);
-
- sal_uInt32 nPlainTextLen = 16;
- sal_uInt8 *pPlainTextBuffer = new sal_uInt8[ nPlainTextLen ];
- memset(pPlainTextBuffer, 0, nPlainTextLen);
- strncpy((char*)pPlainTextBuffer, _sPlainTextStr.getStr(), 16);
-
- sal_uInt32 nCipherLen = 16;
- sal_uInt8 *pCipherBuffer = new sal_uInt8[ nCipherLen ];
- memset(pCipherBuffer, 0, nCipherLen);
-
- /* rtlCipherError */ aError = rtl_cipher_encode(aCipher, pPlainTextBuffer, nPlainTextLen, pCipherBuffer, nCipherLen);
- CPPUNIT_ASSERT_MESSAGE("wrong encode", aError == rtl_Cipher_E_None);
-
- sal_uInt32 nPlainText2Len = 16;
- sal_uInt8 *pPlainText2Buffer = new sal_uInt8[ nPlainText2Len ];
- memset(pPlainText2Buffer, 0, nPlainText2Len);
-
- /* rtlCipherError */ aError = rtl_cipher_decode(aCipher, pCipherBuffer, nCipherLen, pPlainText2Buffer, nPlainText2Len);
- CPPUNIT_ASSERT_MESSAGE("wrong decode", aError == rtl_Cipher_E_None);
-
- rtl::OString sPlainText2Str((char*)pPlainText2Buffer, nPlainText2Len);
-
- sal_Int32 nCompare = memcmp(pPlainTextBuffer, pPlainText2Buffer, 16);
-
- CPPUNIT_ASSERT_MESSAGE("compare between plain and decoded plain failed", nCompare == 0);
-
- delete [] pPlainText2Buffer;
-
- delete [] pCipherBuffer;
- delete [] pPlainTextBuffer;
-
- delete [] pArgBuffer;
- delete [] pKeyBuffer;
-
- rtl_cipher_destroy(aCipher);
- }
-
- void decode_001()
- {
- test_encode_and_decode(0,0,"");
- test_encode_and_decode(0,0,"hallo");
- test_encode_and_decode(1,0,"B2Aahg5B");
- test_encode_and_decode(1,2,"Longer text string");
- }
-
- void decode_002()
- {
- test_encode(0,0,"");
- test_encode(0,0,"hallo");
- test_encode(1,0,"B2Aahg5B");
- test_encode(1,2,"Longer text string");
- }
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(decode);
- CPPUNIT_TEST(decode_001);
- CPPUNIT_TEST(decode_002);
- CPPUNIT_TEST_SUITE_END();
-}; // class decode
-// -----------------------------------------------------------------------------
-class decodeBF : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void decodeBF_001()
- {
- }
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(decodeBF);
- CPPUNIT_TEST(decodeBF_001);
- CPPUNIT_TEST_SUITE_END();
-}; // class decodeBF
-// -----------------------------------------------------------------------------
-class destroy : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void destroy_001()
- {
- rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeCBC);
- CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
- rtl_cipher_destroy(aCipher);
- }
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(destroy);
- CPPUNIT_TEST(destroy_001);
- CPPUNIT_TEST_SUITE_END();
-}; // class destroy
-// -----------------------------------------------------------------------------
-class destroyBF : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void destroyBF_001()
- {
- rtlCipher aCipher = rtl_cipher_createBF(rtl_Cipher_ModeECB);
- CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
- rtl_cipher_destroyBF(aCipher);
- // more proforma
- // should not GPF
- }
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(destroyBF);
- CPPUNIT_TEST(destroyBF_001);
- CPPUNIT_TEST_SUITE_END();
-}; // class destroyBF
-// -----------------------------------------------------------------------------
-class encode : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void test_encode(sal_uInt8 _nKeyValue, sal_uInt8 _nArgValue, sal_uInt8 _nDataValue)
- {
- rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeECB);
- CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
-
- sal_uInt32 nKeyLen = 16;
- sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
- memset(pKeyBuffer, 0, nKeyLen);
- pKeyBuffer[0] = _nKeyValue;
-
- sal_uInt32 nArgLen = 16;
- sal_uInt8 *pArgBuffer = new sal_uInt8[ nArgLen ];
- memset(pArgBuffer, 0, nArgLen);
- pArgBuffer[0] = _nArgValue;
-
- rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
- CPPUNIT_ASSERT_MESSAGE("wrong init", aError == rtl_Cipher_E_None);
-
- sal_uInt32 nDataLen = 16;
- sal_uInt8 *pDataBuffer = new sal_uInt8[ nDataLen ];
- memset(pDataBuffer, 0, nDataLen);
- pDataBuffer[0] = _nDataValue;
-
- sal_uInt32 nLen = 16;
- sal_uInt8 *pBuffer = new sal_uInt8[ nLen ];
- memset(pBuffer, 0, nLen);
-
- /* rtlCipherError */ aError = rtl_cipher_encode(aCipher, pDataBuffer, nDataLen, pBuffer, nLen);
- CPPUNIT_ASSERT_MESSAGE("wrong encode", aError == rtl_Cipher_E_None);
-
- delete [] pBuffer;
- delete [] pDataBuffer;
-
- delete [] pArgBuffer;
- delete [] pKeyBuffer;
-
- rtl_cipher_destroy(aCipher);
- }
-
- void encode_001()
- {
- test_encode(0,0,0);
- test_encode(1,0,0);
- test_encode(0,1,0);
- test_encode(1,1,0);
-
- test_encode(0,0,1);
- test_encode(1,0,1);
- test_encode(0,1,1);
- test_encode(1,1,1);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(encode);
- CPPUNIT_TEST(encode_001);
- CPPUNIT_TEST_SUITE_END();
-}; // class encode
-// -----------------------------------------------------------------------------
-class encodeBF : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void encodeBF_001()
- {
- }
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(encodeBF);
- CPPUNIT_TEST(encodeBF_001);
- CPPUNIT_TEST_SUITE_END();
-}; // class encodeBF
-// -----------------------------------------------------------------------------
-class init : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void init_001()
- {
- rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeECB);
- CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
-
- sal_uInt32 nKeyLen = 16;
- sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
- memset(pKeyBuffer, 0, nKeyLen);
-
- sal_uInt32 nArgLen = 16;
- sal_uInt8 *pArgBuffer = new sal_uInt8[ nArgLen ];
- memset(pArgBuffer, 0, nArgLen);
-
- rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
- CPPUNIT_ASSERT_MESSAGE("wrong init", aError == rtl_Cipher_E_None);
-
- delete [] pArgBuffer;
- delete [] pKeyBuffer;
-
- rtl_cipher_destroy(aCipher);
- }
-
- void init_002()
- {
- rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeECB);
- CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
-
- sal_uInt32 nKeyLen = 16;
- sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
- memset(pKeyBuffer, 0, nKeyLen);
- pKeyBuffer[0] = 1;
-
- sal_uInt32 nArgLen = 16;
- sal_uInt8 *pArgBuffer = new sal_uInt8[ nArgLen ];
- memset(pArgBuffer, 0, nArgLen);
-
- rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
- CPPUNIT_ASSERT_MESSAGE("wrong init", aError == rtl_Cipher_E_None);
-
- delete [] pArgBuffer;
- delete [] pKeyBuffer;
-
- rtl_cipher_destroy(aCipher);
- }
- void init_003()
- {
- rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeECB);
- CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
-
- sal_uInt32 nKeyLen = 16;
- sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
- memset(pKeyBuffer, 0, nKeyLen);
-
- sal_uInt32 nArgLen = 16;
- sal_uInt8 *pArgBuffer = new sal_uInt8[ nArgLen ];
- memset(pArgBuffer, 0, nArgLen);
- pArgBuffer[0] = 1;
-
- rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
- CPPUNIT_ASSERT_MESSAGE("wrong init", aError == rtl_Cipher_E_None);
-
- delete [] pArgBuffer;
- delete [] pKeyBuffer;
-
- rtl_cipher_destroy(aCipher);
- }
- void init_004()
- {
- rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeECB);
- CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
-
- sal_uInt32 nKeyLen = 16;
- sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
- memset(pKeyBuffer, 0, nKeyLen);
- pKeyBuffer[0] = 1;
-
- sal_uInt32 nArgLen = 16;
- sal_uInt8 *pArgBuffer = new sal_uInt8[ nArgLen ];
- memset(pArgBuffer, 0, nArgLen);
- pArgBuffer[0] = 1;
-
- rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
- CPPUNIT_ASSERT_MESSAGE("wrong init", aError == rtl_Cipher_E_None);
-
- delete [] pArgBuffer;
- delete [] pKeyBuffer;
-
- rtl_cipher_destroy(aCipher);
- }
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(init);
- CPPUNIT_TEST(init_001);
- CPPUNIT_TEST(init_002);
- CPPUNIT_TEST(init_003);
- CPPUNIT_TEST(init_004);
- CPPUNIT_TEST_SUITE_END();
-}; // class init
-// -----------------------------------------------------------------------------
-class initBF : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void initBF_001()
- {
- // seems to be the same as init, so empty
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(initBF);
- CPPUNIT_TEST(initBF_001);
- CPPUNIT_TEST_SUITE_END();
-}; // class initBF
-
-// -----------------------------------------------------------------------------
-
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::create);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::createBF);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::decode);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::decodeBF);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::destroy);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::destroyBF);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::encode);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::encodeBF);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::init);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::initBF);
-
-} // namespace rtl_cipher
-
-
-// -----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-CPPUNIT_PLUGIN_IMPLEMENT();
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/crc32/makefile.mk b/sal/qa/rtl/crc32/makefile.mk
deleted file mode 100755
index 3820a8cf7..000000000
--- a/sal/qa/rtl/crc32/makefile.mk
+++ /dev/null
@@ -1,66 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-PRJ=..$/..$/..
-
-PRJNAME=sal
-TARGET=qa_rtl_crc32
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-.IF "$(OS)" == "IOS"
-CFLAGSCXX += -DCPPUNIT_PLUGIN_EXPORTED_NAME=cppunitTest_$(TARGET)
-.ENDIF
-
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
-
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-
-SHL1OBJS= \
- $(SLO)$/rtl_crc32.obj
-
-SHL1TARGET= rtl_crc32
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-# SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME =$(SHL1TARGET)
-# DEF1EXPORTFILE= export.exp
-SHL1VERSIONMAP= $(PRJ)$/qa$/export.map
-
-#------------------------------- All object files -------------------------------
-SLOFILES=$(SHL1OBJS)
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/crc32/rtl_crc32.cxx b/sal/qa/rtl/crc32/rtl_crc32.cxx
deleted file mode 100644
index 56af66099..000000000
--- a/sal/qa/rtl/crc32/rtl_crc32.cxx
+++ /dev/null
@@ -1,186 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-// autogenerated file with codegen.pl
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
-
-#include <rtl/crc.h>
-
-namespace rtl_CRC32
-{
-
-class test : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
-
- // insert your test code here.
- void rtl_crc32_001()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- sal_uInt32 nCRC = 0;
-
- char buf[] = {0};
- int num = 0;
-
- nCRC = rtl_crc32(nCRC, buf, num);
-
- CPPUNIT_ASSERT_MESSAGE("empty crc buffer", nCRC == 0);
- }
-
- void rtl_crc32_002()
- {
- sal_uInt32 nCRC = 0;
-
- char buf[] = {0,0};
- int num = sizeof(buf);
-
- nCRC = rtl_crc32(nCRC, buf, num);
-
- CPPUNIT_ASSERT_MESSAGE("buffer contain 2 empty bytes, crc is zero", nCRC != 0);
- }
-
- void rtl_crc32_002_1()
- {
- sal_uInt32 nCRC = 0;
-
- char buf[] = {0,0,0};
- int num = sizeof(buf);
-
- nCRC = rtl_crc32(nCRC, buf, num);
-
- CPPUNIT_ASSERT_MESSAGE("buffer contain 3 empty bytes, crc is zero", nCRC != 0);
- }
-
- /**
- * crc32 check:
- * Build checksum on two buffers with same size but different content,
- * the result (crc32 checksum) must differ
- */
-
- void rtl_crc32_003()
- {
- sal_uInt32 nCRC1 = 0;
- char buf1[] = {2};
- int num1 = sizeof(buf1);
-
- nCRC1 = rtl_crc32(nCRC1, buf1, num1);
-
- sal_uInt32 nCRC2 = 0;
- char buf2[] = {3};
- int num2 = sizeof(buf2);
-
- nCRC2 = rtl_crc32(nCRC2, buf2, num2);
-
- CPPUNIT_ASSERT_MESSAGE("checksum should differ for buf1 and buf2", nCRC1 != nCRC2);
- }
-
- /** check if the crc32 only use as much values, as given
- *
- */
- void rtl_crc32_003_1()
- {
- sal_uInt32 nCRC1 = 0;
- char buf1[] = {2,1};
- int num1 = sizeof(buf1) - 1;
-
- nCRC1 = rtl_crc32(nCRC1, buf1, num1);
-
- sal_uInt32 nCRC2 = 0;
- char buf2[] = {2,2};
- int num2 = sizeof(buf2) - 1;
-
- nCRC2 = rtl_crc32(nCRC2, buf2, num2);
-
- CPPUNIT_ASSERT_MESSAGE("checksum leave it's bounds", nCRC1 == nCRC2);
- }
-
- /** check if the crc32 differ at same content in reverse order
- *
- */
- void rtl_crc32_003_2()
- {
- sal_uInt32 nCRC1 = 0;
- char buf1[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
- int num1 = sizeof(buf1);
-
- nCRC1 = rtl_crc32(nCRC1, buf1, num1);
-
- sal_uInt32 nCRC2 = 0;
- char buf2[] = {20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
- int num2 = sizeof(buf2);
-
- nCRC2 = rtl_crc32(nCRC2, buf2, num2);
-
- CPPUNIT_ASSERT_MESSAGE("checksum should differ", nCRC1 != nCRC2);
- }
-
-
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(test);
- CPPUNIT_TEST(rtl_crc32_001);
- CPPUNIT_TEST(rtl_crc32_002);
- CPPUNIT_TEST(rtl_crc32_002_1);
- CPPUNIT_TEST(rtl_crc32_003);
- CPPUNIT_TEST(rtl_crc32_003_1);
- CPPUNIT_TEST(rtl_crc32_003_2);
- CPPUNIT_TEST_SUITE_END();
-}; // class test
-
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_CRC32::test);
-} // namespace rtl_CRC32
-
-
-// -----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-CPPUNIT_PLUGIN_IMPLEMENT();
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/digest/makefile.mk b/sal/qa/rtl/digest/makefile.mk
deleted file mode 100644
index d6c557f7d..000000000
--- a/sal/qa/rtl/digest/makefile.mk
+++ /dev/null
@@ -1,61 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-PRJ=..$/..$/..
-INCPRE+= $(PRJ)$/qa$/inc
-
-PRJNAME=sal
-TARGET=rtl_digest
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-DLLPRE = # no leading "lib" on .so files
-
-#----------------------------------- OStringBuffer -----------------------------------
-
-SHL1OBJS= \
- $(SLO)$/rtl_digest.obj
-
-SHL1TARGET= rtl_digest
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-DEF1NAME= $(SHL1TARGET)
-SHL1VERSIONMAP = $(PRJ)$/qa$/export.map
-
-#------------------------------- All object files -------------------------------
-SLOFILES= \
- $(SHL1OBJS)
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/digest/rtl_digest.cxx b/sal/qa/rtl/digest/rtl_digest.cxx
deleted file mode 100644
index fa515aff5..000000000
--- a/sal/qa/rtl/digest/rtl_digest.cxx
+++ /dev/null
@@ -1,1453 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-#include <cppunit/TestAssert.h>
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
-
-#include <rtl/digest.h>
-#include <rtl/ustring.hxx>
-#include <rtl/ustrbuf.hxx>
-#include <rtl/strbuf.hxx>
-
-#include <string.h>
-
-// sample, how to use digest
-
-rtl::OUString CreateMD5FromString( const rtl::OUString& aMsg )
-{
- // PRE: aStr "file"
- // BACK: Str "ababab....0f" Hexcode String
-
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmMD5 );
- if ( handle > 0 )
- {
- const sal_uInt8* pData = (const sal_uInt8*)aMsg.getStr();
- sal_uInt32 nSize = ( aMsg.getLength() * sizeof( sal_Unicode ));
- sal_uInt32 nMD5KeyLen = rtl_digest_queryLength( handle );
- sal_uInt8* pMD5KeyBuffer = new sal_uInt8[ nMD5KeyLen ];
-
- rtl_digest_init( handle, pData, nSize );
- rtl_digest_update( handle, pData, nSize );
- rtl_digest_get( handle, pMD5KeyBuffer, nMD5KeyLen );
- rtl_digest_destroy( handle );
-
- // Create hex-value string from the MD5 value to keep the string size minimal
- rtl::OUStringBuffer aBuffer( nMD5KeyLen * 2 + 1 );
- for ( sal_uInt32 i = 0; i < nMD5KeyLen; ++i )
- aBuffer.append( (sal_Int32)pMD5KeyBuffer[i], 16 );
-
- delete [] pMD5KeyBuffer;
- return aBuffer.makeStringAndClear();
- }
-
- return rtl::OUString();
-}
-
-// -----------------------------------------------------------------------------
-namespace rtl_digest
-{
-
- rtl::OString sSampleString = "This is a sample sentence, which we use to check some crypto functions in sal.";
- rtl::OString sSampleString_MD2 = "647ee6c9d4aa5fdd374ed9d7a156acbf";
- rtl::OString sSampleString_MD5 = "b16b903e6fc0b62ae389013ed93fe531";
- rtl::OString sSampleString_SHA = "eab2814429b2613301c8a077b806af3680548914";
- rtl::OString sSampleString_SHA1 = "2bc5bdb7506a2cdc2fd27fc8b9889343012d5008";
- rtl::OString sSampleString_HMAC_MD5 = "dd9cba48c972fba0a882baa72b079674";
- rtl::OString sSampleString_HMAC_SHA1 = "5d7f43ce6abd1de4438d7e69e01495864490cf3e";
-
- rtl::OString sSampleString_only_one_diff = "This is a sample sentence. which we use to check some crypto functions in sal.";
-
-class create : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void create_001()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmMD5 );
- CPPUNIT_ASSERT_MESSAGE("create with rtl_Digest_AlgorithmMD5", handle != 0);
- rtl_digest_destroy( handle );
- }
- void create_002()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmMD2 );
- CPPUNIT_ASSERT_MESSAGE("create with rtl_Digest_AlgorithmMD2", handle != 0);
- rtl_digest_destroy( handle );
- }
- void create_003()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmSHA );
- CPPUNIT_ASSERT_MESSAGE("create with rtl_Digest_AlgorithmSHA", handle != 0);
- rtl_digest_destroy( handle );
- }
- void create_004()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmSHA1 );
- CPPUNIT_ASSERT_MESSAGE("create with rtl_Digest_AlgorithmSHA1", handle != 0);
- rtl_digest_destroy( handle );
- }
- void create_005()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmHMAC_MD5 );
- CPPUNIT_ASSERT_MESSAGE("create with rtl_Digest_AlgorithmHMAC_MD5", handle != 0);
- rtl_digest_destroy( handle );
- }
- void create_006()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmHMAC_SHA1 );
- CPPUNIT_ASSERT_MESSAGE("create with rtl_Digest_AlgorithmHMAC_SHA1", handle != 0);
- rtl_digest_destroy( handle );
- }
-
- void create_007()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmInvalid );
- printf("Handle is %p\n", handle);
- CPPUNIT_ASSERT_MESSAGE("create with NULL", handle == 0);
- rtl_digest_destroy( handle );
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(create);
- CPPUNIT_TEST(create_001);
- CPPUNIT_TEST(create_002);
- CPPUNIT_TEST(create_003);
- CPPUNIT_TEST(create_004);
- CPPUNIT_TEST(create_005);
- CPPUNIT_TEST(create_006);
- CPPUNIT_TEST(create_007);
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-
-
-
-
-// -----------------------------------------------------------------------------
-
-class createMD5 : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void createMD5_001()
- {
- rtlDigest handle = rtl_digest_createMD5();
-
- rtlDigestAlgorithm aAlgo = rtl_digest_queryAlgorithm(handle);
- CPPUNIT_ASSERT_MESSAGE("query handle", rtl_Digest_AlgorithmMD5 == aAlgo);
-
- rtl_digest_destroy( handle );
- }
- CPPUNIT_TEST_SUITE(createMD5);
- CPPUNIT_TEST(createMD5_001);
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-
-
-// -----------------------------------------------------------------------------
-
-class createMD2 : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void createMD2_001()
- {
- rtlDigest handle = rtl_digest_createMD2( );
-
- rtlDigestAlgorithm aAlgo = rtl_digest_queryAlgorithm(handle);
- CPPUNIT_ASSERT_MESSAGE("query handle", rtl_Digest_AlgorithmMD2 == aAlgo);
-
- rtl_digest_destroy( handle );
- }
- CPPUNIT_TEST_SUITE(createMD2);
- CPPUNIT_TEST(createMD2_001);
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-
-// -----------------------------------------------------------------------------
-
-class createSHA : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void createSHA_001()
- {
- rtlDigest handle = rtl_digest_createSHA( );
-
- rtlDigestAlgorithm aAlgo = rtl_digest_queryAlgorithm(handle);
- CPPUNIT_ASSERT_MESSAGE("query handle", rtl_Digest_AlgorithmSHA == aAlgo);
-
- rtl_digest_destroy( handle );
- }
- CPPUNIT_TEST_SUITE(createSHA);
- CPPUNIT_TEST(createSHA_001);
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-// -----------------------------------------------------------------------------
-
-class createSHA1 : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void createSHA1_001()
- {
- rtlDigest handle = rtl_digest_createSHA1();
-
- rtlDigestAlgorithm aAlgo = rtl_digest_queryAlgorithm(handle);
- CPPUNIT_ASSERT_MESSAGE("query handle", rtl_Digest_AlgorithmSHA1 == aAlgo);
-
- rtl_digest_destroy( handle );
- }
- CPPUNIT_TEST_SUITE(createSHA1);
- CPPUNIT_TEST(createSHA1_001);
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-// -----------------------------------------------------------------------------
-
-class createHMAC_MD5 : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void createHMAC_MD5_001()
- {
- rtlDigest handle = rtl_digest_createHMAC_MD5();
-
- rtlDigestAlgorithm aAlgo = rtl_digest_queryAlgorithm(handle);
- CPPUNIT_ASSERT_MESSAGE("query handle", rtl_Digest_AlgorithmHMAC_MD5 == aAlgo);
-
- rtl_digest_destroy( handle );
- }
- CPPUNIT_TEST_SUITE(createHMAC_MD5);
- CPPUNIT_TEST(createHMAC_MD5_001);
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-// -----------------------------------------------------------------------------
-
-class createHMAC_SHA1 : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void createHMAC_SHA1_001()
- {
- rtlDigest handle = rtl_digest_createHMAC_SHA1();
-
- rtlDigestAlgorithm aAlgo = rtl_digest_queryAlgorithm(handle);
- CPPUNIT_ASSERT_MESSAGE("query handle", rtl_Digest_AlgorithmHMAC_SHA1 == aAlgo);
-
- rtl_digest_destroy( handle );
- }
-
-
- CPPUNIT_TEST_SUITE(createHMAC_SHA1);
- CPPUNIT_TEST(createHMAC_SHA1_001);
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-
-// -----------------------------------------------------------------------------
-
-class queryAlgorithm : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void query_001()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmMD5 );
-
- rtlDigestAlgorithm aAlgo = rtl_digest_queryAlgorithm(handle);
- CPPUNIT_ASSERT_MESSAGE("query handle", rtl_Digest_AlgorithmMD5 == aAlgo);
-
- rtl_digest_destroy( handle );
- }
- void query_002()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmMD2 );
-
- rtlDigestAlgorithm aAlgo = rtl_digest_queryAlgorithm(handle);
- CPPUNIT_ASSERT_MESSAGE("query handle", rtl_Digest_AlgorithmMD2 == aAlgo);
-
- rtl_digest_destroy( handle );
- }
- void query_003()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmSHA );
-
- rtlDigestAlgorithm aAlgo = rtl_digest_queryAlgorithm(handle);
- CPPUNIT_ASSERT_MESSAGE("query handle", rtl_Digest_AlgorithmSHA == aAlgo);
-
- rtl_digest_destroy( handle );
- }
- void query_004()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmSHA1 );
-
- rtlDigestAlgorithm aAlgo = rtl_digest_queryAlgorithm(handle);
- CPPUNIT_ASSERT_MESSAGE("query handle", rtl_Digest_AlgorithmSHA1 == aAlgo);
-
- rtl_digest_destroy( handle );
- }
- void query_005()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmHMAC_MD5 );
-
- rtlDigestAlgorithm aAlgo = rtl_digest_queryAlgorithm(handle);
- CPPUNIT_ASSERT_MESSAGE("query handle", rtl_Digest_AlgorithmHMAC_MD5 == aAlgo);
-
- rtl_digest_destroy( handle );
- }
- void query_006()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmHMAC_SHA1 );
-
- rtlDigestAlgorithm aAlgo = rtl_digest_queryAlgorithm(handle);
- CPPUNIT_ASSERT_MESSAGE("query handle", rtl_Digest_AlgorithmHMAC_SHA1 == aAlgo);
-
- rtl_digest_destroy( handle );
- }
- void query_007()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmInvalid );
-
- rtlDigestAlgorithm aAlgo = rtl_digest_queryAlgorithm(handle);
- CPPUNIT_ASSERT_MESSAGE("query handle", rtl_Digest_AlgorithmInvalid == aAlgo);
-
- rtl_digest_destroy( handle );
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(queryAlgorithm);
- CPPUNIT_TEST( query_001 );
- CPPUNIT_TEST( query_002 );
- CPPUNIT_TEST( query_003 );
- CPPUNIT_TEST( query_004 );
- CPPUNIT_TEST( query_005 );
- CPPUNIT_TEST( query_006 );
- CPPUNIT_TEST( query_007 );
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-
-
-// -----------------------------------------------------------------------------
-class queryLength : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void queryLength_MD5()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmMD5 );
-
- sal_uInt32 nAlgoLength = rtl_digest_queryLength(handle);
- // printf("nAlgoLength:=%d\n", nAlgoLength);
- CPPUNIT_ASSERT_MESSAGE("query Length", RTL_DIGEST_LENGTH_MD5 == nAlgoLength);
-
- rtl_digest_destroy( handle );
- }
- void queryLength_MD2()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmMD2 );
-
- sal_uInt32 nAlgoLength = rtl_digest_queryLength(handle);
- // printf("nAlgoLength:=%d\n", nAlgoLength);
- CPPUNIT_ASSERT_MESSAGE("query length", RTL_DIGEST_LENGTH_MD2 == nAlgoLength);
-
- rtl_digest_destroy( handle );
- }
- void queryLength_SHA()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmSHA );
-
- sal_uInt32 nAlgoLength = rtl_digest_queryLength(handle);
- // printf("nAlgoLength:=%d\n", nAlgoLength);
- CPPUNIT_ASSERT_MESSAGE("query length", RTL_DIGEST_LENGTH_SHA == nAlgoLength);
-
- rtl_digest_destroy( handle );
- }
- void queryLength_SHA1()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmSHA1 );
-
- sal_uInt32 nAlgoLength = rtl_digest_queryLength(handle);
- // printf("nAlgoLength:=%d\n", nAlgoLength);
- CPPUNIT_ASSERT_MESSAGE("query length", RTL_DIGEST_LENGTH_SHA1 == nAlgoLength);
-
- rtl_digest_destroy( handle );
- }
- void queryLength_HMAC_MD5()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmHMAC_MD5 );
-
- sal_uInt32 nAlgoLength = rtl_digest_queryLength(handle);
- // printf("nAlgoLength:=%d\n", nAlgoLength);
- CPPUNIT_ASSERT_MESSAGE("query length", RTL_DIGEST_LENGTH_HMAC_MD5 == nAlgoLength);
-
- rtl_digest_destroy( handle );
- }
- void queryLength_HMAC_SHA1()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmHMAC_SHA1 );
-
- sal_uInt32 nAlgoLength = rtl_digest_queryLength(handle);
- // printf("nAlgoLength:=%d\n", nAlgoLength);
- CPPUNIT_ASSERT_MESSAGE("query length", RTL_DIGEST_LENGTH_HMAC_SHA1 == nAlgoLength);
-
- rtl_digest_destroy( handle );
- }
-
- void queryLength_Illegal()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmInvalid );
-
- sal_uInt32 nAlgoLength = rtl_digest_queryLength(handle);
- // printf("nAlgoLength:=%d\n", nAlgoLength);
- CPPUNIT_ASSERT_MESSAGE("query length", 0 == nAlgoLength);
-
- rtl_digest_destroy( handle );
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(queryLength);
- CPPUNIT_TEST( queryLength_MD2 );
- CPPUNIT_TEST( queryLength_MD5 );
- CPPUNIT_TEST( queryLength_SHA );
- CPPUNIT_TEST( queryLength_SHA1 );
- CPPUNIT_TEST( queryLength_HMAC_MD5 );
- CPPUNIT_TEST( queryLength_HMAC_SHA1 );
- CPPUNIT_TEST( queryLength_Illegal );
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-
-// -----------------------------------------------------------------------------
-
-rtl::OString createHex(sal_uInt8 *_pMD5KeyBuffer, sal_uInt32 _nMD5KeyLen)
-{
- // Create hex-value string from the MD5 value to keep the string size minimal
- rtl::OStringBuffer aBuffer( _nMD5KeyLen * 2 + 1 );
- for ( sal_uInt32 i = 0; i < _nMD5KeyLen; ++i )
- {
- sal_Int32 nValue = (sal_Int32)_pMD5KeyBuffer[i];
- if (nValue < 16) // maximul hex value for 1 byte
- aBuffer.append( static_cast<sal_Int32>(0), static_cast<sal_Int16>(16) /* radix */ );
- aBuffer.append( nValue, 16 /* radix */ );
- }
-
- return aBuffer.makeStringAndClear();
-}
-
-
-// -----------------------------------------------------------------------------
-class init : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void init_000()
- {
- rtlDigest handle = NULL;
-
- rtlDigestError aError = rtl_digest_init(handle, NULL, 0);
-
- CPPUNIT_ASSERT_MESSAGE("init(NULL, 0, 0)", aError == rtl_Digest_E_Argument);
- }
-
- void init_001()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmMD5 );
-
- rtlDigestError aError = rtl_digest_init(handle, NULL, 0);
-
- CPPUNIT_ASSERT_MESSAGE("init(handle, 0, 0)", aError == rtl_Digest_E_None);
-
- rtl_digest_destroy( handle );
- }
-
- // ------------------------------------
- void init_MD2()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmMD2 );
-
- rtl::OString aMsg = sSampleString;
- const sal_uInt8 *pData = (const sal_uInt8*)aMsg.getStr();
- sal_uInt32 nSize = ( aMsg.getLength() );
-
- rtlDigestError aError = rtl_digest_init(handle, pData, nSize);
-
- CPPUNIT_ASSERT_MESSAGE("init(handle, pData, nSize)", aError == rtl_Digest_E_None);
-
- rtl_digest_update( handle, pData, nSize );
-
- sal_uInt32 nKeyLen = rtl_digest_queryLength( handle );
- sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
-
- rtl_digest_get( handle, pKeyBuffer, nKeyLen );
- rtl::OString aSum = createHex(pKeyBuffer, nKeyLen);
- delete [] pKeyBuffer;
-
- printf("MD2 Sum: %s\n", aSum.getStr());
- // LLA: how to check right values
- // samples?
-
- rtl_digest_destroy( handle );
- }
-
- void init_MD5()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmMD5 );
-
- rtl::OString aMsg = sSampleString;
- const sal_uInt8 *pData = (const sal_uInt8*)aMsg.getStr();
- sal_uInt32 nSize = ( aMsg.getLength() );
-
- rtlDigestError aError = rtl_digest_init(handle, pData, nSize);
-
- CPPUNIT_ASSERT_MESSAGE("init(handle, pData, nSize)", aError == rtl_Digest_E_None);
-
- rtl_digest_update( handle, pData, nSize );
-
- sal_uInt32 nKeyLen = rtl_digest_queryLength( handle );
- sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
-
- rtl_digest_get( handle, pKeyBuffer, nKeyLen );
- rtl::OString aSum = createHex(pKeyBuffer, nKeyLen);
- delete [] pKeyBuffer;
-
- printf("MD5 Sum: %s\n", aSum.getStr());
- // LLA: how to check right values
- // samples?
-
- rtl_digest_destroy( handle );
- }
-
- void init_SHA()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmSHA );
-
- rtl::OString aMsg = sSampleString;
- const sal_uInt8 *pData = (const sal_uInt8*)aMsg.getStr();
- sal_uInt32 nSize = ( aMsg.getLength() );
-
- rtlDigestError aError = rtl_digest_init(handle, pData, nSize);
-
- CPPUNIT_ASSERT_MESSAGE("init(handle, pData, nSize)", aError == rtl_Digest_E_None);
-
- rtl_digest_update( handle, pData, nSize );
-
- sal_uInt32 nKeyLen = rtl_digest_queryLength( handle );
- sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
-
- rtl_digest_get( handle, pKeyBuffer, nKeyLen );
- rtl::OString aSum = createHex(pKeyBuffer, nKeyLen);
- delete [] pKeyBuffer;
-
- printf("SHA Sum: %s\n", aSum.getStr());
- // LLA: how to check right values
- // samples?
-
- rtl_digest_destroy( handle );
- }
- void init_SHA1()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmSHA1 );
-
- rtl::OString aMsg = sSampleString;
- const sal_uInt8 *pData = (const sal_uInt8*)aMsg.getStr();
- sal_uInt32 nSize = ( aMsg.getLength() );
-
- rtlDigestError aError = rtl_digest_init(handle, pData, nSize);
-
- CPPUNIT_ASSERT_MESSAGE("init(handle, pData, nSize)", aError == rtl_Digest_E_None);
-
- rtl_digest_update( handle, pData, nSize );
-
- sal_uInt32 nKeyLen = rtl_digest_queryLength( handle );
- sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
-
- rtl_digest_get( handle, pKeyBuffer, nKeyLen );
- rtl::OString aSum = createHex(pKeyBuffer, nKeyLen);
- delete [] pKeyBuffer;
-
- printf("SHA1 Sum: %s\n", aSum.getStr());
- // LLA: how to check right values
- // samples?
-
- rtl_digest_destroy( handle );
- }
- void init_HMAC_MD5()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmHMAC_MD5 );
-
- rtl::OString aMsg = sSampleString;
- const sal_uInt8 *pData = (const sal_uInt8*)aMsg.getStr();
- sal_uInt32 nSize = ( aMsg.getLength() );
-
- sal_uInt32 nKeyLen = rtl_digest_queryLength( handle );
- CPPUNIT_ASSERT_MESSAGE( "Keylen must be greater 0", nKeyLen );
-
- sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
- CPPUNIT_ASSERT( pKeyBuffer );
- memset(pKeyBuffer, 0, nKeyLen);
-
- rtlDigestError aError = rtl_digest_init(handle, pKeyBuffer, nKeyLen );
-
- CPPUNIT_ASSERT_MESSAGE("init(handle, pData, nSize)", aError == rtl_Digest_E_None);
-
- rtl_digest_update( handle, pData, nSize );
-
- rtl_digest_get( handle, pKeyBuffer, nKeyLen );
- rtl::OString aSum = createHex(pKeyBuffer, nKeyLen);
- delete [] pKeyBuffer;
-
- printf("HMAC_MD5 Sum: %s\n", aSum.getStr());
- // LLA: how to check right values
- // samples?
-
- rtl_digest_destroy( handle );
- }
- void init_HMAC_SHA1()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmHMAC_SHA1 );
-
- rtl::OString aMsg = sSampleString;
- const sal_uInt8 *pData = (const sal_uInt8*)aMsg.getStr();
- sal_uInt32 nSize = ( aMsg.getLength() );
-
- sal_uInt32 nKeyLen = rtl_digest_queryLength( handle );
- CPPUNIT_ASSERT_MESSAGE( "Keylen must be greater 0", nKeyLen );
-
- sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
- CPPUNIT_ASSERT( pKeyBuffer );
- memset(pKeyBuffer, 0, nKeyLen);
-
- rtlDigestError aError = rtl_digest_init(handle, pKeyBuffer, nKeyLen );
-
- CPPUNIT_ASSERT_MESSAGE("init(handle, pData, nSize)", aError == rtl_Digest_E_None);
-
- rtl_digest_update( handle, pData, nSize );
-
- rtl_digest_get( handle, pKeyBuffer, nKeyLen );
- rtl::OString aSum = createHex(pKeyBuffer, nKeyLen);
- delete [] pKeyBuffer;
-
- printf("HMAC_SHA1 Sum: %s\n", aSum.getStr());
- // LLA: how to check right values
- // samples?
-
- rtl_digest_destroy( handle );
- }
-
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(init);
- CPPUNIT_TEST( init_000 );
- CPPUNIT_TEST( init_001 );
- CPPUNIT_TEST( init_MD2 );
- CPPUNIT_TEST( init_MD5 );
- CPPUNIT_TEST( init_SHA );
- CPPUNIT_TEST( init_SHA1 );
- CPPUNIT_TEST( init_HMAC_MD5 );
- CPPUNIT_TEST( init_HMAC_SHA1 );
- CPPUNIT_TEST_SUITE_END();
-}; // class init
-
-// ------------------------------------
-
-rtl::OString getMD5Sum(rtl::OString const& _aMsg )
-{
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmMD5 );
-
- const sal_uInt8 *pData = (const sal_uInt8*)_aMsg.getStr();
- sal_uInt32 nSize = ( _aMsg.getLength() );
-
- rtl_digest_init(handle, pData, nSize);
- rtl_digest_update( handle, pData, nSize );
-
- sal_uInt32 nMD5KeyLen = rtl_digest_queryLength( handle );
- sal_uInt8 *pMD5KeyBuffer = new sal_uInt8[ nMD5KeyLen ];
-
- rtl_digest_get( handle, pMD5KeyBuffer, nMD5KeyLen );
- rtl::OString aMD5Sum = createHex(pMD5KeyBuffer, nMD5KeyLen);
- delete [] pMD5KeyBuffer;
-
- rtl_digest_destroy( handle );
- return aMD5Sum;
-}
-
-// -----------------------------------------------------------------------------
-
-class equalTests : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- // ------------------------------------
- void equal_001()
- {
- rtl::OString aMsg1 = sSampleString;
- rtl::OString aMsg2 = sSampleString;
-
- rtl::OString aMsgMD5Sum1 = getMD5Sum(aMsg1);
- rtl::OString aMsgMD5Sum2 = getMD5Sum(aMsg2);
-
- CPPUNIT_ASSERT_MESSAGE("md5sum must have a length", aMsgMD5Sum1.getLength() == 32 && aMsgMD5Sum2.getLength() == 32 );
- CPPUNIT_ASSERT_MESSAGE("source is the same, dest must be also the same", aMsgMD5Sum1.equals(aMsgMD5Sum2) == sal_True);
- }
- // ------------------------------------
- void equal_002()
- {
- rtl::OString aMsg1 = sSampleString;
- rtl::OString aMsg2 = sSampleString_only_one_diff;
-
- rtl::OString aMsgMD5Sum1 = getMD5Sum(aMsg1);
- rtl::OString aMsgMD5Sum2 = getMD5Sum(aMsg2);
-
- CPPUNIT_ASSERT_MESSAGE("md5sum must have a length", aMsgMD5Sum1.getLength() == 32 && aMsgMD5Sum2.getLength() == 32 );
- CPPUNIT_ASSERT_MESSAGE("differ only in one char", aMsgMD5Sum1.equals(aMsgMD5Sum2) == sal_False);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(equalTests);
- CPPUNIT_TEST( equal_001 );
- CPPUNIT_TEST( equal_002 );
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-
-
-// -----------------------------------------------------------------------------
-class digest_MD2 : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- // ------------------------------------
- void MD2_001()
- {
- rtl::OString aMsg1 = sSampleString;
-
- sal_uInt8 *pBuffer = new sal_uInt8[ RTL_DIGEST_LENGTH_MD2 ];
- CPPUNIT_ASSERT( pBuffer );
- memset(pBuffer, 0, RTL_DIGEST_LENGTH_MD2 );
-
- sal_uInt8 *pMsg1 = (sal_uInt8*)aMsg1.getStr();
- sal_Int32 nLen = aMsg1.getLength();
-
- rtlDigestError aError = rtl_digest_MD2(pMsg1, nLen, pBuffer, RTL_DIGEST_LENGTH_MD2);
-
- CPPUNIT_ASSERT(aError == rtl_Digest_E_None );
-
- rtl::OString aStr = createHex(pBuffer, RTL_DIGEST_LENGTH_MD2);
- printf("Decrypt MD2: %s\n", aStr.getStr());
- CPPUNIT_ASSERT_MESSAGE("checksum of sample string is wrong. Code changes or sample problems, please check.", aStr.equals(sSampleString_MD2) );
-
- delete [] pBuffer;
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(digest_MD2);
- CPPUNIT_TEST( MD2_001 );
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-// -----------------------------------------------------------------------------
-class digest_MD5 : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
- // ------------------------------------
- void MD5_001()
- {
- rtl::OString aMsg1 = sSampleString;
-
- sal_uInt8 *pBuffer = new sal_uInt8[ RTL_DIGEST_LENGTH_MD5 ];
- CPPUNIT_ASSERT( pBuffer );
- memset(pBuffer, 0, RTL_DIGEST_LENGTH_MD5 );
-
- sal_uInt8 *pMsg1 = (sal_uInt8*)aMsg1.getStr();
- sal_Int32 nLen = aMsg1.getLength();
-
- rtlDigestError aError = rtl_digest_MD5(pMsg1, nLen, pBuffer, RTL_DIGEST_LENGTH_MD5);
-
- CPPUNIT_ASSERT(aError == rtl_Digest_E_None );
-
- rtl::OString aStr = createHex(pBuffer, RTL_DIGEST_LENGTH_MD5);
- printf("Decrypt MD5: %s\n", aStr.getStr());
- CPPUNIT_ASSERT_MESSAGE("checksum of sample string is wrong. Code changes or sample problems, please check.", aStr.equals(sSampleString_MD5) );
-
- delete [] pBuffer;
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(digest_MD5);
- CPPUNIT_TEST( MD5_001 );
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-
-// -----------------------------------------------------------------------------
-class digest_SHA : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- // ------------------------------------
- void SHA_001()
- {
- rtl::OString aMsg1 = sSampleString;
-
- sal_uInt8 *pBuffer = new sal_uInt8[ RTL_DIGEST_LENGTH_SHA ];
- CPPUNIT_ASSERT( pBuffer );
- memset(pBuffer, 0, RTL_DIGEST_LENGTH_SHA);
-
- sal_uInt8 *pMsg1 = (sal_uInt8*)aMsg1.getStr();
- sal_Int32 nLen = aMsg1.getLength();
-
- rtlDigestError aError = rtl_digest_SHA(pMsg1, nLen, pBuffer, RTL_DIGEST_LENGTH_SHA);
-
- CPPUNIT_ASSERT(aError == rtl_Digest_E_None );
-
- rtl::OString aStr = createHex(pBuffer, RTL_DIGEST_LENGTH_SHA);
- printf("Decrypt SHA: %s\n", aStr.getStr());
- CPPUNIT_ASSERT_MESSAGE("checksum of sample string is wrong. Code changes or sample problems, please check.", aStr.equals(sSampleString_SHA) );
-
- delete [] pBuffer;
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(digest_SHA);
- CPPUNIT_TEST( SHA_001 );
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-
-// -----------------------------------------------------------------------------
-class digest_SHA1 : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- // ------------------------------------
- void SHA1_001()
- {
- rtl::OString aMsg1 = sSampleString;
-
- sal_uInt8 *pBuffer = new sal_uInt8[ RTL_DIGEST_LENGTH_SHA1 ];
- CPPUNIT_ASSERT( pBuffer );
- memset(pBuffer, 0, RTL_DIGEST_LENGTH_SHA1);
-
- sal_uInt8 *pMsg1 = (sal_uInt8*)aMsg1.getStr();
- sal_Int32 nLen = aMsg1.getLength();
-
- rtlDigestError aError = rtl_digest_SHA1(pMsg1, nLen, pBuffer, RTL_DIGEST_LENGTH_SHA1);
-
- CPPUNIT_ASSERT(aError == rtl_Digest_E_None );
-
- rtl::OString aStr = createHex(pBuffer, RTL_DIGEST_LENGTH_SHA1);
- printf("Decrypt SHA1: %s\n", aStr.getStr());
- CPPUNIT_ASSERT_MESSAGE("checksum of sample string is wrong. Code changes or sample problems, please check.", aStr.equals(sSampleString_SHA1) );
-
- delete [] pBuffer;
- }
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(digest_SHA1);
- CPPUNIT_TEST( SHA1_001 );
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-// -----------------------------------------------------------------------------
-class digest_HMAC_MD5 : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- // ------------------------------------
- void HMAC_MD5_001()
- {
- rtl::OString aMsg1 = sSampleString;
-
- sal_uInt8 *pKeyBuffer = new sal_uInt8[ RTL_DIGEST_LENGTH_HMAC_MD5 ];
- CPPUNIT_ASSERT( pKeyBuffer );
- memset(pKeyBuffer, 0, RTL_DIGEST_LENGTH_HMAC_MD5);
-
- sal_uInt8 *pBuffer = new sal_uInt8[ RTL_DIGEST_LENGTH_HMAC_MD5 ];
- CPPUNIT_ASSERT( pBuffer );
- memset(pBuffer, 0, RTL_DIGEST_LENGTH_HMAC_MD5);
-
- sal_uInt8 *pMsg1 = (sal_uInt8*)aMsg1.getStr();
- sal_Int32 nLen = aMsg1.getLength();
-
- rtlDigestError aError = rtl_digest_HMAC_MD5(pKeyBuffer, RTL_DIGEST_LENGTH_HMAC_MD5, pMsg1, nLen, pBuffer, RTL_DIGEST_LENGTH_HMAC_MD5);
-
- CPPUNIT_ASSERT(aError == rtl_Digest_E_None );
-
- rtl::OString aStr = createHex(pBuffer, RTL_DIGEST_LENGTH_HMAC_MD5);
- printf("Decrypt HMAC_MD5: %s\n", aStr.getStr());
- CPPUNIT_ASSERT_MESSAGE("md5sum of sample string is wrong. Code changes or sample problems, please check.", aStr.equals(sSampleString_HMAC_MD5) );
-
- delete [] pBuffer;
- }
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(digest_HMAC_MD5);
- CPPUNIT_TEST( HMAC_MD5_001 );
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-// -----------------------------------------------------------------------------
-class digest_HMAC_SHA1 : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- // ------------------------------------
- void HMAC_SHA1_001()
- {
- rtl::OString aMsg1 = sSampleString;
-
- sal_uInt8 *pKeyBuffer = new sal_uInt8[ RTL_DIGEST_LENGTH_HMAC_SHA1 ];
- CPPUNIT_ASSERT( pKeyBuffer );
- memset(pKeyBuffer, 0, RTL_DIGEST_LENGTH_HMAC_SHA1);
-
- sal_uInt8 *pBuffer = new sal_uInt8[ RTL_DIGEST_LENGTH_HMAC_SHA1 ];
- CPPUNIT_ASSERT( pBuffer );
- memset(pBuffer, 0, RTL_DIGEST_LENGTH_HMAC_SHA1);
-
- sal_uInt8 *pMsg1 = (sal_uInt8*)aMsg1.getStr();
- sal_Int32 nLen = aMsg1.getLength();
-
- rtlDigestError aError = rtl_digest_HMAC_SHA1(pKeyBuffer, RTL_DIGEST_LENGTH_HMAC_SHA1, pMsg1, nLen, pBuffer, RTL_DIGEST_LENGTH_HMAC_SHA1);
-
- CPPUNIT_ASSERT(aError == rtl_Digest_E_None );
-
- rtl::OString aStr = createHex(pBuffer, RTL_DIGEST_LENGTH_HMAC_SHA1);
- printf("Decrypt HMAC_SHA1: %s\n", aStr.getStr());
- CPPUNIT_ASSERT_MESSAGE("md5sum of sample string is wrong. Code changes or sample problems, please check.", aStr.equals(sSampleString_HMAC_SHA1) );
-
- delete [] pBuffer;
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(digest_HMAC_SHA1);
- CPPUNIT_TEST( HMAC_SHA1_001 );
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-// -----------------------------------------------------------------------------
-class digest_PBKDF2 : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- // ------------------------------------
- rtl::OString /* key */ run_check_PBKDF2(rtl::OString const& _sPassword, bool _bClearSalt, sal_uInt32 _nCount)
- {
- sal_uInt32 nKeyLen = RTL_DIGEST_LENGTH_HMAC_SHA1;
- sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
- CPPUNIT_ASSERT( pKeyBuffer );
- memset(pKeyBuffer, 0, nKeyLen);
-
- sal_uInt8 *pPassword = (sal_uInt8*)_sPassword.getStr();
- sal_Int32 nPasswordLen = _sPassword.getLength();
-
- sal_uInt32 nSaltDataLen = RTL_DIGEST_LENGTH_HMAC_SHA1;
- sal_uInt8 *pSaltData = new sal_uInt8[ nSaltDataLen ];
- CPPUNIT_ASSERT( pSaltData );
- memset(pSaltData, 0, nSaltDataLen);
-
- if (! _bClearSalt)
- {
- // wilful contamination
- pSaltData[0] = 1;
- }
-
- rtlDigestError aError = rtl_digest_PBKDF2(pKeyBuffer, nKeyLen, pPassword, nPasswordLen, pSaltData, nSaltDataLen, _nCount);
-
- CPPUNIT_ASSERT(aError == rtl_Digest_E_None );
-
- rtl::OString aKey = createHex(pKeyBuffer, nKeyLen);
- printf("Key: %s\n", aKey.getStr());
-
- // rtl::OString sSalt = createHex(pSaltData, nSaltDataLen);
- // printf("Salt: %s\n", sSalt.getStr());
-
- // CPPUNIT_ASSERT_MESSAGE("md5sum of sample string is wrong. Code changes or sample problems, please check.", aStr.equals(sSampleString_PBKDF2) );
-
- delete [] pSaltData;
- delete [] pKeyBuffer;
- return aKey;
- }
-
- void PBKDF2_001()
- {
- rtl::OString aPassword = "Password";
-
- // all permutations
- run_check_PBKDF2(aPassword, false, 1);
- run_check_PBKDF2(aPassword, false, 2);
- run_check_PBKDF2(aPassword, true, 1);
- run_check_PBKDF2(aPassword, true, 2);
- run_check_PBKDF2(aPassword, false, 3);
- run_check_PBKDF2(aPassword, false, 4);
- run_check_PBKDF2(aPassword, true, 3);
- run_check_PBKDF2(aPassword, true, 4);
- }
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(digest_PBKDF2);
- CPPUNIT_TEST( PBKDF2_001 );
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-// -----------------------------------------------------------------------------
-
-class update : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void update_000()
- {
- rtlDigest aHandle = NULL;
- rtlDigestError aError = rtl_digest_update(aHandle, NULL, 0);
- CPPUNIT_ASSERT_MESSAGE("does not handle wrong parameter", aError == rtl_Digest_E_Argument );
- }
-
- void updateMD2_000()
- {
- rtlDigest aHandle = NULL;
- rtlDigestError aError = rtl_digest_updateMD2(aHandle, NULL, 0);
- CPPUNIT_ASSERT_MESSAGE("does not handle wrong parameter", aError == rtl_Digest_E_Argument );
- }
-
- void updateMD2_001()
- {
- rtlDigest aHandle = rtl_digest_create( rtl_Digest_AlgorithmMD2 );
- CPPUNIT_ASSERT_MESSAGE("create with rtl_Digest_AlgorithmMD2", aHandle != 0);
-
- rtl::OString aMsg = sSampleString;
- const sal_uInt8* pData = (const sal_uInt8*)aMsg.getStr();
-
- rtlDigestError aError = rtl_digest_updateMD2(aHandle, NULL, 0);
- CPPUNIT_ASSERT_MESSAGE("handle parameter 'pData' wrong", aError == rtl_Digest_E_Argument );
-
- /* rtlDigestError */ aError = rtl_digest_updateMD2(aHandle, pData, 0);
- CPPUNIT_ASSERT_MESSAGE("handle parameter 'nSize' wrong", aError == rtl_Digest_E_None );
-
- rtl_digest_destroyMD2(aHandle);
- }
- void updateMD5_000()
- {
- rtlDigest aHandle = NULL;
- rtlDigestError aError = rtl_digest_updateMD5(aHandle, NULL, 0);
- CPPUNIT_ASSERT_MESSAGE("does not handle wrong parameter", aError == rtl_Digest_E_Argument );
- }
-
- void updateMD5_001()
- {
- // use wrong Algorithm!!! This is volitional!
- rtlDigest aHandle = rtl_digest_create( rtl_Digest_AlgorithmMD2 );
- CPPUNIT_ASSERT_MESSAGE("create with rtl_Digest_AlgorithmMD2", aHandle != 0);
-
- rtl::OString aMsg = sSampleString;
- const sal_uInt8* pData = (const sal_uInt8*)aMsg.getStr();
- sal_uInt32 nSize = ( aMsg.getLength() );
-
- rtlDigestError aError = rtl_digest_updateMD5(aHandle, pData, nSize);
- CPPUNIT_ASSERT_MESSAGE("handle parameter 'handle' wrong", aError == rtl_Digest_E_Algorithm );
-
- rtl_digest_destroyMD5(aHandle);
- }
-
- void updateMD5_002()
- {
- rtlDigest aHandle = rtl_digest_create( rtl_Digest_AlgorithmMD5 );
- CPPUNIT_ASSERT_MESSAGE("create with rtl_Digest_AlgorithmMD5", aHandle != 0);
-
- rtl::OString aMsg = sSampleString;
- const sal_uInt8* pData = (const sal_uInt8*)aMsg.getStr();
-
- rtlDigestError aError = rtl_digest_updateMD5(aHandle, NULL, 0);
- CPPUNIT_ASSERT_MESSAGE("handle parameter 'pData' wrong", aError == rtl_Digest_E_Argument );
-
- /* rtlDigestError */ aError = rtl_digest_updateMD5(aHandle, pData, 0);
- CPPUNIT_ASSERT_MESSAGE("handle parameter 'nSize' wrong", aError == rtl_Digest_E_None );
-
- rtl_digest_destroyMD5(aHandle);
- }
-
- void updateSHA_000()
- {
- rtlDigest aHandle = NULL;
- rtlDigestError aError = rtl_digest_updateSHA(aHandle, NULL, 0);
- CPPUNIT_ASSERT_MESSAGE("does not handle wrong parameter", aError == rtl_Digest_E_Argument );
- }
-
- void updateSHA1_000()
- {
- rtlDigest aHandle = NULL;
- rtlDigestError aError = rtl_digest_updateSHA1(aHandle, NULL, 0);
- CPPUNIT_ASSERT_MESSAGE("does not handle wrong parameter", aError == rtl_Digest_E_Argument );
- }
-
- void updateHMAC_MD5_000()
- {
- rtlDigest aHandle = NULL;
- rtlDigestError aError = rtl_digest_updateHMAC_MD5(aHandle, NULL, 0);
- CPPUNIT_ASSERT_MESSAGE("does not handle wrong parameter", aError == rtl_Digest_E_Argument );
- }
-
- void updateHMAC_SHA1_000()
- {
- rtlDigest aHandle = NULL;
- rtlDigestError aError = rtl_digest_updateHMAC_SHA1(aHandle, NULL, 0);
- CPPUNIT_ASSERT_MESSAGE("does not handle wrong parameter", aError == rtl_Digest_E_Argument );
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(update);
- CPPUNIT_TEST(update_000);
- CPPUNIT_TEST(updateMD5_000);
- CPPUNIT_TEST(updateMD5_001);
- CPPUNIT_TEST(updateMD5_002);
- CPPUNIT_TEST(updateMD5_000);
- CPPUNIT_TEST(updateSHA_000);
- CPPUNIT_TEST(updateSHA1_000);
- CPPUNIT_TEST(updateHMAC_MD5_000);
- CPPUNIT_TEST(updateHMAC_SHA1_000);
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-// -----------------------------------------------------------------------------
-
-class get : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void get_000()
- {
- rtlDigest aHandle = NULL;
- rtlDigestError aError = rtl_digest_get(aHandle, NULL, 0);
- CPPUNIT_ASSERT_MESSAGE("does not handle wrong parameter", aError == rtl_Digest_E_Argument );
- }
- void getMD5_000()
- {
- rtlDigest aHandle = NULL;
- rtlDigestError aError = rtl_digest_getMD5(aHandle, NULL, 0);
- CPPUNIT_ASSERT_MESSAGE("does not handle wrong parameter", aError == rtl_Digest_E_Argument );
- }
- void getMD5_001()
- {
- // test with wrong algorithm
- rtlDigest aHandle = rtl_digest_create( rtl_Digest_AlgorithmMD2 );
- CPPUNIT_ASSERT_MESSAGE("create with rtl_Digest_AlgorithmMD2", aHandle != 0);
-
- sal_uInt32 nKeyLen = rtl_digest_queryLength( aHandle );
- sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
-
- rtlDigestError aError = rtl_digest_getMD5(aHandle, NULL, 0);
- CPPUNIT_ASSERT_MESSAGE("handle 2. parameter wrong", aError == rtl_Digest_E_Argument );
-
- /* rtlDigestError */ aError = rtl_digest_getMD5(aHandle, pKeyBuffer, 0);
- CPPUNIT_ASSERT_MESSAGE("handle parameter 'handle' wrong", aError == rtl_Digest_E_Algorithm );
-
- rtl_digest_destroyMD2(aHandle);
- }
-
- void getMD5_002()
- {
- rtlDigest aHandle = rtl_digest_create( rtl_Digest_AlgorithmMD5 );
- CPPUNIT_ASSERT_MESSAGE("create with rtl_Digest_AlgorithmMD5", aHandle != 0);
-
- sal_uInt32 nKeyLen = rtl_digest_queryLength( aHandle );
- sal_uInt8 *pKeyBuffer = new sal_uInt8[ nKeyLen ];
-
- rtlDigestError aError = rtl_digest_getMD5(aHandle, NULL /* pKeyBuffer */ , nKeyLen);
- CPPUNIT_ASSERT_MESSAGE("handle parameter 'pData' wrong", aError == rtl_Digest_E_Argument );
-
- /* rtlDigestError */ aError = rtl_digest_getMD5(aHandle, pKeyBuffer, 0);
- CPPUNIT_ASSERT_MESSAGE("handle parameter 'nSize' wrong", aError == rtl_Digest_E_BufferSize );
-
- rtl_digest_destroyMD5(aHandle);
- delete [] pKeyBuffer;
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(get);
- CPPUNIT_TEST(get_000);
- CPPUNIT_TEST(getMD5_000);
- CPPUNIT_TEST(getMD5_001);
- CPPUNIT_TEST(getMD5_002);
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-
-// -----------------------------------------------------------------------------
-class destroy : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void destroy_001()
- {
- rtlDigest handle = rtl_digest_create( rtl_Digest_AlgorithmMD5 );
- CPPUNIT_ASSERT_MESSAGE("create with rtl_Digest_AlgorithmMD5", handle != 0);
-
- // not really testable
- // LLA: good will test.
- rtl_digest_destroy( handle );
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(destroy);
- CPPUNIT_TEST(destroy_001);
- CPPUNIT_TEST_SUITE_END();
-}; // class create
-// -----------------------------------------------------------------------------
-
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::create);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::createMD2);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::createMD5);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::createSHA);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::createSHA1);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::createHMAC_MD5);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::createHMAC_SHA1);
-
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::destroy);
-
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::queryAlgorithm);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::queryLength);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::init);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::equalTests);
-
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::digest_MD2);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::digest_MD5);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::digest_SHA);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::digest_SHA1);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::digest_HMAC_MD5);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::digest_HMAC_SHA1);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::digest_PBKDF2);
-
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::update);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::get);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_digest::destroy);
-} // namespace rtl_digest
-
-CPPUNIT_PLUGIN_IMPLEMENT();
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/doublelock/makefile.mk b/sal/qa/rtl/doublelock/makefile.mk
deleted file mode 100644
index a1d035673..000000000
--- a/sal/qa/rtl/doublelock/makefile.mk
+++ /dev/null
@@ -1,67 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-PRJ=..$/..$/..
-
-PRJNAME=sal
-TARGET=qa_rtl_doublelock
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-.IF "$(OS)" == "IOS"
-CFLAGSCXX += -DCPPUNIT_PLUGIN_EXPORTED_NAME=cppunitTest_$(TARGET)
-.ENDIF
-
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
-
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-
-.IF "$(COM)" == "MSC"
- CFLAGS+=/Ob1
-.ENDIF
-
-SHL1OBJS= \
- $(SLO)$/rtl_doublelocking.obj
-
-SHL1TARGET= rtl_doublelocking
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-DEF1NAME =$(SHL1TARGET)
-SHL1VERSIONMAP = $(PRJ)$/qa$/export.map
-
-#------------------------------- All object files -------------------------------
-SLOFILES=$(SHL1OBJS)
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
deleted file mode 100644
index 2690091eb..000000000
--- a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
+++ /dev/null
@@ -1,260 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-//------------------------------------------------------------------------
-// include files
-//------------------------------------------------------------------------
-#include <sal/types.h>
-
-#include <osl/thread.hxx>
-#include <osl/time.h>
-
-#include <rtl/instance.hxx>
-#include <rtl/ustring.hxx>
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
-
-#ifdef WNT
-#include <windows.h>
-#else
-#include <unistd.h>
-#include <time.h>
-#endif
-
-// -----------------------------------------------------------------------------
-#define CONST_TEST_STRING "gregorian"
-
-namespace {
-struct Gregorian : public rtl::StaticWithInit<rtl::OUString, Gregorian> {
- const rtl::OUString operator () () {
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( CONST_TEST_STRING ));
- }
-};
-}
-
-// -----------------------------------------------------------------------------
-namespace ThreadHelper
-{
- // typedef enum {
- // QUIET=1,
- // VERBOSE
- // } eSleepVerboseMode;
-
- void thread_sleep_tenth_sec(sal_Int32 _nTenthSec/*, eSleepVerboseMode nVerbose = VERBOSE*/)
- {
- // if (nVerbose == VERBOSE)
- // {
- // printf("wait %d tenth seconds. ", _nTenthSec );
- // fflush(stdout);
- // }
-#ifdef WNT //Windows
- Sleep(_nTenthSec * 100 );
-#endif
-#if ( defined UNX )
- TimeValue nTV;
- nTV.Seconds = static_cast<sal_uInt32>( _nTenthSec/10 );
- nTV.Nanosec = ( (_nTenthSec%10 ) * 100000000 );
- osl_waitThread(&nTV);
-#endif
- // if (nVerbose == VERBOSE)
- // {
- // printf("done\n");
- // }
- }
-}
-
-// -----------------------------------------------------------------------------
-
-/** Simple thread for testing Thread-create.
- * Just add 1 of value 0, and after running, result is 1.
- */
-class OGetThread : public osl::Thread
-{
- sal_Int32 m_nOK;
- sal_Int32 m_nFails;
-
- rtl::OUString m_sConstStr;
-public:
- OGetThread()
- :m_nOK(0),
- m_nFails(0)
- {
- m_sConstStr = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( CONST_TEST_STRING ));
- }
-
- sal_Int32 getOK() { return m_nOK; }
- sal_Int32 getFails() {return m_nFails;}
-
-protected:
-
- /** guarded value which initialized 0
-
- @see ThreadSafeValue
- */
- void SAL_CALL run()
- {
- while(schedule())
- {
- rtl::OUString aStr = Gregorian::get();
- if (aStr.equals(m_sConstStr))
- {
- m_nOK++;
- }
- else
- {
- m_nFails++;
- }
- ThreadHelper::thread_sleep_tenth_sec(1);
- }
- }
-
-public:
-
- virtual void SAL_CALL suspend()
- {
- ::osl::Thread::suspend();
- }
-
- ~OGetThread()
- {
- if (isRunning())
- {
- printf("error: not terminated.\n");
- }
- }
-};
-
-// -----------------------------------------------------------------------------
-namespace rtl_DoubleLocking
-{
-
-/** Test of the osl::Thread::create method
- */
-
- class getValue : public CppUnit::TestFixture
- {
- public:
-
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
-
- void getValue_001()
- {
- rtl::OUString aStr = Gregorian::get();
-
- CPPUNIT_ASSERT_MESSAGE(
- "Gregorian::get() failed, wrong value expected.",
- aStr.getLength() != 0
- );
- }
-
- /** check 2 threads.
-
- ALGORITHM:
- Here the function should show, that 2 different threads,
- which only increase a value, should run at the same time with same prio.
- The test fails, if the difference between the two values is more than 5%
- but IMHO this isn't a failure, it's only a feature of the OS.
- */
-
- void getValue_002()
- {
- // initial 5 threads with different priorities
- OGetThread* pThread = new OGetThread();
- OGetThread* p2Thread = new OGetThread();
-
- //Create them and start running at the same time
- pThread->create();
- p2Thread->create();
-
- ThreadHelper::thread_sleep_tenth_sec(5);
-
- pThread->terminate();
- p2Thread->terminate();
-
- pThread->join();
- p2Thread->join();
-
- sal_Int32 nValueOK = 0;
- nValueOK = pThread->getOK();
-
- sal_Int32 nValueOK2 = 0;
- nValueOK2 = p2Thread->getOK();
-
-#if OSL_DEBUG_LEVEL > 2
- printf("Value in Thread #1 is %d\n", nValueOK);
- printf("Value in Thread #2 is %d\n", nValueOK2);
-#else
- (void)nValueOK2;
-#endif
-
- sal_Int32 nValueFails = 0;
- nValueFails = pThread->getFails();
-
- sal_Int32 nValueFails2 = 0;
- nValueFails2 = p2Thread->getFails();
-
-#if OSL_DEBUG_LEVEL > 2
- printf("Fails in Thread #1 is %d\n", nValueFails);
- printf("Fails in Thread #2 is %d\n", nValueFails2);
-#endif
-
- delete pThread;
- delete p2Thread;
-
- CPPUNIT_ASSERT_MESSAGE(
- "getValue() failed, wrong value expected.",
- nValueOK != 0 && nValueFails == 0 && nValueFails2 == 0
- );
- }
-
- CPPUNIT_TEST_SUITE(getValue);
- CPPUNIT_TEST(getValue_001);
- CPPUNIT_TEST(getValue_002);
- CPPUNIT_TEST_SUITE_END();
- }; // class create
-// -----------------------------------------------------------------------------
- CPPUNIT_TEST_SUITE_REGISTRATION(rtl_DoubleLocking::getValue);
-} // namespace rtl_DoubleLocking
-
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-CPPUNIT_PLUGIN_IMPLEMENT();
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/locale/makefile.mk b/sal/qa/rtl/locale/makefile.mk
deleted file mode 100644
index 0d1c8f83f..000000000
--- a/sal/qa/rtl/locale/makefile.mk
+++ /dev/null
@@ -1,66 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-PRJ=..$/..$/..
-
-PRJNAME=sal
-TARGET=qa_rtl_locale
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-.IF "$(OS)" == "IOS"
-CFLAGSCXX += -DCPPUNIT_PLUGIN_EXPORTED_NAME=cppunitTest_$(TARGET)
-.ENDIF
-
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
-
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-
-SHL1OBJS= \
- $(SLO)$/rtl_locale.obj
-
-SHL1TARGET= rtl_locale
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-# SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME =$(SHL1TARGET)
-# DEF1EXPORTFILE= export.exp
-SHL1VERSIONMAP= $(PRJ)$/qa$/export.map
-
-#------------------------------- All object files -------------------------------
-SLOFILES=$(SHL1OBJS)
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/locale/rtl_locale.cxx b/sal/qa/rtl/locale/rtl_locale.cxx
deleted file mode 100644
index 4f2b3dda3..000000000
--- a/sal/qa/rtl/locale/rtl_locale.cxx
+++ /dev/null
@@ -1,347 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-// autogenerated file with codegen.pl
-
-#include <osl/thread.h>
-#include <rtl/locale.hxx>
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
-
-namespace rtl_locale
-{
- // default locale for test purpose
- void setDefaultLocale()
- {
- rtl::OLocale::setDefault(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("de")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DE")), /* rtl::OUString() */ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("hochdeutsch")) );
- }
-
-class getDefault : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- // start message
- rtl_locale::setDefaultLocale();
- }
-
- void tearDown()
- {
- }
-
- // insert your test code here.
- void getDefault_000()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- // due to the fact, we set the default locale at first, this test is no longer possible
- // ::rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
- // CPPUNIT_ASSERT_MESSAGE("locale must be null", aLocale.getData() == NULL);
-
- }
-
- void getDefault_001()
- {
- // rtl::OLocale::setDefault(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("de")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DE")), rtl::OUString());
- rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
- CPPUNIT_ASSERT_MESSAGE("locale must not null", aLocale.getData() != NULL);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(getDefault);
- CPPUNIT_TEST(getDefault_000);
- CPPUNIT_TEST(getDefault_001);
- CPPUNIT_TEST_SUITE_END();
-}; // class getDefault
-
-
-class setDefault : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- // start message
- rtl_locale::setDefaultLocale();
- }
-
- void tearDown()
- {
- setDefaultLocale();
- }
-
- // insert your test code here.
- void setDefault_001()
- {
- rtl::OLocale::setDefault(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US")), rtl::OUString());
- rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
- CPPUNIT_ASSERT_MESSAGE("locale must not null", aLocale.getData() != NULL);
-
- // be sure to not GPF
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(setDefault);
- CPPUNIT_TEST(setDefault_001);
- CPPUNIT_TEST_SUITE_END();
-}; // class setDefault
-
-
-class getLanguage : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- // start message
- rtl_locale::setDefaultLocale();
- }
-
- void tearDown()
- {
- }
-
- // insert your test code here.
- void getLanguage_001()
- {
- rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
- rtl::OUString suLanguage = aLocale.getLanguage();
- CPPUNIT_ASSERT_MESSAGE("locale language must be 'de'", suLanguage.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("de"))));
- }
- void getLanguage_002()
- {
- rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
- rtl::OUString suLanguage(rtl_locale_getLanguage(aLocale.getData()), SAL_NO_ACQUIRE);
- CPPUNIT_ASSERT_MESSAGE("locale language must be 'de'", suLanguage.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("de"))));
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(getLanguage);
- CPPUNIT_TEST(getLanguage_001);
- CPPUNIT_TEST(getLanguage_002);
- CPPUNIT_TEST_SUITE_END();
-}; // class getLanguage
-
-
-class getCountry : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- // start message
- rtl_locale::setDefaultLocale();
- }
-
- void tearDown()
- {
- }
-
- // insert your test code here.
- void getCountry_001()
- {
- rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
- rtl::OUString suCountry = aLocale.getCountry();
- CPPUNIT_ASSERT_MESSAGE("locale country must be 'DE'", suCountry.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DE"))));
- }
- void getCountry_002()
- {
- rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
- rtl::OUString suCountry(rtl_locale_getCountry(aLocale.getData()), SAL_NO_ACQUIRE);
- CPPUNIT_ASSERT_MESSAGE("locale country must be 'DE'", suCountry.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DE"))));
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(getCountry);
- CPPUNIT_TEST(getCountry_001);
- CPPUNIT_TEST(getCountry_002);
- CPPUNIT_TEST_SUITE_END();
-}; // class getCountry
-
-
-class getVariant : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- // start message
- rtl_locale::setDefaultLocale();
- }
-
- void tearDown()
- {
- }
-
- // insert your test code here.
- void getVariant_001()
- {
- rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
- rtl::OUString suVariant = aLocale.getVariant();
- CPPUNIT_ASSERT_MESSAGE("locale variant must be 'hochdeutsch'", suVariant.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("hochdeutsch"))));
- }
- void getVariant_002()
- {
- rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
- rtl::OUString suVariant(rtl_locale_getVariant(aLocale.getData()), SAL_NO_ACQUIRE);
- CPPUNIT_ASSERT_MESSAGE("locale variant must be 'hochdeutsch'", suVariant.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("hochdeutsch"))));
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(getVariant);
- CPPUNIT_TEST(getVariant_001);
- CPPUNIT_TEST(getVariant_002);
- CPPUNIT_TEST_SUITE_END();
-}; // class getVariant
-
-
-class hashCode : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- // start message
- rtl_locale::setDefaultLocale();
- }
-
- void tearDown()
- {
- }
-
- // insert your test code here.
- void hashCode_001()
- {
- rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
- sal_Int32 nHashCode = aLocale.hashCode();
- CPPUNIT_ASSERT_MESSAGE("locale hashcode must be 3831", nHashCode != 0);
- }
- void hashCode_002()
- {
- rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
- sal_Int32 nHashCode = rtl_locale_hashCode(aLocale.getData());
- CPPUNIT_ASSERT_MESSAGE("locale hashcode must be 3831", nHashCode != 0);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(hashCode);
- CPPUNIT_TEST(hashCode_001);
- CPPUNIT_TEST(hashCode_002);
- CPPUNIT_TEST_SUITE_END();
-}; // class hashCode
-
-
-class equals : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- // start message
- rtl_locale::setDefaultLocale();
- }
-
- void tearDown()
- {
- }
-
- // insert your test code here.
- void equals_001()
- {
- rtl::OLocale aLocale1 = rtl::OLocale::registerLocale(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US")), rtl::OUString());
- rtl::OLocale aLocale2 = rtl::OLocale::registerLocale(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US")));
-
- sal_Bool bLocaleAreEqual = sal_False;
- bLocaleAreEqual = (aLocale1 == aLocale2);
-
- CPPUNIT_ASSERT_MESSAGE("check operator ==()", bLocaleAreEqual == sal_True);
- }
-
- void equals_002()
- {
- rtl::OLocale aLocale1 = rtl::OLocale::registerLocale(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US")), rtl::OUString());
- rtl::OLocale aLocale2 = rtl::OLocale::registerLocale(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US")));
-
- sal_Int32 nEqual = rtl_locale_equals(aLocale1.getData(), aLocale2.getData());
- CPPUNIT_ASSERT(nEqual != 0);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(equals);
- CPPUNIT_TEST(equals_001);
- CPPUNIT_TEST(equals_002);
- CPPUNIT_TEST_SUITE_END();
-}; // class equals
-
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::getDefault);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::setDefault);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::getLanguage);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::getCountry);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::getVariant);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::hashCode);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::equals);
-} // namespace rtl_locale
-
-
-// -----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-
-CPPUNIT_PLUGIN_IMPLEMENT();
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/logfile/makefile.mk b/sal/qa/rtl/logfile/makefile.mk
deleted file mode 100644
index 6660011f3..000000000
--- a/sal/qa/rtl/logfile/makefile.mk
+++ /dev/null
@@ -1,63 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-
-PRJNAME=sal
-TARGET=qa_rtl_logfile
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
-
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-
-# --- BEGIN --------------------------------------------------------
-SHL1OBJS= \
- $(SLO)$/rtl_logfile.obj
-SHL1TARGET= rtl_logfile
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-DEF1NAME =$(SHL1TARGET)
-SHL1VERSIONMAP = $(PRJ)$/qa$/export.map
-
-# END --------------------------------------------------------------
-
-#------------------------------- All object files -------------------------------
-# do this here, so we get right dependencies
-# SLOFILES=$(SHL1OBJS)
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/logfile/rtl_logfile.cxx b/sal/qa/rtl/logfile/rtl_logfile.cxx
deleted file mode 100644
index ac3dfc165..000000000
--- a/sal/qa/rtl/logfile/rtl_logfile.cxx
+++ /dev/null
@@ -1,255 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-// LLA:
-// this file is converted to use with testshl2
-// original was placed in sal/test/textenc.cxx
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#if defined(UNX)
-# include <unistd.h>
-#endif
-
-#include <rtl/logfile.hxx>
-
-#include <osl/file.hxx>
-#if ( defined WNT ) // Windows
-#include <tchar.h>
-#endif
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
-
-using namespace ::osl;
-
-inline void printUString( const ::rtl::OUString & str, const sal_Char * msg = "" )
-{
-
- if (strlen(msg) > 0)
- {
- printf("%s: ", msg );
- }
- rtl::OString aString;
- aString = ::rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US );
- printf("%s\n", (char *)aString.getStr( ) );
-}
-
-/** get the absolute source file URL "file:///.../sal/qa/rtl/logfile/"
- */
-
-inline ::rtl::OUString getTempPath( void )
-{
-#ifdef UNX
- rtl::OUString suDirURL( RTL_CONSTASCII_USTRINGPARAM("file:///tmp/") );
-#else /* Windows */
- rtl::OUString suDirURL( RTL_CONSTASCII_USTRINGPARAM("file:///c:/temp/") );
-#endif
- return suDirURL;
-}
-
-/** if the file exist
- */
-bool t_fileExist(rtl::OUString const& _sFilename)
-{
- ::osl::FileBase::RC nError1;
- ::osl::File aTestFile( _sFilename );
- nError1 = aTestFile.open ( osl_File_OpenFlag_Read );
- if ( ( ::osl::FileBase::E_NOENT != nError1 ) && ( ::osl::FileBase::E_ACCES != nError1 ) )
- {
- aTestFile.close( );
- return true;
- }
- return false;
-}
-/** get Current PID.
-*/
-inline ::rtl::OUString getCurrentPID( )
-{
- //~ Get current PID and turn it into OUString;
- int nPID = 0;
-#ifdef WNT
- nPID = GetCurrentProcessId();
-#else
- nPID = getpid();
-#endif
- return ( ::rtl::OUString::valueOf( ( long )nPID ) );
-}
-
-
-// -----------------------------------------------------------------------------
-/*
- * LLA:
- * check if logfile is create
- * be careful with relative logfiles they will create near the source, maybe it's no write access to it.
- * use absolute path to logfile instead.
- */
-namespace rtl_logfile
-{
- class logfile : public CppUnit::TestFixture
- {
- public:
-
- //directly call rtl_logfile_trace
- void logfile_001()
- {
-#ifdef SOLARIS
- putenv(const_cast< char * >("RTL_LOGFILE=/tmp/logfile1"));
-#endif
-#ifdef WNT
- putenv("RTL_LOGFILE=c:\\temp\\logfile1");
-#endif
-#ifdef LINUX
- setenv("RTL_LOGFILE", "/tmp/logfile1", 0);
-#endif
- rtl_logfile_trace("trace %d\n", 2 );
- rtl_logfile_trace("trace %d %d\n" , 1,2 );
- rtl_logfile_trace("trace %d %d %d\n" , 1 , 2 ,3 );
-
- rtl::OUString suFilePath = getTempPath();
- suFilePath += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("logfile1_")) + getCurrentPID( );
- suFilePath += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".log"));
-
- ::osl::FileBase::RC nError1;
- ::osl::File aTestFile( suFilePath );
- printUString( suFilePath );
- nError1 = aTestFile.open ( osl_File_OpenFlag_Read );
- CPPUNIT_ASSERT_MESSAGE("create the log file: but the logfile does not exist",
- ( ::osl::FileBase::E_NOENT != nError1 ) &&
- ( ::osl::FileBase::E_ACCES != nError1 ) );
- sal_Char buffer_read[400];
- sal_uInt64 nCount_read;
- nError1 = aTestFile.read( buffer_read, 400, nCount_read );
- //printf("buffer is %s\n", buffer_read );
- CPPUNIT_ASSERT_MESSAGE("write right logs", strstr( buffer_read, "trace 1 2 3") != NULL );
- aTestFile.sync();
- aTestFile.close();
- /*// delete logfile on the disk
-
- nError1 = osl::File::remove( suFilePath );
- printError( nError1 );
- CPPUNIT_ASSERT_MESSAGE( "In deleteTestFile Function: remove ", ( ::osl::FileBase::E_None == nError1 ) || ( nError1 == ::osl::FileBase::E_NOENT ) );
- */
- }
- //Profiling output should only be generated for a special product version of OpenOffice
- // which is compiled with a defined preprocessor symbol 'TIMELOG'. Now, the symbol not defined
- void logfile_002()
- {
-#ifdef SOLARIS
- putenv(const_cast< char * >("RTL_LOGFILE=/tmp/logfile2"));
-#endif
-#ifdef WNT
- putenv("RTL_LOGFILE=c:\\temp\\logfile2");
-#endif
-#ifdef LINUX
- setenv("RTL_LOGFILE", "/tmp/logfile2", 0);
-#endif
- RTL_LOGFILE_TRACE( "trace the log" );
- RTL_LOGFILE_TRACE1( "trace %d" , 1 );
- RTL_LOGFILE_TRACE2( "trace %d %d" , 1,2 );
- RTL_LOGFILE_TRACE3( "trace %d %d %d" , 1 , 2 ,3 );
-// TODO: assertion test!
- }
-
- void logfile_003()
- {
-#ifdef SOLARIS
- putenv(const_cast< char * >("RTL_LOGFILE=/tmp/logfile2"));
-#endif
-#ifdef WNT
- putenv("RTL_LOGFILE=c:\\temp\\logfile2");
-#endif
-#ifdef LINUX
- setenv("RTL_LOGFILE", "/tmp/logfile2", 0);
-#endif
- RTL_LOGFILE_CONTEXT ( foo , "foo-function" );
- RTL_LOGFILE_CONTEXT_TRACE ( foo , "trace" );
- RTL_LOGFILE_CONTEXT_TRACE1 ( foo , "trace %d" , 1 );
- RTL_LOGFILE_CONTEXT_TRACE2 ( foo , "trace %d %d" , 1 , 2 );
- RTL_LOGFILE_CONTEXT_TRACE3 ( foo , "trace %d %d %d" , 1 , 2 , 3);
-// TODO: assertion test!
- }
-
-
- CPPUNIT_TEST_SUITE( logfile );
- CPPUNIT_TEST( logfile_001 );
- CPPUNIT_TEST( logfile_002 );
- CPPUNIT_TEST( logfile_003 );
- CPPUNIT_TEST_SUITE_END( );
- };
-
-} // namespace rtl_logfile
-
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION( rtl_logfile::logfile);
-
-// -----------------------------------------------------------------------------
-CPPUNIT_PLUGIN_IMPLEMENT();
-
-//~ do some clean up work after all test completed.
-class GlobalObject
-{
-public:
- ~GlobalObject()
- {
- try
- {
- printf( "\n#Do some clean-ups ... only delete logfile1_*.log here!\n" );
- rtl::OUString suFilePath = getTempPath();
- suFilePath += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("logfile1_")) + getCurrentPID( );
- suFilePath += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".log"));
-
- //if ( ifFileExist( suFilePath ) == sal_True )
- ::osl::FileBase::RC nError1;
- nError1 = osl::File::remove( suFilePath );
-#ifdef WNT
- printf("Please remove logfile* manully! Error is Permision denied!");
-#endif
- }
- catch (const CppUnit::Exception &e)
- {
- printf("Exception caught in GlobalObject dtor(). Exception message: '%s'. Source line: %d\n", e.what(), e.sourceLine().lineNumber());
- }
- catch (...)
- {
- printf("Exception caught (...) in GlobalObject dtor()\n");
- }
- }
-};
-
-GlobalObject theGlobalObject;
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/math/rtl_math.cxx b/sal/qa/rtl/math/rtl_math.cxx
deleted file mode 100644
index 9fe5c82ae..000000000
--- a/sal/qa/rtl/math/rtl_math.cxx
+++ /dev/null
@@ -1,631 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-#ifdef WIN32
-// LLA: take a look into Microsofts math.h implementation, why this define is need
-#define _USE_MATH_DEFINES
-#endif
-
-#include <math.h>
-#include <rtl/math.h>
-#include <rtl/string.hxx>
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
-
-#include "valueequal.hxx"
-
-namespace rtl_math
-{
-
-class test : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
-
- void equalCheck(double _nResult, double _nExpect) /* throws Exception */
- {
- bool bEqualResult = is_double_equal(_nResult, _nExpect);
-
- rtl::OString sError = "rtl_math_round expected result is wrong should:(";
- sError += rtl::OString::valueOf(_nExpect);
- sError += ") but is:(";
- sError += rtl::OString::valueOf(_nResult);
- sError += ")";
-
- CPPUNIT_ASSERT_MESSAGE(sError.getStr(), bEqualResult == true);
- }
-
- // insert your test code here.
- void round_000()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nValue = M_PI;
- double nResult = 0.0;
-
- nResult = rtl_math_round(nValue, 0, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(3.0));
-
- nResult = rtl_math_round(nValue, 2, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(3.14));
-
- nResult = rtl_math_round(nValue, 3, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(3.142));
-
- nResult = rtl_math_round(nValue, 10, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(3.1415926536));
- }
-
- // insert your test code here.
- void round_001_positiv()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(0.2));
- }
-
- void round_001_negativ()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(-0.2));
- }
-// -----------------------------------------------------------------------------
- void round_002_positiv()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(0.1));
- }
-
- void round_002_negativ()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(-0.1));
- }
-// -----------------------------------------------------------------------------
- void round_003_positiv()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(0.2));
- }
-
- void round_003_negativ()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(-0.2));
- }
-// -----------------------------------------------------------------------------
- void round_004_positiv()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(0.1));
- }
-
- void round_004_negativ()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(-0.2));
- }
-// -----------------------------------------------------------------------------
- void round_005_positiv()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(0.2));
- }
-
- void round_005_negativ()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(-0.1));
- }
-// -----------------------------------------------------------------------------
- void round_006_positiv()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(0.2));
- }
-
- void round_006_negativ()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(-0.2));
- }
-// -----------------------------------------------------------------------------
- void round_007_positiv()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(0.2));
- }
-
- void round_007_negativ()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(-0.2));
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(test);
- CPPUNIT_TEST(round_000);
-
- CPPUNIT_TEST(round_001_positiv);
- CPPUNIT_TEST(round_001_negativ);
-
- CPPUNIT_TEST(round_002_positiv);
- CPPUNIT_TEST(round_002_negativ);
-
- CPPUNIT_TEST(round_003_positiv);
- CPPUNIT_TEST(round_003_negativ);
-
- CPPUNIT_TEST(round_004_positiv);
- CPPUNIT_TEST(round_004_negativ);
-
- CPPUNIT_TEST(round_005_positiv);
- CPPUNIT_TEST(round_005_negativ);
-
- CPPUNIT_TEST(round_006_positiv);
- CPPUNIT_TEST(round_006_negativ);
-
- CPPUNIT_TEST(round_007_positiv);
- CPPUNIT_TEST(round_007_negativ);
-
- CPPUNIT_TEST_SUITE_END();
-}; // class test
-
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_math::test);
-} // namespace rtl_math
-
-
-// -----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-CPPUNIT_PLUGIN_IMPLEMENT();
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/math/test-rtl-math.cxx b/sal/qa/rtl/math/test-rtl-math.cxx
deleted file mode 100644
index 41b4ea211..000000000
--- a/sal/qa/rtl/math/test-rtl-math.cxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/*************************************************************************
-*
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
-*
-* OpenOffice.org - a multi-platform office productivity suite
-*
-* This file is part of OpenOffice.org.
-*
-* OpenOffice.org is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License version 3
-* only, as published by the Free Software Foundation.
-*
-* OpenOffice.org is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License version 3 for more details
-* (a copy is included in the LICENSE file that accompanied this code).
-*
-* You should have received a copy of the GNU Lesser General Public License
-* version 3 along with OpenOffice.org. If not, see
-* <http://www.openoffice.org/license.html>
-* for a copy of the LGPLv3 License.
-*
-************************************************************************/
-
-#include "sal/config.h"
-
-#include <sal/cppunit.h>
-#include "rtl/math.hxx"
-#include "rtl/ustring.h"
-#include "rtl/ustring.hxx"
-#include "sal/types.h"
-
-namespace {
-
-class Test: public CppUnit::TestFixture {
-public:
- void test_stringToDouble_good() {
- rtl_math_ConversionStatus status;
- sal_Int32 end;
- double res = rtl::math::stringToDouble(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" +1.E01foo")),
- sal_Unicode('.'), sal_Unicode(','), &status, &end);
- CPPUNIT_ASSERT_EQUAL(rtl_math_ConversionStatus_Ok, status);
- CPPUNIT_ASSERT_EQUAL(sal_Int32(RTL_CONSTASCII_LENGTH(" +1.E01")), end);
- CPPUNIT_ASSERT_EQUAL(10.0, res);
- }
-
- void test_stringToDouble_bad() {
- rtl_math_ConversionStatus status;
- sal_Int32 end;
- double res = rtl::math::stringToDouble(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" +Efoo")),
- sal_Unicode('.'), sal_Unicode(','), &status, &end);
- CPPUNIT_ASSERT_EQUAL(rtl_math_ConversionStatus_Ok, status);
- CPPUNIT_ASSERT_EQUAL(sal_Int32(0), end);
- CPPUNIT_ASSERT_EQUAL(0.0, res);
- }
-
- CPPUNIT_TEST_SUITE(Test);
- CPPUNIT_TEST(test_stringToDouble_good);
- CPPUNIT_TEST(test_stringToDouble_bad);
- CPPUNIT_TEST_SUITE_END();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(Test);
-
-}
-
-CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sal/qa/rtl/math/test_rtl_math.cxx b/sal/qa/rtl/math/test_rtl_math.cxx
deleted file mode 100644
index 7ac9a9d50..000000000
--- a/sal/qa/rtl/math/test_rtl_math.cxx
+++ /dev/null
@@ -1,657 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "rtl/math.h"
-#include "rtl/math.hxx"
-#include "rtl/strbuf.hxx"
-#include "rtl/string.h"
-#include "rtl/string.hxx"
-#include "rtl/textenc.h"
-#include "rtl/ustring.hxx"
-#include "sal/types.h"
-#include <sal/macros.h>
-
-#include <stdlib.h>
-
-#include <sal/cppunit.h>
-
-namespace {
-
-struct FloatTraits
-{
- typedef float Number;
-
- static inline char const * getPrefix() { return "float"; }
-};
-
-struct DoubleTraits
-{
- typedef double Number;
-
- static inline char const * getPrefix() { return "double"; }
-};
-
-struct StringTraits
-{
- typedef rtl::OString String;
-
- static inline char const * getPrefix() { return "OString"; }
-
- static inline rtl::OString createFromAscii(char const * pString)
- { return rtl::OString(pString); }
-
- static inline void appendBuffer(rtl::OStringBuffer & rBuffer,
- rtl::OString const & rString)
- { rBuffer.append(rString); }
-
- static inline rtl::OString doubleToString(double fValue,
- rtl_math_StringFormat eFormat,
- sal_Int32 nDecPlaces,
- sal_Char cDecSeparator,
- bool bEraseTrailingDecZeros)
- {
- return rtl::math::doubleToString(fValue, eFormat, nDecPlaces,
- cDecSeparator, bEraseTrailingDecZeros);
- }
-};
-
-struct UStringTraits
-{
- typedef rtl::OUString String;
-
- static inline char const * getPrefix() { return "OUString"; }
-
- static inline rtl::OUString createFromAscii(char const * pString)
- { return rtl::OUString::createFromAscii(pString); }
-
- static inline void appendBuffer(rtl::OStringBuffer & rBuffer,
- rtl::OUString const & rString)
- { rBuffer.append(rtl::OUStringToOString(rString, RTL_TEXTENCODING_UTF8)); }
-
- static inline rtl::OUString doubleToString(double fValue,
- rtl_math_StringFormat eFormat,
- sal_Int32 nDecPlaces,
- sal_Unicode cDecSeparator,
- bool bEraseTrailingDecZeros)
- {
- return rtl::math::doubleToUString(fValue, eFormat, nDecPlaces,
- cDecSeparator,
- bEraseTrailingDecZeros);
- }
-};
-
-struct TestNumberToString
-{
- double fValue;
- rtl_math_StringFormat eFormat;
- sal_Int32 nDecPlaces;
- char cDecSeparator;
- bool bEraseTrailingDecZeros;
- char const * pResult;
-};
-
-template< typename StringT, typename NumberT >
-void testNumberToString(TestNumberToString const & rTest)
-{
- typename NumberT::Number fValue = static_cast< typename NumberT::Number >(rTest.fValue);
- if (fValue != rTest.fValue)
- return;
-
- // LLA: t_print("size: %d ", sizeof(fValue));
- typename StringT::String aResult1;
-
- aResult1 = StringT::doubleToString(fValue, rTest.eFormat, rTest.nDecPlaces,
- rTest.cDecSeparator,
- rTest.bEraseTrailingDecZeros);
-
- typename StringT::String aResult2(StringT::createFromAscii(rTest.pResult));
-
- rtl::OStringBuffer aBuffer;
- aBuffer.append(StringT::getPrefix());
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM("/"));
- aBuffer.append(NumberT::getPrefix());
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(" doubleToString("));
- aBuffer.append(fValue);
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", "));
- aBuffer.append(static_cast< sal_Int32 >(rTest.eFormat));
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", "));
- aBuffer.append(rTest.nDecPlaces);
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", "));
- aBuffer.append(rTest.cDecSeparator);
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", "));
- aBuffer.append(static_cast< sal_Int32 >(rTest.bEraseTrailingDecZeros));
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM("): "));
- StringT::appendBuffer(aBuffer, aResult1);
- if (aResult1 != aResult2)
- {
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(" != "));
- StringT::appendBuffer(aBuffer, aResult2);
- }
- CPPUNIT_ASSERT_MESSAGE(aBuffer.getStr(), aResult1 == aResult2);
-}
-
-template< typename StringT, typename NumberT >
-void testNumberToString(TestNumberToString const * pTests, size_t nCount)
-{
- for (size_t i = 0; i < nCount; ++i)
- testNumberToString< StringT, NumberT >(pTests[i]);
-}
-
-struct TestStringToNumberToString
-{
- char const * pValue;
- rtl_math_StringFormat eFormat;
- sal_Int32 nDecPlaces;
- char cDecSeparator;
- bool bEraseTrailingDecZeros;
- char const * pResult;
-};
-
-template< typename StringT >
-void testStringToNumberToString(TestStringToNumberToString const & rTest)
-{
- double d = rtl::math::stringToDouble(StringT::createFromAscii(rTest.pValue),
- rTest.cDecSeparator, 0, 0, 0);
- typename StringT::String aResult1(
- StringT::doubleToString(d, rTest.eFormat, rTest.nDecPlaces,
- rTest.cDecSeparator,
- rTest.bEraseTrailingDecZeros));
- typename StringT::String aResult2(StringT::createFromAscii(rTest.pResult));
- rtl::OStringBuffer aBuffer;
- aBuffer.append(StringT::getPrefix());
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(
- " doubleToString(stringToDouble("));
- aBuffer.append(rTest.pValue);
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", "));
- aBuffer.append(rTest.cDecSeparator);
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM("), "));
- aBuffer.append(static_cast< sal_Int32 >(rTest.eFormat));
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", "));
- aBuffer.append(rTest.nDecPlaces);
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", "));
- aBuffer.append(rTest.cDecSeparator);
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", "));
- aBuffer.append(static_cast< sal_Int32 >(rTest.bEraseTrailingDecZeros));
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM("): "));
- StringT::appendBuffer(aBuffer, aResult1);
- if (aResult1 != aResult2)
- {
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(" != "));
- StringT::appendBuffer(aBuffer, aResult2);
- }
- CPPUNIT_ASSERT_MESSAGE(aBuffer.getStr(), aResult1 == aResult2);
-}
-
-template< typename StringT >
-void testStringToNumberToString(TestStringToNumberToString const * pTests,
- size_t nCount)
-{
- for (size_t i = 0; i < nCount; ++i)
- testStringToNumberToString< StringT >(pTests[i]);
-}
-
-}
-
-class Math : public CppUnit::TestFixture
-{
-public:
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void rtl_math_001()
- {
- static TestNumberToString const aTest[]
- = { // 1, 1+2^-1, ..., 1+2^-52
- // Too few decimal digits are printed, so that various different
- // double values lead to the same output:
- { 1, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1" },
- { 1.5, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.5" },
- { 1.25, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.25" },
- { 1.125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.125" },
- { 1.0625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.0625" },
- { 1.03125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.03125" },
- { 1.015625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.015625" },
- { 1.0078125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.0078125" },
- { 1.00390625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00390625" },
- { 1.001953125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.001953125" },
- { 1.0009765625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.0009765625" },
- { 1.00048828125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00048828125" },
- { 1.000244140625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.000244140625" },
- { 1.0001220703125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.0001220703125" },
- { 1.00006103515625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00006103515625" },
- { 1.000030517578125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00003051757813" },
- { 1.0000152587890625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00001525878906" },
- { 1.00000762939453125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00000762939453" },
- { 1.000003814697265625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00000381469727" },
- { 1.0000019073486328125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00000190734863" },
- { 1.00000095367431640625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00000095367432" },
- { 1.000000476837158203125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00000047683716" },
- { 1.0000002384185791015625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00000023841858" },
- { 1.00000011920928955078125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00000011920929" },
- { 1.000000059604644775390625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00000005960464" },
- { 1.0000000298023223876953125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00000002980232" },
- { 1.00000001490116119384765625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00000001490116" },
- { 1.000000007450580596923828125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000745058" },
- { 1.0000000037252902984619140625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000372529" },
- { 1.00000000186264514923095703125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000186265" },
- { 1.000000000931322574615478515625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000093132" },
- { 1.0000000004656612873077392578125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000046566" },
- { 1.00000000023283064365386962890625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000023283" },
- { 1.000000000116415321826934814453125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000011642" },
- { 1.0000000000582076609134674072265625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000005821" },
- { 1.00000000002910383045673370361328125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.0000000000291" },
- { 1.000000000014551915228366851806640625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000001455" },
- { 1.0000000000072759576141834259033203125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000728" },
- { 1.00000000000363797880709171295166015625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000364" },
- { 1.000000000001818989403545856475830078125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000182" },
- { 1.0000000000009094947017729282379150390625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000091" },
- { 1.00000000000045474735088646411895751953125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000045" },
- { 1.000000000000227373675443232059478759765625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000023" },
- { 1.0000000000001136868377216160297393798828125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000011" },
- { 1.00000000000005684341886080801486968994140625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000006" },
- { 1.000000000000028421709430404007434844970703125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000003" },
- { 1.0000000000000142108547152020037174224853515625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000001" },
- { 1.00000000000000710542735760100185871124267578125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000001" },
- { 1.000000000000003552713678800500929355621337890625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1" },
- { 1.0000000000000017763568394002504646778106689453125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1" },
- { 1.00000000000000088817841970012523233890533447265625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1" },
- { 1.000000000000000444089209850062616169452667236328125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1" },
- { 1.0000000000000002220446049250313080847263336181640625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1" },
-
- // 1, 1+2^-1, ..., 1+2^-52
- // Too few decimal digits are printed, so that various different
- // double values lead to the same output:
- { 1, rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000000000000000000000000000000000000000000000" },
- { 1.5, rtl_math_StringFormat_F, 53, '.', false,
- "1.50000000000000000000000000000000000000000000000000000" },
- { 1.25, rtl_math_StringFormat_F, 53, '.', false,
- "1.25000000000000000000000000000000000000000000000000000" },
- { 1.125, rtl_math_StringFormat_F, 53, '.', false,
- "1.12500000000000000000000000000000000000000000000000000" },
- { 1.0625, rtl_math_StringFormat_F, 53, '.', false,
- "1.06250000000000000000000000000000000000000000000000000" },
- { 1.03125, rtl_math_StringFormat_F, 53, '.', false,
- "1.03125000000000000000000000000000000000000000000000000" },
- { 1.015625, rtl_math_StringFormat_F, 53, '.', false,
- "1.01562500000000000000000000000000000000000000000000000" },
- { 1.0078125, rtl_math_StringFormat_F, 53, '.', false,
- "1.00781250000000000000000000000000000000000000000000000" },
- { 1.00390625, rtl_math_StringFormat_F, 53, '.', false,
- "1.00390625000000000000000000000000000000000000000000000" },
- { 1.001953125, rtl_math_StringFormat_F, 53, '.', false,
- "1.00195312500000000000000000000000000000000000000000000" },
- { 1.0009765625, rtl_math_StringFormat_F, 53, '.', false,
- "1.00097656250000000000000000000000000000000000000000000" },
- { 1.00048828125, rtl_math_StringFormat_F, 53, '.', false,
- "1.00048828125000000000000000000000000000000000000000000" },
- { 1.000244140625, rtl_math_StringFormat_F, 53, '.', false,
- "1.00024414062500000000000000000000000000000000000000000" },
- { 1.0001220703125, rtl_math_StringFormat_F, 53, '.', false,
- "1.00012207031250000000000000000000000000000000000000000" },
- { 1.00006103515625, rtl_math_StringFormat_F, 53, '.', false,
- "1.00006103515625000000000000000000000000000000000000000" },
- { 1.000030517578125, rtl_math_StringFormat_F, 53, '.', false,
- "1.00003051757813000000000000000000000000000000000000000" },
- { 1.0000152587890625, rtl_math_StringFormat_F, 53, '.', false,
- "1.00001525878906000000000000000000000000000000000000000" },
- { 1.00000762939453125, rtl_math_StringFormat_F, 53, '.', false,
- "1.00000762939453000000000000000000000000000000000000000" },
- { 1.000003814697265625, rtl_math_StringFormat_F, 53, '.', false,
- "1.00000381469727000000000000000000000000000000000000000" },
- { 1.0000019073486328125, rtl_math_StringFormat_F, 53, '.',
- false,
- "1.00000190734863000000000000000000000000000000000000000" },
- { 1.00000095367431640625, rtl_math_StringFormat_F, 53, '.',
- false,
- "1.00000095367432000000000000000000000000000000000000000" },
- { 1.000000476837158203125, rtl_math_StringFormat_F, 53, '.',
- false,
- "1.00000047683716000000000000000000000000000000000000000" },
- { 1.0000002384185791015625, rtl_math_StringFormat_F, 53, '.',
- false,
- "1.00000023841858000000000000000000000000000000000000000" },
- { 1.00000011920928955078125, rtl_math_StringFormat_F, 53, '.',
- false,
- "1.00000011920929000000000000000000000000000000000000000" },
- { 1.000000059604644775390625, rtl_math_StringFormat_F, 53, '.',
- false,
- "1.00000005960464000000000000000000000000000000000000000" },
- { 1.0000000298023223876953125, rtl_math_StringFormat_F, 53, '.',
- false,
- "1.00000002980232000000000000000000000000000000000000000" },
- { 1.00000001490116119384765625, rtl_math_StringFormat_F, 53,
- '.', false,
- "1.00000001490116000000000000000000000000000000000000000" },
- { 1.000000007450580596923828125, rtl_math_StringFormat_F, 53,
- '.', false,
- "1.00000000745058000000000000000000000000000000000000000" },
- { 1.0000000037252902984619140625, rtl_math_StringFormat_F, 53,
- '.', false,
- "1.00000000372529000000000000000000000000000000000000000" },
- { 1.00000000186264514923095703125, rtl_math_StringFormat_F, 53,
- '.', false,
- "1.00000000186265000000000000000000000000000000000000000" },
- { 1.000000000931322574615478515625, rtl_math_StringFormat_F, 53,
- '.', false,
- "1.00000000093132000000000000000000000000000000000000000" },
- { 1.0000000004656612873077392578125, rtl_math_StringFormat_F,
- 53, '.', false,
- "1.00000000046566000000000000000000000000000000000000000" },
- { 1.00000000023283064365386962890625, rtl_math_StringFormat_F,
- 53, '.', false,
- "1.00000000023283000000000000000000000000000000000000000" },
- { 1.000000000116415321826934814453125, rtl_math_StringFormat_F,
- 53, '.', false,
- "1.00000000011642000000000000000000000000000000000000000" },
- { 1.0000000000582076609134674072265625, rtl_math_StringFormat_F,
- 53, '.', false,
- "1.00000000005821000000000000000000000000000000000000000" },
- { 1.00000000002910383045673370361328125,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000002910000000000000000000000000000000000000000" },
- { 1.000000000014551915228366851806640625,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000001455000000000000000000000000000000000000000" },
- { 1.0000000000072759576141834259033203125,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000728000000000000000000000000000000000000000" },
- { 1.00000000000363797880709171295166015625,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000364000000000000000000000000000000000000000" },
- { 1.000000000001818989403545856475830078125,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000182000000000000000000000000000000000000000" },
- { 1.0000000000009094947017729282379150390625,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000091000000000000000000000000000000000000000" },
- { 1.00000000000045474735088646411895751953125,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000045000000000000000000000000000000000000000" },
- { 1.000000000000227373675443232059478759765625,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000023000000000000000000000000000000000000000" },
- { 1.0000000000001136868377216160297393798828125,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000011000000000000000000000000000000000000000" },
- { 1.00000000000005684341886080801486968994140625,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000006000000000000000000000000000000000000000" },
- { 1.000000000000028421709430404007434844970703125,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000003000000000000000000000000000000000000000" },
- { 1.0000000000000142108547152020037174224853515625,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000001000000000000000000000000000000000000000" },
- { 1.00000000000000710542735760100185871124267578125,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000001000000000000000000000000000000000000000" },
- { 1.000000000000003552713678800500929355621337890625,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000000000000000000000000000000000000000000000" },
- { 1.0000000000000017763568394002504646778106689453125,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000000000000000000000000000000000000000000000" },
- { 1.00000000000000088817841970012523233890533447265625,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000000000000000000000000000000000000000000000" },
- { 1.000000000000000444089209850062616169452667236328125,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000000000000000000000000000000000000000000000" },
- { 1.0000000000000002220446049250313080847263336181640625,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000000000000000000000000000000000000000000000" } };
- size_t const nCount = SAL_N_ELEMENTS(aTest);
-
-//LLA: the float tests are wrong here, due to the fact that
-// we calculate with too less digits after the point
-
-// bReturn &= testNumberToString< StringTraits, FloatTraits >(
-// pTestResult, aTest, nCount);
- testNumberToString< StringTraits, DoubleTraits >(aTest, nCount);
-// bReturn &= testNumberToString< UStringTraits, FloatTraits >(
-// pTestResult, aTest, nCount);
- testNumberToString< UStringTraits, DoubleTraits >(aTest, nCount);
- }
-
- void rtl_math_002()
- {
- static TestStringToNumberToString const aTest[]
- = { { "1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1" },
- { " 1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1" },
- { " 1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1" },
- { "\t1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1" },
- { "\t 1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1" },
- { " \t1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1" },
-
- { "-1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "-1" },
- { " -1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "-1" },
- { " -1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "-1" },
- { "\t-1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "-1" },
- { "\t -1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "-1" },
- { " \t-1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "-1" },
-
- { "1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#INF" },
- { " 1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#INF" },
- { " 1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#INF" },
- { "\t1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#INF" },
- { "\t 1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#INF" },
- { " \t1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#INF" },
-
- { "-1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#INF" },
- { " -1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#INF" },
- { " -1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#INF" },
- { "\t-1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#INF" },
- { "\t -1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#INF" },
- { " \t-1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#INF" },
-
- { "1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#NAN" },
- { " 1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#NAN" },
- { " 1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#NAN" },
- { "\t1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#NAN" },
- { "\t 1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#NAN" },
- { " \t1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#NAN" },
-
- { "-1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#NAN" },
- { " -1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#NAN" },
- { " -1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#NAN" },
- { "\t-1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#NAN" },
- { "\t -1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#NAN" },
- { " \t-1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#NAN" },
-
- { "3.14E-2000", rtl_math_StringFormat_E, 4, '.', false,
- "0.0000E+000" },
- { "3.14E-200", rtl_math_StringFormat_E, 4, '.', false,
- "3.1400E-200" },
- { "3.14E-20", rtl_math_StringFormat_E, 4, '.', false,
- "3.1400E-020" },
- { "3.14E-2", rtl_math_StringFormat_E, 4, '.', false,
- "3.1400E-002" },
- { "3.14E2", rtl_math_StringFormat_E, 4, '.', false,
- "3.1400E+002" },
- { "3.14E20", rtl_math_StringFormat_E, 4, '.', false,
- "3.1400E+020" },
- { "3.14E200", rtl_math_StringFormat_E, 4, '.', false,
- "3.1400E+200" },
- { "3.14E2000", rtl_math_StringFormat_E, 4, '.', false,
- "1.#INF" },
- };
- size_t const nCount = SAL_N_ELEMENTS(aTest);
- testStringToNumberToString< StringTraits >(aTest, nCount);
- testStringToNumberToString< UStringTraits >(aTest, nCount);
- }
-
- CPPUNIT_TEST_SUITE(Math);
- CPPUNIT_TEST(rtl_math_001);
- CPPUNIT_TEST(rtl_math_002);
- CPPUNIT_TEST_SUITE_END();
-};
-
-// -----------------------------------------------------------------------------
-//extern "C" void /* sal_Bool */ SAL_CALL test_rtl_math2( hTestResult hRtlTestResult )
-//{
-// c_rtl_tres_state_start(hRtlTestResult, "rtl_math" );
-//
-// test_rtl_math( hRtlTestResult );
-//
-// c_rtl_tres_state_end(hRtlTestResult, "rtl_math" );
-//}
-// -----------------------------------------------------------------------------
-//void RegisterAdditionalFunctions(FktRegFuncPtr _pFunc)
-//{
-// if (_pFunc)
-// {
-// (_pFunc)(&test_rtl_math2, "");
-// }
-//}
-
-CPPUNIT_TEST_SUITE_REGISTRATION(::Math);
-
-CPPUNIT_PLUGIN_IMPLEMENT();
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/ostring/makefile.mk b/sal/qa/rtl/ostring/makefile.mk
deleted file mode 100644
index 5436736cd..000000000
--- a/sal/qa/rtl/ostring/makefile.mk
+++ /dev/null
@@ -1,92 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-INCPRE+= $(PRJ)$/qa$/inc
-
-PRJNAME=sal
-TARGET=qa_rtl_ostring2
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
-
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-
-# BEGIN ----------------------------------------------------------------
-# auto generated Target:joblist by codegen.pl
-SHL1OBJS= \
- $(SLO)$/rtl_OString2.obj
-
-SHL1TARGET= rtl_OString2
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-# SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME =$(SHL1TARGET)
-# DEF2EXPORTFILE= export.exp
-SHL1VERSIONMAP= $(PRJ)$/qa$/export.map
-# auto generated Target:joblist
-# END ------------------------------------------------------------------
-
-# BEGIN ----------------------------------------------------------------
-SHL2OBJS= \
- $(SLO)$/rtl_str.obj
-
-SHL2TARGET= rtl_str
-SHL2STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL2IMPLIB= i$(SHL2TARGET)
-DEF2NAME =$(SHL2TARGET)
-SHL2VERSIONMAP= $(PRJ)$/qa$/export.map
-# END ------------------------------------------------------------------
-
-# BEGIN ----------------------------------------------------------------
-SHL3OBJS= \
- $(SLO)$/rtl_string.obj
-
-SHL3TARGET= rtl_string
-SHL3STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL3IMPLIB= i$(SHL3TARGET)
-DEF3NAME =$(SHL3TARGET)
-SHL3VERSIONMAP= $(PRJ)$/qa$/export.map
-# END ------------------------------------------------------------------
-#------------------------------- All object files -------------------------------
-# do this here, so we get right dependencies
-# SLOFILES=$(SHL1OBJS)
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/ostring/rtl_OString2.cxx b/sal/qa/rtl/ostring/rtl_OString2.cxx
deleted file mode 100644
index e81a73462..000000000
--- a/sal/qa/rtl/ostring/rtl_OString2.cxx
+++ /dev/null
@@ -1,575 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-// autogenerated file with codegen.pl
-// There exist some more test code in sal/qa/rtl_strings/rtl_OString.cxx
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
-
-#include <rtl/string.hxx>
-
-#include "valueequal.hxx"
-
-namespace rtl_OString
-{
-
-class valueOf : public CppUnit::TestFixture
-{
- void valueOf_float_test_impl(float _nValue)
- {
- rtl::OString sValue;
- sValue = rtl::OString::valueOf( _nValue );
- printf("nFloat := %.9f sValue := %s\n", _nValue, sValue.getStr());
-
- float nValueATOF = static_cast<float>(atof( sValue.getStr() ));
-
- bool bEqualResult = is_float_equal(_nValue, nValueATOF);
- CPPUNIT_ASSERT_MESSAGE("Values are not equal.", bEqualResult == true);
- }
-
- void valueOf_float_test(float _nValue)
- {
- valueOf_float_test_impl(_nValue);
-
- // test also the negative part.
- float nNegativeValue = -_nValue;
- valueOf_float_test_impl(nNegativeValue);
- }
-
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- // insert your test code here.
- void valueOf_float_test_001()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
- float nValue = 3.0f;
- valueOf_float_test(nValue);
- }
-
- void valueOf_float_test_002()
- {
- float nValue = 3.5f;
- valueOf_float_test(nValue);
- }
-
- void valueOf_float_test_003()
- {
- float nValue = 3.0625f;
- valueOf_float_test(nValue);
- }
-
- void valueOf_float_test_004()
- {
- float nValue = 3.502525f;
- valueOf_float_test(nValue);
- }
-
- void valueOf_float_test_005()
- {
- float nValue = 3.141592f;
- valueOf_float_test(nValue);
- }
-
- void valueOf_float_test_006()
- {
- float nValue = 3.5025255f;
- valueOf_float_test(nValue);
- }
-
- void valueOf_float_test_007()
- {
- float nValue = 3.0039062f;
- valueOf_float_test(nValue);
- }
-
-private:
-
- void valueOf_double_test_impl(double _nValue)
- {
- rtl::OString sValue;
- sValue = rtl::OString::valueOf( _nValue );
- printf("nDouble := %.20f sValue := %s\n", _nValue, sValue.getStr());
-
- double nValueATOF = atof( sValue.getStr() );
-
- bool bEqualResult = is_double_equal(_nValue, nValueATOF);
- CPPUNIT_ASSERT_MESSAGE("Values are not equal.", bEqualResult == true);
- }
-
- void valueOf_double_test(double _nValue)
- {
- valueOf_double_test_impl(_nValue);
-
- // test also the negative part.
- double nNegativeValue = -_nValue;
- valueOf_double_test_impl(nNegativeValue);
- }
-public:
-
- // valueOf double
- void valueOf_double_test_001()
- {
- double nValue = 3.0;
- valueOf_double_test(nValue);
- }
- void valueOf_double_test_002()
- {
- double nValue = 3.5;
- valueOf_double_test(nValue);
- }
- void valueOf_double_test_003()
- {
- double nValue = 3.0625;
- valueOf_double_test(nValue);
- }
- void valueOf_double_test_004()
- {
- double nValue = 3.1415926535;
- valueOf_double_test(nValue);
- }
- void valueOf_double_test_005()
- {
- double nValue = 3.141592653589793;
- valueOf_double_test(nValue);
- }
- void valueOf_double_test_006()
- {
- double nValue = 3.1415926535897932;
- valueOf_double_test(nValue);
- }
- void valueOf_double_test_007()
- {
- double nValue = 3.14159265358979323;
- valueOf_double_test(nValue);
- }
- void valueOf_double_test_008()
- {
- double nValue = 3.141592653589793238462643;
- valueOf_double_test(nValue);
- }
-
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(valueOf);
- CPPUNIT_TEST(valueOf_float_test_001);
- CPPUNIT_TEST(valueOf_float_test_002);
- CPPUNIT_TEST(valueOf_float_test_003);
- CPPUNIT_TEST(valueOf_float_test_004);
- CPPUNIT_TEST(valueOf_float_test_005);
- CPPUNIT_TEST(valueOf_float_test_006);
- CPPUNIT_TEST(valueOf_float_test_007);
-
- CPPUNIT_TEST(valueOf_double_test_001);
- CPPUNIT_TEST(valueOf_double_test_002);
- CPPUNIT_TEST(valueOf_double_test_003);
- CPPUNIT_TEST(valueOf_double_test_004);
- CPPUNIT_TEST(valueOf_double_test_005);
- CPPUNIT_TEST(valueOf_double_test_006);
- CPPUNIT_TEST(valueOf_double_test_007);
- CPPUNIT_TEST(valueOf_double_test_008);
- CPPUNIT_TEST_SUITE_END();
-}; // class valueOf
-
-// -----------------------------------------------------------------------------
-// - toDouble (tests)
-// -----------------------------------------------------------------------------
-class toDouble : public CppUnit::TestFixture
-{
-
-public:
-
- toDouble()
- {
- // testPrecision a;
- }
-
-
-
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void toDouble_test_impl(rtl::OString const& _sValue)
- {
- double nValueATOF = atof( _sValue.getStr() );
-
- // rtl::OUString suValue = rtl::OUString::createFromAscii( _sValue.getStr() );
- double nValueToDouble = _sValue.toDouble();
-
- bool bEqualResult = is_double_equal(nValueToDouble, nValueATOF);
- CPPUNIT_ASSERT_MESSAGE("Values are not equal.", bEqualResult == true);
- }
-
- void toDouble_test(rtl::OString const& _sValue)
- {
- toDouble_test_impl(_sValue);
-
- // test also the negativ part.
- rtl::OString sNegativValue("-");
- sNegativValue += _sValue;
- toDouble_test_impl(sNegativValue);
- }
-
- // insert your test code here.
- void toDouble_selftest()
- {
- printf("Start selftest:\n");
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.01) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.001) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.0001) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.00001) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.000001) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.0000001) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.00000001) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.000000001) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.0000000001) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.00000000001) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.000000000001) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.0000000000001) == false);
- // we check til 14 values after comma
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.00000000000001) == true);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.000000000000001) == true);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.0000000000000001) == true);
- printf("Selftest done.\n");
- }
-
- void toDouble_test_3()
- {
- rtl::OString sValue("3");
- toDouble_test(sValue);
- }
- void toDouble_test_3_5()
- {
- rtl::OString sValue("3.5");
- toDouble_test(sValue);
- }
- void toDouble_test_3_0625()
- {
- rtl::OString sValue("3.0625");
- toDouble_test(sValue);
- }
- void toDouble_test_pi()
- {
- // value from http://www.angio.net/pi/digits/50.txt
- rtl::OString sValue("3.141592653589793238462643383279502884197169399375");
- toDouble_test(sValue);
- }
-
- void toDouble_test_1()
- {
- rtl::OString sValue("1");
- toDouble_test(sValue);
- }
- void toDouble_test_10()
- {
- rtl::OString sValue("10");
- toDouble_test(sValue);
- }
- void toDouble_test_100()
- {
- rtl::OString sValue("100");
- toDouble_test(sValue);
- }
- void toDouble_test_1000()
- {
- rtl::OString sValue("1000");
- toDouble_test(sValue);
- }
- void toDouble_test_10000()
- {
- rtl::OString sValue("10000");
- toDouble_test(sValue);
- }
- void toDouble_test_1e99()
- {
- rtl::OString sValue("1e99");
- toDouble_test(sValue);
- }
- void toDouble_test_1e_n99()
- {
- rtl::OString sValue("1e-99");
- toDouble_test(sValue);
- }
- void toDouble_test_1e308()
- {
- rtl::OString sValue("1e308");
- toDouble_test(sValue);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(toDouble);
- CPPUNIT_TEST(toDouble_selftest);
-
- CPPUNIT_TEST(toDouble_test_3);
- CPPUNIT_TEST(toDouble_test_3_5);
- CPPUNIT_TEST(toDouble_test_3_0625);
- CPPUNIT_TEST(toDouble_test_pi);
- CPPUNIT_TEST(toDouble_test_1);
- CPPUNIT_TEST(toDouble_test_10);
- CPPUNIT_TEST(toDouble_test_100);
- CPPUNIT_TEST(toDouble_test_1000);
- CPPUNIT_TEST(toDouble_test_10000);
- CPPUNIT_TEST(toDouble_test_1e99);
- CPPUNIT_TEST(toDouble_test_1e_n99);
- CPPUNIT_TEST(toDouble_test_1e308);
- CPPUNIT_TEST_SUITE_END();
-}; // class toDouble
-
-// -----------------------------------------------------------------------------
-// - getToken (tests)
-// -----------------------------------------------------------------------------
-class getToken : public CppUnit::TestFixture
-{
-
-public:
-
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- // -----------------------------------------------------------------------------
-
- void getToken_000()
- {
- rtl::OString sTokenStr;
-
- sal_Int32 nIndex = 0;
- do
- {
- rtl::OString sToken = sTokenStr.getToken( 0, ';', nIndex );
- }
- while ( nIndex >= 0 );
- // printf("Index %d\n", nIndex);
- // should not GPF
- }
-
- void getToken_001()
- {
- rtl::OString sTokenStr = "a;b";
-
- sal_Int32 nIndex = 0;
-
- rtl::OString sToken = sTokenStr.getToken( 0, ';', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be a 'a'", sToken.equals("a") == sal_True);
-
- /* rtl::OString */ sToken = sTokenStr.getToken( 0, ';', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be a 'b'", sToken.equals("b") == sal_True);
- CPPUNIT_ASSERT_MESSAGE("index should be negative", nIndex == -1);
- }
-
- void getToken_002()
- {
- rtl::OString sTokenStr = "a;b.c";
-
- sal_Int32 nIndex = 0;
-
- rtl::OString sToken = sTokenStr.getToken( 0, ';', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be a 'a'", sToken.equals("a") == sal_True);
-
- /* rtl::OString */ sToken = sTokenStr.getToken( 0, '.', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be a 'b'", sToken.equals("b") == sal_True);
-
- /* rtl::OString */ sToken = sTokenStr.getToken( 0, '.', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be a 'c'", sToken.equals("c") == sal_True);
- CPPUNIT_ASSERT_MESSAGE("index should be negative", nIndex == -1);
- }
-
- void getToken_003()
- {
- rtl::OString sTokenStr = "a;;b";
-
- sal_Int32 nIndex = 0;
-
- rtl::OString sToken = sTokenStr.getToken( 0, ';', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be a 'a'", sToken.equals("a") == sal_True);
-
- /* rtl::OString */ sToken = sTokenStr.getToken( 0, ';', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be empty", sToken.getLength() == 0);
-
- /* rtl::OString */ sToken = sTokenStr.getToken( 0, ';', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be a 'b'", sToken.equals("b") == sal_True);
- CPPUNIT_ASSERT_MESSAGE("index should be negative", nIndex == -1);
- }
-
- void getToken_004()
- {
- rtl::OString sTokenStr = "longer.then.ever.";
-
- sal_Int32 nIndex = 0;
-
- rtl::OString sToken = sTokenStr.getToken( 0, '.', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be 'longer'", sToken.equals("longer") == sal_True);
-
- /* rtl::OString */ sToken = sTokenStr.getToken( 0, '.', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be 'then'", sToken.equals("then") == sal_True);
-
- /* rtl::OString */ sToken = sTokenStr.getToken( 0, '.', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be 'ever'", sToken.equals("ever") == sal_True);
-
- /* rtl::OString */ sToken = sTokenStr.getToken( 0, '.', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be empty", sToken.getLength() == 0);
-
- CPPUNIT_ASSERT_MESSAGE("index should be negative", nIndex == -1);
- }
-
-
- CPPUNIT_TEST_SUITE(getToken);
- CPPUNIT_TEST(getToken_000);
- CPPUNIT_TEST(getToken_001);
- CPPUNIT_TEST(getToken_002);
- CPPUNIT_TEST(getToken_003);
- CPPUNIT_TEST(getToken_004);
- CPPUNIT_TEST_SUITE_END();
-}; // class getToken
-
-// -----------------------------------------------------------------------------
-// testing the method replaceAt( sal_Int32 index, sal_Int32 count,
-// const OString& newStr )
-// -----------------------------------------------------------------------------
-
-// Developer note: Mindy Liu, 2004-04-23
-// stollen from sal/qa/rtl_strings/rtl_OString.cxx
-
-class replaceAt : public CppUnit::TestFixture
-{
-
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
- sal_Bool check_replaceAt( const rtl::OString* expVal, const rtl::OString* input,
- const rtl::OString* newStr, sal_Int32 index, sal_Int32 count)
- {
- ::rtl::OString aStr1;
- aStr1= input->replaceAt( index, count, *newStr );
-
- printf("the result OString is %s#\n", aStr1.getStr() );
-
- sal_Bool bRes = ( expVal->compareTo(aStr1) == 0 );
- return bRes;
- }
- // -----------------------------------------------------------------------------
-
- void replaceAt_001()
- {
- sal_Bool bRes = check_replaceAt(new rtl::OString("Java@Sun"),
- new rtl::OString("Sun java"), new rtl::OString("Java@Sun"), 0, 8 );
- CPPUNIT_ASSERT_MESSAGE("string differs, replace whole string", bRes == sal_True);
- }
-
- void replaceAt_002()
- {
- sal_Bool bRes = check_replaceAt(new rtl::OString("Sun Java desktop system"),
- new rtl::OString("Sun "), new rtl::OString("Java desktop system"), 10, 8 );
- CPPUNIT_ASSERT_MESSAGE("index > length of input string", bRes == sal_True);
- }
-
- void replaceAt_003()
- {
- sal_Bool bRes = check_replaceAt(new rtl::OString("SuJava desktop system"),
- new rtl::OString("Sun "), new rtl::OString("Java desktop system"), 2, 64 );
- CPPUNIT_ASSERT_MESSAGE("larger count", bRes == sal_True);
- }
-
- void replaceAt_004()
- {
-
- sal_Bool bRes = check_replaceAt(new rtl::OString("Java desktop system"),
- new rtl::OString("Sun "), new rtl::OString("Java desktop system"), -4, 8 );
- CPPUNIT_ASSERT_MESSAGE("navigate index", bRes == sal_True);
- }
- void replaceAt_005()
- {
-
- sal_Bool bRes = check_replaceAt(new rtl::OString("Sun Jesktop System"),
- new rtl::OString("Sun Java Desktop System"), new rtl::OString(""), 5, 5 );
- CPPUNIT_ASSERT_MESSAGE("replace with null string", bRes == sal_True);
- }
-
-
- CPPUNIT_TEST_SUITE(replaceAt);
- CPPUNIT_TEST(replaceAt_001);
- CPPUNIT_TEST(replaceAt_002);
- CPPUNIT_TEST(replaceAt_003);
- CPPUNIT_TEST(replaceAt_004);
- CPPUNIT_TEST(replaceAt_005);
- CPPUNIT_TEST_SUITE_END();
-}; // class replaceAt
-
-
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OString::valueOf);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OString::toDouble);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OString::getToken);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OString::replaceAt);
-
-} // namespace rtl_OString
-
-
-// -----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-CPPUNIT_PLUGIN_IMPLEMENT();
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/ostring/rtl_str.cxx b/sal/qa/rtl/ostring/rtl_str.cxx
deleted file mode 100644
index eede2e291..000000000
--- a/sal/qa/rtl/ostring/rtl_str.cxx
+++ /dev/null
@@ -1,899 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
-
-#include <rtl/string.hxx>
-#include <cstring>
-
-namespace rtl_str
-{
-
- class compare : public CppUnit::TestFixture
- {
- public:
-
- void compare_000()
- {
- rtl_str_compare( NULL, NULL);
- }
-
- void compare_000_1()
- {
- rtl::OString aStr1 = "Line must be equal.";
- rtl_str_compare( aStr1.getStr(), NULL);
- }
- void compare_001()
- {
- rtl::OString aStr1 = "";
- rtl::OString aStr2 = "";
-
- sal_Int32 nValue = rtl_str_compare( aStr1.getStr(), aStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void compare_002()
- {
- rtl::OString aStr1 = "Line must be equal.";
- rtl::OString aStr2 = "Line must be equal.";
-
- sal_Int32 nValue = rtl_str_compare( aStr1.getStr(), aStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void compare_003()
- {
- rtl::OString aStr1 = "Line must differ.";
- rtl::OString aStr2 = "Line foo bar, ok, differ.";
-
- sal_Int32 nValue = rtl_str_compare( aStr1.getStr(), aStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings differ.", nValue != 0);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(compare);
- CPPUNIT_TEST(compare_000);
- CPPUNIT_TEST(compare_000_1);
- CPPUNIT_TEST(compare_001);
- CPPUNIT_TEST(compare_002);
- CPPUNIT_TEST(compare_003);
- CPPUNIT_TEST_SUITE_END();
-}; // class compare
-
-
- class compareIgnoreAsciiCase : public CppUnit::TestFixture
- {
- public:
-
- void compare_000()
- {
- rtl_str_compareIgnoreAsciiCase( NULL, NULL);
- }
-
- void compare_000_1()
- {
- rtl::OString aStr1 = "Line must be equal.";
- rtl_str_compareIgnoreAsciiCase( aStr1.getStr(), NULL);
- }
- void compare_001()
- {
- rtl::OString aStr1 = "";
- rtl::OString aStr2 = "";
-
- sal_Int32 nValue = rtl_str_compareIgnoreAsciiCase( aStr1.getStr(), aStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void compare_002()
- {
- rtl::OString aStr1 = "Line must be equal.";
- rtl::OString aStr2 = "Line must be equal.";
-
- sal_Int32 nValue = rtl_str_compareIgnoreAsciiCase( aStr1.getStr(), aStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void compare_002_1()
- {
- rtl::OString aStr1 = "Line must be equal.";
- rtl::OString aStr2 = "LINE MUST BE EQUAL.";
-
- sal_Int32 nValue = rtl_str_compareIgnoreAsciiCase( aStr1.getStr(), aStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal (if case insensitve).", nValue == 0);
- }
-
- void compare_003()
- {
- rtl::OString aStr1 = "Line must differ.";
- rtl::OString aStr2 = "Line foo bar, ok, differ.";
-
- sal_Int32 nValue = rtl_str_compareIgnoreAsciiCase( aStr1.getStr(), aStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings differ.", nValue != 0);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(compareIgnoreAsciiCase);
- CPPUNIT_TEST(compare_000);
- CPPUNIT_TEST(compare_000_1);
- CPPUNIT_TEST(compare_001);
- CPPUNIT_TEST(compare_002);
- CPPUNIT_TEST(compare_002_1);
- CPPUNIT_TEST(compare_003);
- CPPUNIT_TEST_SUITE_END();
- }; // class compareIgnoreAsciiCase
-
-// -----------------------------------------------------------------------------
-
- class shortenedCompareIgnoreAsciiCase_WithLength : public CppUnit::TestFixture
- {
- public:
-
- void compare_000()
- {
- rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( NULL, 0, NULL, 0, 0);
- }
-
- void compare_000_1()
- {
- rtl::OString aStr1 = "Line must be equal.";
- rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), aStr1.getLength(), NULL, 0, 1);
- }
- void compare_001()
- {
- rtl::OString aStr1 = "";
- rtl::OString aStr2 = "";
-
- sal_Int32 nValue = rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), aStr1.getLength(), aStr2.getStr(), aStr2.getLength(), aStr1.getLength());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void compare_002()
- {
- rtl::OString aStr1 = "Line must be equal.";
- rtl::OString aStr2 = "Line must be equal.";
-
- sal_Int32 nValue = rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), aStr1.getLength(),
- aStr2.getStr(), aStr2.getLength(),
- aStr1.getLength());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void compare_002_1()
- {
- rtl::OString aStr1 = "Line must be equal.";
- rtl::OString aStr2 = "LINE MUST BE EQUAL.";
-
- sal_Int32 nValue = rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), aStr1.getLength(),
- aStr2.getStr(), aStr2.getLength(),
- aStr1.getLength());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal (if case insensitve).", nValue == 0);
- }
-
- void compare_003()
- {
- rtl::OString aStr1 = "Line must differ.";
- rtl::OString aStr2 = "Line foo bar, ok, differ.";
-
- sal_Int32 nValue = rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), aStr1.getLength(),
- aStr2.getStr(), aStr2.getLength(),
- 5);
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal first 5 characters.", nValue == 0);
- }
-
- void compare_004()
- {
- rtl::OString aStr1 = "Line must differ.";
- rtl::OString aStr2 = "Line foo bar, ok, differ.";
-
- sal_Int32 nValue = rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), aStr1.getLength(),
- aStr2.getStr(), aStr2.getLength(),
- aStr1.getLength());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings differ.", nValue != 0);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(shortenedCompareIgnoreAsciiCase_WithLength);
- CPPUNIT_TEST(compare_000);
- CPPUNIT_TEST(compare_000_1);
- CPPUNIT_TEST(compare_001);
- CPPUNIT_TEST(compare_002);
- CPPUNIT_TEST(compare_002_1);
- CPPUNIT_TEST(compare_003);
- CPPUNIT_TEST(compare_004);
- CPPUNIT_TEST_SUITE_END();
-}; // class compare
-
-
-// -----------------------------------------------------------------------------
-
- class hashCode : public CppUnit::TestFixture
- {
- public:
-
- void hashCode_000()
- {
- rtl_str_hashCode( NULL );
- }
-
- void hashCode_001()
- {
- rtl::OString aStr1 = "Line for a hashCode.";
- sal_Int32 nHashCode = rtl_str_hashCode( aStr1.getStr() );
- printf("hashcode: %d\n", nHashCode);
- // CPPUNIT_ASSERT_MESSAGE("failed.", nValue == 0);
- }
-
- void hashCode_002()
- {
- rtl::OString aStr1 = "Line for a hashCode.";
- sal_Int32 nHashCode1 = rtl_str_hashCode( aStr1.getStr() );
-
- rtl::OString aStr2 = "Line for a hashCode.";
- sal_Int32 nHashCode2 = rtl_str_hashCode( aStr2.getStr() );
-
- CPPUNIT_ASSERT_MESSAGE("hashcodes must be equal.", nHashCode1 == nHashCode2 );
- }
-
- void hashCode_003()
- {
- rtl::OString aStr1 = "Line for a hashCode.";
- sal_Int32 nHashCode1 = rtl_str_hashCode( aStr1.getStr() );
-
- rtl::OString aStr2 = "Line for an other hashcode.";
- sal_Int32 nHashCode2 = rtl_str_hashCode( aStr2.getStr() );
-
- CPPUNIT_ASSERT_MESSAGE("hashcodes must differ.", nHashCode1 != nHashCode2 );
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(hashCode);
- CPPUNIT_TEST(hashCode_000);
- CPPUNIT_TEST(hashCode_001);
- CPPUNIT_TEST(hashCode_002);
- CPPUNIT_TEST(hashCode_003);
- CPPUNIT_TEST_SUITE_END();
- }; // class compare
-
-
-// -----------------------------------------------------------------------------
-
- class indexOfChar : public CppUnit::TestFixture
- {
- public:
-
- void indexOfChar_000()
- {
- rtl_str_indexOfChar( NULL, 0 );
- }
-
- void indexOfChar_001()
- {
- rtl::OString aStr1 = "Line for a indexOfChar.";
-
- sal_Int32 nIndex = rtl_str_indexOfChar( aStr1.getStr(), 'L' );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 0);
-
- /* sal_Int32 */ nIndex = rtl_str_indexOfChar( aStr1.getStr(), 'i' );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 1);
-
- /* sal_Int32 */ nIndex = rtl_str_indexOfChar( aStr1.getStr(), 'n' );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 2);
-
- /* sal_Int32 */ nIndex = rtl_str_indexOfChar( aStr1.getStr(), 'e' );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 3);
- }
-
- void indexOfChar_002()
- {
- rtl::OString aStr1 = "Line for a indexOfChar.";
- sal_Int32 nIndex = rtl_str_indexOfChar( aStr1.getStr(), 'y' );
-
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == -1 );
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(indexOfChar);
- CPPUNIT_TEST(indexOfChar_000);
- CPPUNIT_TEST(indexOfChar_001);
- CPPUNIT_TEST(indexOfChar_002);
- CPPUNIT_TEST_SUITE_END();
- }; // class compare
-
-// -----------------------------------------------------------------------------
- class lastIndexOfChar : public CppUnit::TestFixture
- {
- public:
-
- void lastIndexOfChar_000()
- {
- rtl_str_lastIndexOfChar( NULL, 0 );
- }
-
- void lastIndexOfChar_001()
- {
- rtl::OString aStr1 = "Line for a lastIndexOfChar.";
-
- sal_Int32 nIndex = rtl_str_lastIndexOfChar( aStr1.getStr(), 'C' );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 22);
-
- /* sal_Int32 */ nIndex = rtl_str_lastIndexOfChar( aStr1.getStr(), 'h' );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 23);
-
- /* sal_Int32 */ nIndex = rtl_str_lastIndexOfChar( aStr1.getStr(), 'a' );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 24);
-
- /* sal_Int32 */ nIndex = rtl_str_lastIndexOfChar( aStr1.getStr(), 'r' );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 25);
- }
-
- void lastIndexOfChar_002()
- {
- rtl::OString aStr1 = "Line for a lastIndexOfChar.";
- sal_Int32 nIndex = rtl_str_lastIndexOfChar( aStr1.getStr(), 'y' );
-
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == -1 );
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(lastIndexOfChar);
- CPPUNIT_TEST(lastIndexOfChar_000);
- CPPUNIT_TEST(lastIndexOfChar_001);
- CPPUNIT_TEST(lastIndexOfChar_002);
- CPPUNIT_TEST_SUITE_END();
- }; // class lastIndexOfChar
-
-
-// -----------------------------------------------------------------------------
-
- class indexOfStr : public CppUnit::TestFixture
- {
- public:
-
- void indexOfStr_000()
- {
- rtl_str_indexOfStr( NULL, 0 );
- }
-
- void indexOfStr_000_1()
- {
- rtl::OString aStr1 = "Line for a indexOfStr.";
- rtl_str_indexOfStr( aStr1.getStr(), 0 );
- }
-
- void indexOfStr_001()
- {
- rtl::OString aStr1 = "Line for a indexOfStr.";
-
- sal_Int32 nIndex = rtl_str_indexOfStr( aStr1.getStr(), "Line" );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 0);
-
- /* sal_Int32 */ nIndex = rtl_str_indexOfStr( aStr1.getStr(), "for" );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 5);
-
- /* sal_Int32 */ nIndex = rtl_str_indexOfStr( aStr1.getStr(), "a" );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 9);
-
- /* sal_Int32 */ nIndex = rtl_str_indexOfStr( aStr1.getStr(), "a index" );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex ==9);
- }
-
- void indexOfStr_002()
- {
- rtl::OString aStr1 = "Line for a indexOfStr.";
- sal_Int32 nIndex = rtl_str_indexOfStr( aStr1.getStr(), "not exist" );
-
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == -1 );
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(indexOfStr);
- CPPUNIT_TEST(indexOfStr_000);
- CPPUNIT_TEST(indexOfStr_001);
- CPPUNIT_TEST(indexOfStr_002);
- CPPUNIT_TEST_SUITE_END();
- }; // class compare
-// -----------------------------------------------------------------------------
-
-
- class lastIndexOfStr : public CppUnit::TestFixture
- {
- public:
-
- void lastIndexOfStr_000()
- {
- rtl_str_lastIndexOfStr( NULL, NULL );
- }
-
- void lastIndexOfStr_000_1()
- {
- rtl::OString aStr1 = "Line for a lastIndexOfStr.";
- rtl_str_lastIndexOfStr( aStr1.getStr(), NULL );
- }
-
- void lastIndexOfStr_001()
- {
- rtl::OString aStr1 = "Line for a lastIndexOfStr.";
- rtl::OString aSearchStr = "Index";
-
- sal_Int32 nIndex = rtl_str_lastIndexOfStr( aStr1.getStr(), aSearchStr.getStr() );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 15);
-
- /* rtl::OString */ aSearchStr = "Line";
- /* sal_Int32 */ nIndex = rtl_str_lastIndexOfStr( aStr1.getStr(), aSearchStr.getStr() );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 0);
-
- /* rtl::OString */ aSearchStr = "";
- /* sal_Int32 */ nIndex = rtl_str_lastIndexOfStr( aStr1.getStr(), aSearchStr.getStr() );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == -1);
- }
-
- void lastIndexOfStr_002()
- {
- rtl::OString aStr1 = "Line for a lastIndexOfStr.";
- rtl::OString aSearchStr = "foo";
- sal_Int32 nIndex = rtl_str_lastIndexOfStr( aStr1.getStr(), aSearchStr.getStr() );
-
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == -1 );
- }
-
- void lastIndexOfStr_003()
- {
- rtl::OString aStr1 = "Line for a lastIndexOfStr.";
- rtl::OString aSearchStr = "O";
- sal_Int32 nIndex = rtl_str_lastIndexOfStr( aStr1.getStr(), aSearchStr.getStr() );
-
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 20 );
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(lastIndexOfStr);
- CPPUNIT_TEST(lastIndexOfStr_000);
- CPPUNIT_TEST(lastIndexOfStr_001);
- CPPUNIT_TEST(lastIndexOfStr_002);
- CPPUNIT_TEST(lastIndexOfStr_003);
- CPPUNIT_TEST_SUITE_END();
- }; // class lastIndexOfStr
-
-// -----------------------------------------------------------------------------
-
- class replaceChar : public CppUnit::TestFixture
- {
- public:
-
- void replaceChar_000()
- {
- rtl_str_replaceChar( NULL, 0, 0 );
- }
-
- void replaceChar_001()
- {
- rtl::OString aStr1 = "replace char.";
- rtl::OString aShouldStr1 = "ruplacu char.";
-
- sal_Char* pStr = (sal_Char*) malloc(aStr1.getLength() + 1);
- CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
- strcpy(pStr, aStr1.getStr());
-
- rtl_str_replaceChar( pStr, 'e', 'u' );
-
- CPPUNIT_ASSERT_MESSAGE("replace failed", aShouldStr1.equals(rtl::OString(pStr)) == sal_True);
- free(pStr);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(replaceChar);
- CPPUNIT_TEST(replaceChar_000);
- CPPUNIT_TEST(replaceChar_001);
- CPPUNIT_TEST_SUITE_END();
- }; // class replaceChar
-
-// -----------------------------------------------------------------------------
-
- class replaceChar_WithLength : public CppUnit::TestFixture
- {
- public:
-
- void replaceChar_WithLength_000()
- {
- rtl_str_replaceChar_WithLength( NULL, 0, 0, 0 );
- }
-
- void replaceChar_WithLength_000_1()
- {
- rtl_str_replaceChar_WithLength( NULL, 1, 0, 0 );
- }
- void replaceChar_WithLength_001()
- {
- rtl::OString aStr1 = "replace char.";
- rtl::OString aShouldStr1 = "ruplace char.";
-
- sal_Char* pStr = (sal_Char*) malloc(aStr1.getLength() + 1);
- CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
- strcpy(pStr, aStr1.getStr());
-
- rtl_str_replaceChar_WithLength( pStr, 6, 'e', 'u' );
-
- CPPUNIT_ASSERT_MESSAGE("replace failed", aShouldStr1.equals(rtl::OString(pStr)) == sal_True);
- free(pStr);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(replaceChar_WithLength);
- CPPUNIT_TEST(replaceChar_WithLength_000);
- CPPUNIT_TEST(replaceChar_WithLength_000_1);
- CPPUNIT_TEST(replaceChar_WithLength_001);
- CPPUNIT_TEST_SUITE_END();
- }; // class replaceChar
-
-
-// -----------------------------------------------------------------------------
-
- class toAsciiLowerCase : public CppUnit::TestFixture
- {
- public:
-
- void toAsciiLowerCase_000()
- {
- rtl_str_toAsciiLowerCase( NULL );
- }
-
- void toAsciiLowerCase_001()
- {
- rtl::OString aStr1 = "CHANGE THIS TO ASCII LOWER CASE.";
- rtl::OString aShouldStr1 = "change this to ascii lower case.";
-
- sal_Char* pStr = (sal_Char*) malloc(aStr1.getLength() + 1);
- CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
- strcpy(pStr, aStr1.getStr());
-
- rtl_str_toAsciiLowerCase( pStr );
-
- CPPUNIT_ASSERT_MESSAGE("failed", aShouldStr1.equals(rtl::OString(pStr)) == sal_True);
- free(pStr);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(toAsciiLowerCase);
- CPPUNIT_TEST(toAsciiLowerCase_000);
- CPPUNIT_TEST(toAsciiLowerCase_001);
- CPPUNIT_TEST_SUITE_END();
- }; // class replaceChar
-
-
- class toAsciiLowerCase_WithLength : public CppUnit::TestFixture
- {
- public:
-
- void toAsciiLowerCase_WithLength_000()
- {
- rtl_str_toAsciiLowerCase_WithLength( NULL, 0 );
- }
-
- void toAsciiLowerCase_WithLength_001()
- {
- rtl::OString aStr1 = "CHANGE THIS TO ASCII LOWER CASE.";
- rtl::OString aShouldStr1 = "change thiS TO ASCII LOWER CASE.";
-
- sal_Char* pStr = (sal_Char*) malloc(aStr1.getLength() + 1);
- CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
- strcpy(pStr, aStr1.getStr());
-
- rtl_str_toAsciiLowerCase_WithLength( pStr, 10 );
-
- printf("Lowercase with length: '%s'\n", pStr);
- CPPUNIT_ASSERT_MESSAGE("failed", aShouldStr1.equals(rtl::OString(pStr)) == sal_True);
- free(pStr);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(toAsciiLowerCase_WithLength);
- CPPUNIT_TEST(toAsciiLowerCase_WithLength_000);
- CPPUNIT_TEST(toAsciiLowerCase_WithLength_001);
- CPPUNIT_TEST_SUITE_END();
- }; // class replaceChar
-
-// -----------------------------------------------------------------------------
-
- class toAsciiUpperCase : public CppUnit::TestFixture
- {
- public:
-
- void toAsciiUpperCase_000()
- {
- rtl_str_toAsciiUpperCase( NULL );
- }
-
- void toAsciiUpperCase_001()
- {
- rtl::OString aStr1 = "change this to ascii upper case.";
- rtl::OString aShouldStr1 = "CHANGE THIS TO ASCII UPPER CASE.";
-
- sal_Char* pStr = (sal_Char*) malloc(aStr1.getLength() + 1);
- CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
- strcpy(pStr, aStr1.getStr());
-
- rtl_str_toAsciiUpperCase( pStr );
-
- CPPUNIT_ASSERT_MESSAGE("failed", aShouldStr1.equals(rtl::OString(pStr)) == sal_True);
- free(pStr);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(toAsciiUpperCase);
- CPPUNIT_TEST(toAsciiUpperCase_000);
- CPPUNIT_TEST(toAsciiUpperCase_001);
- CPPUNIT_TEST_SUITE_END();
- }; // class replaceChar
-
-
- class toAsciiUpperCase_WithLength : public CppUnit::TestFixture
- {
- public:
-
- void toAsciiUpperCase_WithLength_000()
- {
- rtl_str_toAsciiUpperCase_WithLength( NULL, 0 );
- }
-
- void toAsciiUpperCase_WithLength_001()
- {
- rtl::OString aStr1 = "change this to ascii lower case.";
- rtl::OString aShouldStr1 = "CHANGE THIs to ascii lower case.";
-
- sal_Char* pStr = (sal_Char*) malloc(aStr1.getLength() + 1);
- CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
-
- strcpy(pStr, aStr1.getStr());
- rtl_str_toAsciiUpperCase_WithLength( pStr, 10 );
-
- printf("Uppercase with length: '%s'\n", aStr1.getStr());
- CPPUNIT_ASSERT_MESSAGE("failed", aShouldStr1.equals(rtl::OString(pStr)) == sal_True);
- free(pStr);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(toAsciiUpperCase_WithLength);
- CPPUNIT_TEST(toAsciiUpperCase_WithLength_000);
- CPPUNIT_TEST(toAsciiUpperCase_WithLength_001);
- CPPUNIT_TEST_SUITE_END();
- }; // class replaceChar
-
-
- // -----------------------------------------------------------------------------
-
- class trim_WithLength : public CppUnit::TestFixture
- {
- public:
- void trim_WithLength_000()
- {
- rtl_str_trim_WithLength(NULL, 0);
- // should not GPF
- }
-
- void trim_WithLength_000_1()
- {
- char pStr[] = { " trim this" };
- rtl_str_trim_WithLength( pStr, 0 );
- }
-
- void trim_WithLength_001()
- {
- char const *pStr = " trim this";
- sal_Char *pStr2 = (sal_Char*)malloc(strlen(pStr) + 1);
- if (pStr2)
- {
- strcpy(pStr2, pStr);
- rtl_str_trim_WithLength( pStr2, 2 );
-
- CPPUNIT_ASSERT_MESSAGE("string should be empty", strlen(pStr2) == 0);
- free(pStr2);
- }
- }
-
- void trim_WithLength_002()
- {
- char const *pStr = "trim this";
- sal_Char *pStr2 = (sal_Char*)malloc(strlen(pStr) + 1);
- if (pStr2)
- {
- strcpy(pStr2, pStr);
- rtl_str_trim_WithLength( pStr2, 5 );
-
- CPPUNIT_ASSERT_MESSAGE("string should contain 'trim'", strlen(pStr2) == 4);
- free(pStr2);
- }
- }
-
- void trim_WithLength_003()
- {
- char const *pStr = " trim this";
- sal_Char *pStr2 = (sal_Char*)malloc(strlen(pStr) + 1);
- if (pStr2)
- {
- strcpy(pStr2, pStr);
- rtl_str_trim_WithLength( pStr2, 11 );
-
- CPPUNIT_ASSERT_MESSAGE("string should contain 'trim'", strlen(pStr2) == 4);
- free(pStr2);
- }
- }
-
- void trim_WithLength_004()
- {
- char const *pStr = "\r\n\t \n\r trim \n this";
- sal_Char *pStr2 = (sal_Char*)malloc(strlen(pStr) + 1);
- if (pStr2)
- {
- strcpy(pStr2, pStr);
- rtl_str_trim_WithLength( pStr2, 17 );
-
- CPPUNIT_ASSERT_MESSAGE("string should contain 'trim'", strlen(pStr2) == 4);
- free(pStr2);
- }
- }
-
- void trim_WithLength_005()
- {
- char const *pStr = "\r\n\t \n\r trim \t this \n\r\t\t ";
- sal_Char *pStr2 = (sal_Char*)malloc(strlen(pStr) + 1);
- if (pStr2)
- {
- strcpy(pStr2, pStr);
- rtl_str_trim_WithLength( pStr2, strlen(pStr2) );
-
- CPPUNIT_ASSERT_MESSAGE("string should contain 'trim'", strlen(pStr2) == 11);
- free(pStr2);
- }
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(trim_WithLength);
- CPPUNIT_TEST(trim_WithLength_000);
- CPPUNIT_TEST(trim_WithLength_000_1);
- CPPUNIT_TEST(trim_WithLength_001);
- CPPUNIT_TEST(trim_WithLength_002);
- CPPUNIT_TEST(trim_WithLength_003);
- CPPUNIT_TEST(trim_WithLength_004);
- CPPUNIT_TEST(trim_WithLength_005);
- CPPUNIT_TEST_SUITE_END();
- };
-
- // -----------------------------------------------------------------------------
-
- class valueOfChar : public CppUnit::TestFixture
- {
- public:
- void valueOfChar_000()
- {
- rtl_str_valueOfChar(NULL, 0);
- // should not GPF
- }
- void valueOfChar_001()
- {
- sal_Char *pStr = (sal_Char*)malloc(RTL_STR_MAX_VALUEOFCHAR);
- if (pStr)
- {
- rtl_str_valueOfChar(pStr, 'A');
-
- CPPUNIT_ASSERT_MESSAGE("string should contain 'A'", pStr[0] == 'A');
- free(pStr);
- }
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(valueOfChar);
- CPPUNIT_TEST(valueOfChar_000);
- CPPUNIT_TEST(valueOfChar_001);
- CPPUNIT_TEST_SUITE_END();
- };
-
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::compare);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::compareIgnoreAsciiCase);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::shortenedCompareIgnoreAsciiCase_WithLength);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::hashCode);
-
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::indexOfChar);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::lastIndexOfChar);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::indexOfStr);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::lastIndexOfStr);
-
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::replaceChar);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::replaceChar_WithLength);
-
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::toAsciiLowerCase);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::toAsciiLowerCase_WithLength);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::toAsciiUpperCase);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::toAsciiUpperCase_WithLength);
-
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::trim_WithLength);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::valueOfChar);
-
-} // namespace rtl_str
-
-// -----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-CPPUNIT_PLUGIN_IMPLEMENT();
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/ostring/rtl_str.xsce b/sal/qa/rtl/ostring/rtl_str.xsce
deleted file mode 100644
index e7a624ae2..000000000
--- a/sal/qa/rtl/ostring/rtl_str.xsce
+++ /dev/null
@@ -1,26 +0,0 @@
-# signaled with SIGNAL 11
-rtl_str.compare.compare_000
-rtl_str.compare.compare_000_1
-
-rtl_str.compareIgnoreAsciiCase.compare_000
-rtl_str.compareIgnoreAsciiCase.compare_000_1
-
-rtl_str.hashCode.hashCode_000
-
-rtl_str.indexOfChar.indexOfChar_000
-
-rtl_str.lastIndexOfChar.lastIndexOfChar_000
-
-rtl_str.indexOfStr.indexOfStr_000
-
-rtl_str.lastIndexOfStr.lastIndexOfStr_000
-
-rtl_str.replaceChar.replaceChar_000
-
-rtl_str.replaceChar_WithLength.replaceChar_WithLength_000_1
-
-rtl_str.toAsciiLowerCase.toAsciiLowerCase_000
-
-rtl_str.toAsciiUpperCase.toAsciiUpperCase_000
-
-rtl_str.valueOfChar.valueOfChar_000
diff --git a/sal/qa/rtl/ostring/rtl_string.cxx b/sal/qa/rtl/ostring/rtl_string.cxx
deleted file mode 100644
index 06a5eea8e..000000000
--- a/sal/qa/rtl/ostring/rtl_string.cxx
+++ /dev/null
@@ -1,192 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
-
-#include <rtl/ustring.hxx>
-#include <cstring>
-
-namespace rtl_string
-{
-
- class getLength : public CppUnit::TestFixture
- {
- public:
-
- void getLength_000()
- {
- rtl_string_getLength( NULL );
- // should not GPF
- }
-
- void getLength_001()
- {
- rtl::OString aStr("Test Length.");
- sal_Int32 nValue = rtl_string_getLength( aStr.pData );
-
- CPPUNIT_ASSERT_MESSAGE("Length must equal getLength()", aStr.getLength() == nValue);
- CPPUNIT_ASSERT_MESSAGE(
- "Length must equal strlen()",
- nValue >= 0
- && (strlen(aStr.getStr())
- == sal::static_int_cast< sal_uInt32 >(nValue)));
- }
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(getLength);
- CPPUNIT_TEST(getLength_000);
- CPPUNIT_TEST(getLength_001);
- CPPUNIT_TEST_SUITE_END();
- }; // class getLength
-
-// -----------------------------------------------------------------------------
-
- class newFromString : public CppUnit::TestFixture
- {
- public:
-
- // void newFromString_000()
- // {
- // sal_Int32 nValue = rtl_string_newFromString( NULL, NULL );
- // // should not GPF
- // }
-
- void newFromString_001()
- {
- rtl::OString aStr("Test Length.");
- rtl_String *pStr = NULL;
-
- rtl_string_newFromString( &pStr, aStr.pData );
-
- rtl::OString aNewStr(pStr);
- CPPUNIT_ASSERT_MESSAGE("Strings must be equal", aStr.equals(aNewStr) == sal_True);
-
- rtl_string_release(pStr);
- }
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(newFromString);
- // CPPUNIT_TEST(newFromString_000);
- CPPUNIT_TEST(newFromString_001);
- CPPUNIT_TEST_SUITE_END();
- }; // class newFromString
-
- // -----------------------------------------------------------------------------
-
- class convertUStringToString : public CppUnit::TestFixture
- {
- public:
-
- // void newFromString_000()
- // {
- // sal_Int32 nValue = rtl_string_newFromString( NULL, NULL );
- // // should not GPF
- // }
-
- void convertUStringToString_001()
- {
- rtl::OUString suString(RTL_CONSTASCII_USTRINGPARAM("Hello"));
- rtl::OString sString;
- sal_Bool bRet = rtl_convertUStringToString(&sString.pData, suString.getStr(), suString.getLength(), RTL_TEXTENCODING_ASCII_US, OUSTRING_TO_OSTRING_CVTFLAGS);
-
- CPPUNIT_ASSERT_MESSAGE("Strings must be equal", bRet == sal_True && sString.equals(rtl::OString("Hello")) == sal_True);
- }
-
- void convertUStringToString_002()
- {
- rtl::OString sStr("H\xE4llo");
- rtl::OUString suString = rtl::OStringToOUString(sStr, RTL_TEXTENCODING_ISO_8859_15);
-
- rtl::OString sString;
- sal_Bool bRet = rtl_convertUStringToString(&sString.pData, suString.getStr(), suString.getLength(), RTL_TEXTENCODING_ISO_8859_15, OUSTRING_TO_OSTRING_CVTFLAGS);
-
- CPPUNIT_ASSERT_MESSAGE("Strings must be equal", bRet == sal_True && sString.equals(rtl::OString("H\xE4llo")) == sal_True);
- }
-
- void convertUStringToString_003()
- {
- rtl::OString sStr("H\xC3\xA4llo");
- rtl::OUString suString = rtl::OStringToOUString(sStr, RTL_TEXTENCODING_UTF8);
-
- rtl::OString sString;
- sal_Bool bRet = rtl_convertUStringToString(&sString.pData, suString.getStr(), suString.getLength(), RTL_TEXTENCODING_ISO_8859_15, OUSTRING_TO_OSTRING_CVTFLAGS);
-
- CPPUNIT_ASSERT_MESSAGE("Strings must be equal", bRet == sal_True && sString.equals(rtl::OString("H\xE4llo")) == sal_True);
- }
-
- void convertUStringToString_004()
- {
- rtl::OString sStr("Tsch\xFC\xDF");
- rtl::OUString suString = rtl::OStringToOUString(sStr, RTL_TEXTENCODING_ISO_8859_15);
- rtl::OString sString;
-
- sal_Bool bRet = rtl_convertUStringToString(&sString.pData, suString.getStr(), suString.getLength(), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS);
- /* sal_Bool */ bRet = rtl_convertUStringToString(&sString.pData, suString.getStr(), suString.getLength(), RTL_TEXTENCODING_ISO_8859_15, OUSTRING_TO_OSTRING_CVTFLAGS);
- CPPUNIT_ASSERT_MESSAGE("Strings must be equal", bRet == sal_True && sString.equals(rtl::OString("Tsch\xFC\xDF")) == sal_True);
- }
-
-
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(convertUStringToString);
- CPPUNIT_TEST(convertUStringToString_001);
- CPPUNIT_TEST(convertUStringToString_002);
- CPPUNIT_TEST(convertUStringToString_003);
- CPPUNIT_TEST(convertUStringToString_004);
- CPPUNIT_TEST_SUITE_END();
- }; // class convertUStringToString
-
-
-
-} // namespace rtl_string
-
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_string::getLength);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_string::newFromString);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_string::convertUStringToString);
-
-// -----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-CPPUNIT_PLUGIN_IMPLEMENT();
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/ostring/rtl_string.xsce b/sal/qa/rtl/ostring/rtl_string.xsce
deleted file mode 100644
index 0e37ab00b..000000000
--- a/sal/qa/rtl/ostring/rtl_string.xsce
+++ /dev/null
@@ -1 +0,0 @@
-rtl_string.getLength.getLength_000
diff --git a/sal/qa/rtl/oustring/joblist.txt b/sal/qa/rtl/oustring/joblist.txt
deleted file mode 100644
index 5d52da1e3..000000000
--- a/sal/qa/rtl/oustring/joblist.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-# JobFile for rtl_OUString
-# header source sal/inc/rtl/ustring.hxx
-
-rtl_OUString.valueOf.valueOf_double_001
-rtl_OUString.valueOf.valueOf_double_002
-rtl_OUString.valueOf.valueOf_double_003
-rtl_OUString.valueOf.valueOf_double_004
-rtl_OUString.valueOf.valueOf_double_005
-rtl_OUString.valueOf.valueOf_double_006
-rtl_OUString.valueOf.valueOf_double_007
diff --git a/sal/qa/rtl/oustring/makefile.mk b/sal/qa/rtl/oustring/makefile.mk
deleted file mode 100644
index b84860357..000000000
--- a/sal/qa/rtl/oustring/makefile.mk
+++ /dev/null
@@ -1,81 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-INCPRE+= $(PRJ)$/qa$/inc
-
-PRJNAME=sal
-TARGET=rtl_oustring2
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
-
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-
-# BEGIN ----------------------------------------------------------------
-# auto generated Target:joblist by codegen.pl
-SHL1OBJS= \
- $(SLO)$/rtl_OUString2.obj
-
-SHL1TARGET= rtl_OUString2
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-# SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME =$(SHL1TARGET)
-# DEF1EXPORTFILE= export.exp
-SHL1VERSIONMAP= $(PRJ)$/qa$/export.map
-# auto generated Target:joblist
-# END ------------------------------------------------------------------
-
-# BEGIN ----------------------------------------------------------------
-SHL2OBJS= \
- $(SLO)$/rtl_ustr.obj
-
-SHL2TARGET= rtl_ustr
-SHL2STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL2IMPLIB= i$(SHL2TARGET)
-DEF2NAME =$(SHL2TARGET)
-SHL2VERSIONMAP= $(PRJ)$/qa$/export.map
-# END ------------------------------------------------------------------
-
-#------------------------------- All object files -------------------------------
-# do this here, so we get right dependencies
-# SLOFILES=$(SHL1OBJS)
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/oustring/rtl_OUString2.cxx b/sal/qa/rtl/oustring/rtl_OUString2.cxx
deleted file mode 100644
index b81cd0f57..000000000
--- a/sal/qa/rtl/oustring/rtl_OUString2.cxx
+++ /dev/null
@@ -1,1283 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-// autogenerated file with codegen.pl
-
-#include <math.h>
-#include <stdio.h>
-
-#include <algorithm> // STL
-
-#include <testshl/simpleheader.hxx>
-#include "stringhelper.hxx"
-#include "valueequal.hxx"
-
-inline void printOUString( ::rtl::OUString const & _suStr )
-{
- rtl::OString aString;
-
- t_print( "OUString: " );
- aString = ::rtl::OUStringToOString( _suStr, RTL_TEXTENCODING_ASCII_US );
- t_print( "'%s'\n", aString.getStr( ) );
-}
-
-namespace rtl_OUString
-{
-
- class ctors_rtl_uString : public CppUnit::TestFixture
- {
-
- public:
- /// test of OUString(rtl_uString*)
- void ctors_001()
- {
- rtl::OUString *pStr = new rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("a String") );
-
- rtl::OUString aStrToTest(pStr->pData);
- delete pStr;
-
- // maybe here should we do something with current memory
- char* pBuffer = (char*) malloc(2 * 8);
- memset(pBuffer, 0, 2 * 8);
- free(pBuffer);
-
- sal_Bool bResult = aStrToTest.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("a String")));
- CPPUNIT_ASSERT_MESSAGE("String must not be empty", bResult == sal_True);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(ctors_rtl_uString);
- CPPUNIT_TEST(ctors_001);
- CPPUNIT_TEST_SUITE_END();
- };
-
-// -----------------------------------------------------------------------------
-class valueOf : public CppUnit::TestFixture
-{
- void valueOf_float_test_impl(float _nValue)
- {
- rtl::OUString suValue;
- suValue = rtl::OUString::valueOf( _nValue );
- rtl::OString sValue;
- sValue <<= suValue;
- t_print(T_VERBOSE, "nFloat := %.9f sValue := %s\n", _nValue, sValue.getStr());
-
- float nValueATOF = static_cast<float>(atof( sValue.getStr() ));
-
- bool bEqualResult = is_float_equal(_nValue, nValueATOF);
- CPPUNIT_ASSERT_MESSAGE("Values are not equal.", bEqualResult == true);
- }
-
- void valueOf_float_test(float _nValue)
- {
- valueOf_float_test_impl(_nValue);
-
- // test also the negative part.
- float nNegativeValue = -_nValue;
- valueOf_float_test_impl(nNegativeValue);
- }
-
-public:
- // insert your test code here.
- void valueOf_float_test_001()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
- float nValue = 3.0f;
- valueOf_float_test(nValue);
- }
-
- void valueOf_float_test_002()
- {
- float nValue = 3.5f;
- valueOf_float_test(nValue);
- }
-
- void valueOf_float_test_003()
- {
- float nValue = 3.0625f;
- valueOf_float_test(nValue);
- }
-
- void valueOf_float_test_004()
- {
- float nValue = 3.502525f;
- valueOf_float_test(nValue);
- }
-
- void valueOf_float_test_005()
- {
- float nValue = 3.141592f;
- valueOf_float_test(nValue);
- }
-
- void valueOf_float_test_006()
- {
- float nValue = 3.5025255f;
- valueOf_float_test(nValue);
- }
-
- void valueOf_float_test_007()
- {
- float nValue = 3.0039062f;
- valueOf_float_test(nValue);
- }
-
-private:
-
- void valueOf_double_test_impl(double _nValue)
- {
- rtl::OUString suValue;
- suValue = rtl::OUString::valueOf( _nValue );
- rtl::OString sValue;
- sValue <<= suValue;
- t_print(T_VERBOSE, "nDouble := %.20f sValue := %s\n", _nValue, sValue.getStr());
-
- double nValueATOF = atof( sValue.getStr() );
-
- bool bEqualResult = is_double_equal(_nValue, nValueATOF);
- CPPUNIT_ASSERT_MESSAGE("Values are not equal.", bEqualResult == true);
- }
-
- void valueOf_double_test(double _nValue)
- {
- valueOf_double_test_impl(_nValue);
-
- // test also the negative part.
- double nNegativeValue = -_nValue;
- valueOf_double_test_impl(nNegativeValue);
- }
-public:
-
- // valueOf double
- void valueOf_double_test_001()
- {
- double nValue = 3.0;
- valueOf_double_test(nValue);
- }
- void valueOf_double_test_002()
- {
- double nValue = 3.5;
- valueOf_double_test(nValue);
- }
- void valueOf_double_test_003()
- {
- double nValue = 3.0625;
- valueOf_double_test(nValue);
- }
- void valueOf_double_test_004()
- {
- double nValue = 3.1415926535;
- valueOf_double_test(nValue);
- }
- void valueOf_double_test_005()
- {
- double nValue = 3.141592653589793;
- valueOf_double_test(nValue);
- }
- void valueOf_double_test_006()
- {
- double nValue = 3.1415926535897932;
- valueOf_double_test(nValue);
- }
- void valueOf_double_test_007()
- {
- double nValue = 3.14159265358979323;
- valueOf_double_test(nValue);
- }
- void valueOf_double_test_008()
- {
- double nValue = 3.141592653589793238462643;
- valueOf_double_test(nValue);
- }
-
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(valueOf);
- CPPUNIT_TEST(valueOf_float_test_001);
- CPPUNIT_TEST(valueOf_float_test_002);
- CPPUNIT_TEST(valueOf_float_test_003);
- CPPUNIT_TEST(valueOf_float_test_004);
- CPPUNIT_TEST(valueOf_float_test_005);
- CPPUNIT_TEST(valueOf_float_test_006);
- CPPUNIT_TEST(valueOf_float_test_007);
-
- CPPUNIT_TEST(valueOf_double_test_001);
- CPPUNIT_TEST(valueOf_double_test_002);
- CPPUNIT_TEST(valueOf_double_test_003);
- CPPUNIT_TEST(valueOf_double_test_004);
- CPPUNIT_TEST(valueOf_double_test_005);
- CPPUNIT_TEST(valueOf_double_test_006);
- CPPUNIT_TEST(valueOf_double_test_007);
- CPPUNIT_TEST(valueOf_double_test_008);
- CPPUNIT_TEST_SUITE_END();
-}; // class valueOf
-
-//------------------------------------------------------------------------
-// testing the method toDouble()
-//------------------------------------------------------------------------
-template<class T>
-sal_Int16 SAL_CALL checkPrecisionSize()
-{
- // sal_Int16 nSize = sizeof(T);
- volatile T nCalcValue = 1.0;
-
-
- // (i + 1) is the current precision
- // numerical series
- // 1.1
- // 10.1
- // 100.1
- // ...
- // 1000...0.1
-
- sal_Int16 i = 0;
- for (i=0;i<50;i++)
- {
- nCalcValue *= 10;
- volatile T nValue = nCalcValue + static_cast<T>(0.1);
- volatile T dSub = nValue - nCalcValue;
- // ----- 0.11 ---- 0.1 ---- 0.09 -----
- if (0.11 > dSub && dSub < 0.09)
- {
- // due to the fact, that the value is break down we sub 1 from the precision value
- // but to suppress this, we start at zero, precision is i+1 till here --i;
- break;
- }
- }
-
- sal_Int16 j= 0;
- nCalcValue = 1.0;
-
- // numerical series
- // 1.1
- // 1.01
- // 1.001
- // ...
- // 1.000...001
-
- for (j=0;j<50;j++)
- {
- nCalcValue /= 10;
- volatile T nValue = nCalcValue + static_cast<T>(1.0);
- volatile T dSub = nValue - static_cast<T>(1.0);
- // ---- 0.02 ----- 0.01 ---- 0 --- -0.99 ---- -0.98 ----
- // volatile T dSubAbsolut = fabs(dSub);
- // ---- 0.02 ----- 0.01 ---- 0 (cut)
- if ( dSub == 0)
- break;
- }
- if (i != j)
- {
- // hmmm....
- // imho i +- 1 == j is a good value
- int n = i - j;
- if (n < 0) n = -n;
- if (n <= 1)
- {
- return std::min(i,j);
- }
- else
- {
- t_print("warning: presision differs more than 1!\n");
- }
- }
-
- return i;
-}
-
-// -----------------------------------------------------------------------------
-
- class testPrecision
- {
- public:
- testPrecision()
- {
- sal_Int16 nPrecision;
- nPrecision = checkPrecisionSize<float>();
- t_print("precision of float: %d sizeof()=%d \n", nPrecision, sizeof(float));
-
- nPrecision = checkPrecisionSize<double>();
- t_print("precision of double: %d sizeof()=%d \n", nPrecision, sizeof(double));
-
- nPrecision = checkPrecisionSize<long double>();
- t_print("precision of long double: %d sizeof()=%d \n", nPrecision, sizeof(long double));
-
- }
-
- };
-
- class toInt: public CppUnit::TestFixture {
- public:
- void test() {
- CPPUNIT_ASSERT_EQUAL(
- static_cast< sal_Int32 >(-0x76543210),
- (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-76543210")).
- toInt32(16)));
- CPPUNIT_ASSERT_EQUAL(
- static_cast< sal_Int32 >(0xFEDCBA98),
- (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("+FEDCBA98")).
- toInt32(16)));
- CPPUNIT_ASSERT_EQUAL(
- static_cast< sal_Int64 >(-SAL_CONST_INT64(0x76543210FEDCBA98)),
- (rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("-76543210FEDCBA98")).
- toInt64(16)));
- CPPUNIT_ASSERT_EQUAL(
- static_cast< sal_Int64 >(SAL_CONST_INT64(0xFEDCBA9876543210)),
- (rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("+FEDCBA9876543210")).
- toInt64(16)));
- }
-
- CPPUNIT_TEST_SUITE(toInt);
- CPPUNIT_TEST(test);
- CPPUNIT_TEST_SUITE_END();
- };
-
-// -----------------------------------------------------------------------------
-// - toDouble (tests)
-// -----------------------------------------------------------------------------
- class toDouble : public CppUnit::TestFixture
- {
- public:
- void toDouble_test_impl(rtl::OString const& _sValue)
- {
- //t_print("the original str is %s\n", _sValue.getStr());
- double nValueATOF = atof( _sValue.getStr() );
- //t_print("original data is %e\n", nValueATOF);
- rtl::OUString suValue = rtl::OUString::createFromAscii( _sValue.getStr() );
- double nValueToDouble = suValue.toDouble();
- //t_print("result data is %e\n", nValueToDouble);
-
- bool bEqualResult = is_double_equal(nValueToDouble, nValueATOF);
- CPPUNIT_ASSERT_MESSAGE("Values are not equal.", bEqualResult == true);
- }
-
- void toDouble_test(rtl::OString const& _sValue)
- {
- toDouble_test_impl(_sValue);
-
- // test also the negativ part.
- rtl::OString sNegativValue("-");
- sNegativValue += _sValue;
- toDouble_test_impl(sNegativValue);
- }
-
- // insert your test code here.
- void toDouble_selftest()
- {
- t_print("Start selftest:\n");
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.01) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.001) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.0001) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.00001) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.000001) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.0000001) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.00000001) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.000000001) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.0000000001) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.00000000001) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.000000000001) == false);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.0000000000001) == false);
- // we check til 15 values after comma
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.00000000000001) == true);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.000000000000001) == true);
- CPPUNIT_ASSERT (is_double_equal(1.0, 1.0000000000000001) == true);
- t_print("Selftest done.\n");
- }
-
- void toDouble_test_3()
- {
- rtl::OString sValue("3");
- toDouble_test(sValue);
- }
- void toDouble_test_3_5()
- {
- rtl::OString sValue("3.5");
- toDouble_test(sValue);
- }
- void toDouble_test_3_0625()
- {
- rtl::OString sValue("3.0625");
- toDouble_test(sValue);
- }
- void toDouble_test_pi()
- {
- // value from http://www.angio.net/pi/digits/50.txt
- rtl::OString sValue("3.141592653589793238462643383279502884197169399375");
- toDouble_test(sValue);
- }
-
- void toDouble_test_1()
- {
- rtl::OString sValue("1");
- toDouble_test(sValue);
- }
- void toDouble_test_10()
- {
- rtl::OString sValue("10");
- toDouble_test(sValue);
- }
- void toDouble_test_100()
- {
- rtl::OString sValue("100");
- toDouble_test(sValue);
- }
- void toDouble_test_1000()
- {
- rtl::OString sValue("1000");
- toDouble_test(sValue);
- }
- void toDouble_test_10000()
- {
- rtl::OString sValue("10000");
- toDouble_test(sValue);
- }
- void toDouble_test_1e99()
- {
- rtl::OString sValue("1e99");
- toDouble_test(sValue);
- }
- void toDouble_test_1e_n99()
- {
- rtl::OString sValue("1e-99");
- toDouble_test(sValue);
- }
- void toDouble_test_1e308()
- {
- rtl::OString sValue("1e308");
- toDouble_test(sValue);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(toDouble);
- CPPUNIT_TEST(toDouble_selftest);
-
- CPPUNIT_TEST(toDouble_test_3);
- CPPUNIT_TEST(toDouble_test_3_5);
- CPPUNIT_TEST(toDouble_test_3_0625);
- CPPUNIT_TEST(toDouble_test_pi);
- CPPUNIT_TEST(toDouble_test_1);
- CPPUNIT_TEST(toDouble_test_10);
- CPPUNIT_TEST(toDouble_test_100);
- CPPUNIT_TEST(toDouble_test_1000);
- CPPUNIT_TEST(toDouble_test_10000);
- CPPUNIT_TEST(toDouble_test_1e99);
- CPPUNIT_TEST(toDouble_test_1e_n99);
- CPPUNIT_TEST(toDouble_test_1e308);
- CPPUNIT_TEST_SUITE_END();
- }; // class toDouble
-
-// -----------------------------------------------------------------------------
-// - toFloat (tests)
-// -----------------------------------------------------------------------------
- class toFloat : public CppUnit::TestFixture
- {
- public:
- void toFloat_test_impl(rtl::OString const& _sValue)
- {
- //t_print("the original str is %s\n", _sValue.getStr());
- float nValueATOF = static_cast<float>(atof( _sValue.getStr() ));
- //t_print("the original str is %.10f\n", nValueATOF);
- rtl::OUString suValue = rtl::OUString::createFromAscii( _sValue.getStr() );
- float nValueToFloat = suValue.toFloat();
- //t_print("the result str is %.10f\n", nValueToFloat);
-
- bool bEqualResult = is_float_equal(nValueToFloat, nValueATOF);
- CPPUNIT_ASSERT_MESSAGE("Values are not equal.", bEqualResult == true);
- }
-
- void toFloat_test(rtl::OString const& _sValue)
- {
- toFloat_test_impl(_sValue);
-
- // test also the negativ part.
- rtl::OString sNegativValue("-");
- sNegativValue += _sValue;
- toFloat_test_impl(sNegativValue);
- }
-
- // insert your test code here.
- void toFloat_selftest()
- {
- t_print("Start selftest:\n");
- CPPUNIT_ASSERT (is_float_equal(1.0f, 1.01f) == false);
- CPPUNIT_ASSERT (is_float_equal(1.0f, 1.001f) == false);
- CPPUNIT_ASSERT (is_float_equal(1.0f, 1.0001f) == false);
- CPPUNIT_ASSERT (is_float_equal(1.0f, 1.00001f) == false);
- CPPUNIT_ASSERT (is_float_equal(1.0f, 1.000002f) == false);
- CPPUNIT_ASSERT (is_float_equal(1.0f, 1.0000001f) == true);
- CPPUNIT_ASSERT (is_float_equal(1.0f, 1.00000001f) == true);
- CPPUNIT_ASSERT (is_float_equal(1.0f, 1.000000001f) == true);
-
- t_print("Selftest done.\n");
- }
-
- void toFloat_test_3()
- {
- rtl::OString sValue("3");
- toFloat_test(sValue);
- }
- void toFloat_test_3_5()
- {
- rtl::OString sValue("3.5");
- toFloat_test(sValue);
- }
- void toFloat_test_3_0625()
- {
- rtl::OString sValue("3.0625");
- toFloat_test(sValue);
- }
- void toFloat_test_3_0625_e()
- {
- rtl::OString sValue("3.0625e-4");
- toFloat_test(sValue);
- }
- void toFloat_test_pi()
- {
- // value from http://www.angio.net/pi/digits/50.txt
- rtl::OString sValue("3.141592653589793238462643383279502884197169399375");
- toFloat_test(sValue);
- }
-
- void toFloat_test_1()
- {
- rtl::OString sValue("1");
- toFloat_test(sValue);
- }
- void toFloat_test_10()
- {
- rtl::OString sValue("10");
- toFloat_test(sValue);
- }
- void toFloat_test_100()
- {
- rtl::OString sValue("100");
- toFloat_test(sValue);
- }
- void toFloat_test_1000()
- {
- rtl::OString sValue("1000");
- toFloat_test(sValue);
- }
- void toFloat_test_10000()
- {
- rtl::OString sValue("10000");
- toFloat_test(sValue);
- }
- void toFloat_test_mix()
- {
- rtl::OString sValue("456789321455.123456789012");
- toFloat_test(sValue);
- }
- void toFloat_test_1e99()
- {
- rtl::OString sValue("1e99");
- toFloat_test(sValue);
- }
- void toFloat_test_1e_n99()
- {
- rtl::OString sValue("1e-9");
- toFloat_test(sValue);
- }
- void toFloat_test_1e308()
- {
- rtl::OString sValue("1e308");
- toFloat_test(sValue);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(toFloat);
- CPPUNIT_TEST(toFloat_selftest);
-
- CPPUNIT_TEST(toFloat_test_3);
- CPPUNIT_TEST(toFloat_test_3_5);
- CPPUNIT_TEST(toFloat_test_3_0625);
- CPPUNIT_TEST(toFloat_test_3_0625_e);
- CPPUNIT_TEST(toFloat_test_pi);
- CPPUNIT_TEST(toFloat_test_1);
- CPPUNIT_TEST(toFloat_test_10);
- CPPUNIT_TEST(toFloat_test_100);
- CPPUNIT_TEST(toFloat_test_1000);
- CPPUNIT_TEST(toFloat_test_10000);
- CPPUNIT_TEST(toFloat_test_mix);
- CPPUNIT_TEST(toFloat_test_1e99);
- CPPUNIT_TEST(toFloat_test_1e_n99);
- CPPUNIT_TEST(toFloat_test_1e308);
- CPPUNIT_TEST_SUITE_END();
- }; // class toFloat
-
-// -----------------------------------------------------------------------------
-// - lastIndexOf (tests)
-// -----------------------------------------------------------------------------
-class lastIndexOf : public CppUnit::TestFixture
-{
-
-public:
- void lastIndexOf_oustring(rtl::OUString const& _suStr, rtl::OUString const& _suSearchStr, sal_Int32 _nExpectedResultPos)
- {
- // Algorithm
- // search the string _suSearchStr (rtl::OUString) in the string _suStr.
- // check if the _nExpectedResultPos occurs.
-
- sal_Int32 nPos = _suStr.lastIndexOf(_suSearchStr);
- CPPUNIT_ASSERT_MESSAGE("expected position is wrong", nPos == _nExpectedResultPos);
- }
-
- void lastIndexOf_salunicode(rtl::OUString const& _suStr, sal_Unicode _cuSearchChar, sal_Int32 _nExpectedResultPos)
- {
- // Algorithm
- // search the unicode char _suSearchChar (sal_Unicode) in the string _suStr.
- // check if the _nExpectedResultPos occurs.
-
- sal_Int32 nPos = _suStr.lastIndexOf(_cuSearchChar);
- CPPUNIT_ASSERT_MESSAGE("expected position is wrong", nPos == _nExpectedResultPos);
- }
-
- void lastIndexOf_oustring_offset(rtl::OUString const& _suStr, rtl::OUString const& _suSearchStr, sal_Int32 _nExpectedResultPos, sal_Int32 _nStartOffset)
- {
- sal_Int32 nPos = _suStr.lastIndexOf(_suSearchStr, _nStartOffset);
- CPPUNIT_ASSERT_MESSAGE("expected position is wrong", nPos == _nExpectedResultPos);
- }
-
- void lastIndexOf_salunicode_offset(rtl::OUString const& _suStr, sal_Unicode _cuSearchChar, sal_Int32 _nExpectedResultPos, sal_Int32 _nStartOffset)
- {
- sal_Int32 nPos = _suStr.lastIndexOf(_cuSearchChar, _nStartOffset);
- CPPUNIT_ASSERT_MESSAGE("expected position is wrong", nPos == _nExpectedResultPos);
- }
-
- // -----------------------------------------------------------------------------
-
- void lastIndexOf_test_oustring_offset_001()
- {
- // search for sun, start at the end, found (pos==0)
- rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("sun java system"));
- rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("sun"));
- lastIndexOf_oustring_offset(aStr, aSearchStr, 0, aStr.getLength());
- }
-
- void lastIndexOf_test_oustring_offset_002()
- {
- // search for sun, start at pos = 3, found (pos==0)
- rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("sun java system"));
- rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("sun"));
- lastIndexOf_oustring_offset(aStr, aSearchStr, 0, 3);
- }
-
- void lastIndexOf_test_oustring_offset_003()
- {
- // search for sun, start at pos = 2, found (pos==-1)
- rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("sun java system"));
- rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("sun"));
- lastIndexOf_oustring_offset(aStr, aSearchStr, -1, 2);
- }
-
- void lastIndexOf_test_oustring_offset_004()
- {
- // search for sun, start at the end, found (pos==0)
- rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("sun java system"));
- rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("sun"));
- lastIndexOf_oustring_offset(aStr, aSearchStr, -1, -1);
- }
-
- void lastIndexOf_test_oustring_001()
- {
- // search for sun, found (pos==0)
- rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("sun java system"));
- rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("sun"));
- lastIndexOf_oustring(aStr, aSearchStr, 0);
- }
-
- void lastIndexOf_test_oustring_002()
- {
- // search for sun, found (pos==4)
- rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the sun java system"));
- rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("sun"));
- lastIndexOf_oustring(aStr, aSearchStr, 4);
- }
-
- void lastIndexOf_test_oustring_003()
- {
- // search for sun, found (pos==8)
- rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the sun sun java system"));
- rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("sun"));
- lastIndexOf_oustring(aStr, aSearchStr, 8);
- }
-
- void lastIndexOf_test_oustring_004()
- {
- // search for sun, found (pos==8)
- rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the sun sun"));
- rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("sun"));
- lastIndexOf_oustring(aStr, aSearchStr, 8);
- }
-
- void lastIndexOf_test_oustring_005()
- {
- // search for sun, found (pos==4)
- rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the sun su"));
- rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("sun"));
- lastIndexOf_oustring(aStr, aSearchStr, 4);
- }
-
- void lastIndexOf_test_oustring_006()
- {
- // search for sun, found (pos==-1)
- rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the su su"));
- rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("sun"));
- lastIndexOf_oustring(aStr, aSearchStr, -1);
- }
-
- void lastIndexOf_test_oustring_007()
- {
- // search for earth, not found (-1)
- rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the su su"));
- rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("earth"));
- lastIndexOf_oustring(aStr, aSearchStr, -1);
- }
-
- void lastIndexOf_test_oustring_008()
- {
- // search for earth, not found (-1)
- rtl::OUString aStr = rtl::OUString();
- rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("earth"));
- lastIndexOf_oustring(aStr, aSearchStr, -1);
- }
-
- void lastIndexOf_test_oustring_009()
- {
- // search for earth, not found (-1)
- rtl::OUString aStr = rtl::OUString();
- rtl::OUString aSearchStr = rtl::OUString();
- lastIndexOf_oustring(aStr, aSearchStr, -1);
-
- }
-
- void lastIndexOf_test_salunicode_001()
- {
- // search for 's', found (19)
- rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the sun sun java system"));
- sal_Unicode suChar = L's';
- lastIndexOf_salunicode(aStr, suChar, 19);
- }
-
- void lastIndexOf_test_salunicode_002()
- {
- // search for 'x', not found (-1)
- rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the sun sun java system"));
- sal_Unicode suChar = L'x';
- lastIndexOf_salunicode(aStr, suChar, -1);
- }
-
- void lastIndexOf_test_salunicode_offset_001()
- {
- // search for 's', start from pos last char, found (19)
- rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the sun sun java system"));
- sal_Unicode cuChar = L's';
- lastIndexOf_salunicode_offset(aStr, cuChar, 19, aStr.getLength());
- }
- void lastIndexOf_test_salunicode_offset_002()
- {
- // search for 's', start pos is last occur from search behind, found (17)
- rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the sun sun java system"));
- sal_Unicode cuChar = L's';
- lastIndexOf_salunicode_offset(aStr, cuChar, 17, 19);
- }
- void lastIndexOf_test_salunicode_offset_003()
- {
- // search for 't', start pos is 1, found (0)
- rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the sun sun java system"));
- sal_Unicode cuChar = L't';
- lastIndexOf_salunicode_offset(aStr, cuChar, 0, 1);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(lastIndexOf);
- CPPUNIT_TEST(lastIndexOf_test_oustring_001);
- CPPUNIT_TEST(lastIndexOf_test_oustring_002);
- CPPUNIT_TEST(lastIndexOf_test_oustring_003);
- CPPUNIT_TEST(lastIndexOf_test_oustring_004);
- CPPUNIT_TEST(lastIndexOf_test_oustring_005);
- CPPUNIT_TEST(lastIndexOf_test_oustring_006);
- CPPUNIT_TEST(lastIndexOf_test_oustring_007);
- CPPUNIT_TEST(lastIndexOf_test_oustring_008);
- CPPUNIT_TEST(lastIndexOf_test_oustring_009);
-
- CPPUNIT_TEST(lastIndexOf_test_oustring_offset_001);
- CPPUNIT_TEST(lastIndexOf_test_oustring_offset_002);
- CPPUNIT_TEST(lastIndexOf_test_oustring_offset_003);
- CPPUNIT_TEST(lastIndexOf_test_oustring_offset_004);
-
- CPPUNIT_TEST(lastIndexOf_test_salunicode_001);
- CPPUNIT_TEST(lastIndexOf_test_salunicode_002);
-
- CPPUNIT_TEST(lastIndexOf_test_salunicode_offset_001);
- CPPUNIT_TEST(lastIndexOf_test_salunicode_offset_002);
- CPPUNIT_TEST(lastIndexOf_test_salunicode_offset_003);
-
- CPPUNIT_TEST_SUITE_END();
-}; // class lastIndexOf
-
-
-// -----------------------------------------------------------------------------
-// - getToken (tests)
-// -----------------------------------------------------------------------------
-class getToken : public CppUnit::TestFixture
-{
-
-public:
- void getToken_000()
- {
- rtl::OUString suTokenStr;
-
- sal_Int32 nIndex = 0;
- do
- {
- rtl::OUString suToken = suTokenStr.getToken( 0, ';', nIndex );
- }
- while ( nIndex >= 0 );
- t_print("Index %d\n", nIndex);
- // should not GPF
- }
-
- void getToken_001()
- {
- rtl::OUString suTokenStr(RTL_CONSTASCII_USTRINGPARAM("a;b"));
-
- sal_Int32 nIndex = 0;
-
- rtl::OUString suToken = suTokenStr.getToken( 0, ';', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be a 'a'", suToken.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("a"))) == sal_True);
-
- /* rtl::OUString */ suToken = suTokenStr.getToken( 0, ';', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be a 'b'", suToken.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("b"))) == sal_True);
- CPPUNIT_ASSERT_MESSAGE("index should be negative", nIndex == -1);
- }
-
- void getToken_002()
- {
- rtl::OUString suTokenStr(RTL_CONSTASCII_USTRINGPARAM("a;b.c"));
-
- sal_Int32 nIndex = 0;
-
- rtl::OUString suToken = suTokenStr.getToken( 0, ';', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be a 'a'", suToken.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("a"))) == sal_True);
-
- /* rtl::OUString */ suToken = suTokenStr.getToken( 0, '.', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be a 'b'", suToken.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("b"))) == sal_True);
-
- /* rtl::OUString */ suToken = suTokenStr.getToken( 0, '.', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be a 'c'", suToken.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("c"))) == sal_True);
- CPPUNIT_ASSERT_MESSAGE("index should be negative", nIndex == -1);
- }
-
- void getToken_003()
- {
- rtl::OUString suTokenStr(RTL_CONSTASCII_USTRINGPARAM("a;;b"));
-
- sal_Int32 nIndex = 0;
-
- rtl::OUString suToken = suTokenStr.getToken( 0, ';', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be a 'a'", suToken.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("a"))) == sal_True);
-
- /* rtl::OUString */ suToken = suTokenStr.getToken( 0, ';', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be empty", suToken.getLength() == 0);
-
- /* rtl::OUString */ suToken = suTokenStr.getToken( 0, ';', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be a 'b'", suToken.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("b"))) == sal_True);
- CPPUNIT_ASSERT_MESSAGE("index should be negative", nIndex == -1);
- }
-
- void getToken_004()
- {
- rtl::OUString suTokenStr(RTL_CONSTASCII_USTRINGPARAM("longer.then.ever."));
-
- sal_Int32 nIndex = 0;
-
- rtl::OUString suToken = suTokenStr.getToken( 0, '.', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be 'longer'", suToken.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("longer"))) == sal_True);
-
- /* rtl::OUString */ suToken = suTokenStr.getToken( 0, '.', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be 'then'", suToken.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("then"))) == sal_True);
-
- /* rtl::OUString */ suToken = suTokenStr.getToken( 0, '.', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be 'ever'", suToken.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ever"))) == sal_True);
-
- /* rtl::OUString */ suToken = suTokenStr.getToken( 0, '.', nIndex );
- CPPUNIT_ASSERT_MESSAGE("Token should be empty", suToken.getLength() == 0);
-
- CPPUNIT_ASSERT_MESSAGE("index should be negative", nIndex == -1);
- }
-
- void getToken_005() {
- rtl::OUString ab(RTL_CONSTASCII_USTRINGPARAM("ab"));
- sal_Int32 n = 0;
- CPPUNIT_ASSERT_MESSAGE(
- "token should be 'ab'", ab.getToken(0, '-', n) == ab);
- CPPUNIT_ASSERT_MESSAGE("n should be -1", n == -1);
- CPPUNIT_ASSERT_MESSAGE(
- "token should be empty", ab.getToken(0, '-', n).getLength() == 0);
- }
-
- CPPUNIT_TEST_SUITE(getToken);
- CPPUNIT_TEST(getToken_000);
- CPPUNIT_TEST(getToken_001);
- CPPUNIT_TEST(getToken_002);
- CPPUNIT_TEST(getToken_003);
- CPPUNIT_TEST(getToken_004);
- CPPUNIT_TEST(getToken_005);
- CPPUNIT_TEST_SUITE_END();
-}; // class getToken
-
-class convertToString: public CppUnit::TestFixture {
-public:
- void test();
-
- CPPUNIT_TEST_SUITE(convertToString);
- CPPUNIT_TEST(test);
- CPPUNIT_TEST_SUITE_END();
-};
-
-void convertToString::test() {
- static sal_Unicode const utf16[] = { 0x0041, 0x00E4, 0x0061 };
- rtl::OString s;
- CPPUNIT_ASSERT(
- rtl::OUString(utf16, SAL_N_ELEMENTS(utf16)).convertToString(
- &s, RTL_TEXTENCODING_UTF7,
- (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
- RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)));
- CPPUNIT_ASSERT_EQUAL(
- rtl::OString(RTL_CONSTASCII_STRINGPARAM("A+AOQ-a")), s);
-}
-
-// -----------------------------------------------------------------------------
-// - string construction & interning (tests)
-// -----------------------------------------------------------------------------
-class construction : public CppUnit::TestFixture
-{
-public:
- void construct()
- {
-#ifdef RTL_INLINE_STRINGS
- ::rtl::OUString aFoo( RTL_CONSTASCII_USTRINGPARAM("foo") );
- CPPUNIT_ASSERT_MESSAGE("string contents", aFoo[0] == 'f');
- CPPUNIT_ASSERT_MESSAGE("string contents", aFoo[1] == 'o');
- CPPUNIT_ASSERT_MESSAGE("string contents", aFoo[2] == 'o');
- CPPUNIT_ASSERT_MESSAGE("string length", aFoo.getLength() == 3);
-
- ::rtl::OUString aBaa( RTL_CONSTASCII_USTRINGPARAM("this is a very long string with a lot of long things inside it and it goes on and on and on forever etc.") );
- CPPUNIT_ASSERT_MESSAGE("string length", aBaa.getLength() == 104);
- // Dig at the internals ... FIXME: should we have the bit-flag defines public ?
- CPPUNIT_ASSERT_MESSAGE("string static flags", (aBaa.pData->refCount & 1<<30) != 0);
-#endif
- }
-
- void intern()
- {
- // The empty string is 'static' a special case ...
- rtl::OUString aEmpty = rtl::OUString().intern();
- rtl::OUString aEmpty2 = rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "" ) );
-
- ::rtl::OUString aFoo( RTL_CONSTASCII_USTRINGPARAM("foo") );
- ::rtl::OUString aFooIntern = aFoo.intern();
- CPPUNIT_ASSERT_MESSAGE("string contents", aFooIntern.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("foo")));
- CPPUNIT_ASSERT_MESSAGE("string length", aFooIntern.getLength() == 3);
- // We have to dup due to no atomic 'intern' bit-set operation
- CPPUNIT_ASSERT_MESSAGE("intern dups", aFoo.pData != aFooIntern.pData);
-
- // Test interning lots of things
- int i;
- static const int nSequence = 4096;
- rtl::OUString *pStrs;
- sal_uIntPtr *pValues;
-
- pStrs = new rtl::OUString[nSequence];
- pValues = new sal_uIntPtr[nSequence];
- for (i = 0; i < nSequence; i++)
- {
- pStrs[i] = rtl::OUString::valueOf( sqrt( static_cast<double>(i) ) ).intern();
- pValues[i] = reinterpret_cast<sal_uIntPtr>( pStrs[i].pData );
- }
- for (i = 0; i < nSequence; i++)
- {
- rtl::OUString aNew = rtl::OUString::valueOf( sqrt( static_cast<double>(i) ) ).intern();
- CPPUNIT_ASSERT_MESSAGE("double intern failed",
- aNew.pData == pStrs[i].pData);
- }
-
- // Free strings to check for leaks
- for (i = 0; i < nSequence; i++)
- {
- // Overwrite - hopefully this re-uses the memory
- pStrs[i] = rtl::OUString();
- pStrs[i] = rtl::OUString::valueOf( sqrt( static_cast<double>(i) ) );
- }
-
- for (i = 0; i < nSequence; i++)
- {
- rtl::OUString aIntern;
- sal_uIntPtr nValue;
- aIntern = rtl::OUString::valueOf( sqrt( static_cast<double>(i) ) ).intern();
-
- nValue = reinterpret_cast<sal_uIntPtr>( aIntern.pData );
- // This may not be 100% reliable: memory may
- // have been re-used, but it's worth checking.
- CPPUNIT_ASSERT_MESSAGE("intern leaking", nValue != pValues[i]);
- }
- delete [] pValues;
- delete [] pStrs;
- }
-
- CPPUNIT_TEST_SUITE(construction);
- CPPUNIT_TEST(construct);
- CPPUNIT_TEST(intern);
- CPPUNIT_TEST_SUITE_END();
-};
-
-class indexOfAscii: public CppUnit::TestFixture {
-public:
- void test();
-
- CPPUNIT_TEST_SUITE(indexOfAscii);
- CPPUNIT_TEST(test);
- CPPUNIT_TEST_SUITE_END();
-};
-
-void indexOfAscii::test() {
- CPPUNIT_ASSERT_EQUAL(
- sal_Int32(-1),
- rtl::OUString().indexOfAsciiL(RTL_CONSTASCII_STRINGPARAM("")));
- CPPUNIT_ASSERT_EQUAL(
- sal_Int32(-1),
- rtl::OUString().lastIndexOfAsciiL(RTL_CONSTASCII_STRINGPARAM("")));
- CPPUNIT_ASSERT_EQUAL(
- sal_Int32(0),
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foo")).indexOfAsciiL(
- RTL_CONSTASCII_STRINGPARAM("foo")));
- CPPUNIT_ASSERT_EQUAL(
- sal_Int32(0),
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foo")).lastIndexOfAsciiL(
- RTL_CONSTASCII_STRINGPARAM("foo")));
- CPPUNIT_ASSERT_EQUAL(
- sal_Int32(2),
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("fofoobar")).indexOfAsciiL(
- RTL_CONSTASCII_STRINGPARAM("foo")));
- CPPUNIT_ASSERT_EQUAL(
- sal_Int32(3),
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foofoofob")).
- lastIndexOfAsciiL(RTL_CONSTASCII_STRINGPARAM("foo")));
- CPPUNIT_ASSERT_EQUAL(
- sal_Int32(3),
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foofoobar")).indexOfAsciiL(
- RTL_CONSTASCII_STRINGPARAM("foo"), 1));
-}
-
-class endsWith: public CppUnit::TestFixture {
-public:
- void test();
-
- CPPUNIT_TEST_SUITE(endsWith);
- CPPUNIT_TEST(test);
- CPPUNIT_TEST_SUITE_END();
-};
-
-void endsWith::test() {
- CPPUNIT_ASSERT_EQUAL(
- true,
- rtl::OUString().endsWithAsciiL(RTL_CONSTASCII_STRINGPARAM("")));
- CPPUNIT_ASSERT_EQUAL(
- false,
- rtl::OUString().endsWithAsciiL(RTL_CONSTASCII_STRINGPARAM("foo")));
- CPPUNIT_ASSERT_EQUAL(
- true,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bar")).endsWithAsciiL(
- RTL_CONSTASCII_STRINGPARAM("bar")));
- CPPUNIT_ASSERT_EQUAL(
- true,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobar")).endsWithAsciiL(
- RTL_CONSTASCII_STRINGPARAM("bar")));
- CPPUNIT_ASSERT_EQUAL(
- false,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FOOBAR")).endsWithAsciiL(
- RTL_CONSTASCII_STRINGPARAM("bar")));
-}
-
-class createFromCodePoints: public CppUnit::TestFixture {
-public:
- void test();
-
- CPPUNIT_TEST_SUITE(createFromCodePoints);
- CPPUNIT_TEST(test);
- CPPUNIT_TEST_SUITE_END();
-};
-
-void createFromCodePoints::test() {
- CPPUNIT_ASSERT_EQUAL(
- sal_Int32(0),
- rtl::OUString(static_cast< sal_uInt32 const * >(NULL), 0).getLength());
- static sal_uInt32 const cp[] = { 0, 0xD800, 0xFFFF, 0x10000, 0x10FFFF };
- rtl::OUString s(cp, sizeof cp / sizeof (sal_uInt32));
- CPPUNIT_ASSERT_EQUAL(sal_Int32(7), s.getLength());
- CPPUNIT_ASSERT_EQUAL(sal_Unicode(0), s[0]);
- CPPUNIT_ASSERT_EQUAL(sal_Unicode(0xD800), s[1]);
- CPPUNIT_ASSERT_EQUAL(sal_Unicode(0xFFFF), s[2]);
- CPPUNIT_ASSERT_EQUAL(sal_Unicode(0xD800), s[3]);
- CPPUNIT_ASSERT_EQUAL(sal_Unicode(0xDC00), s[4]);
- CPPUNIT_ASSERT_EQUAL(sal_Unicode(0xDBFF), s[5]);
- CPPUNIT_ASSERT_EQUAL(sal_Unicode(0xDFFF), s[6]);
-}
-
-class iterateCodePoints: public CppUnit::TestFixture {
-public:
- void testNotWellFormed();
-
- CPPUNIT_TEST_SUITE(iterateCodePoints);
- CPPUNIT_TEST(testNotWellFormed);
- CPPUNIT_TEST_SUITE_END();
-};
-
-void iterateCodePoints::testNotWellFormed() {
- static sal_Unicode const utf16[] =
- { 0xD800, 0xDC00, 0x0041, 0xDBFF, 0xDFFF, 0xDDEF, 0xD9AB };
- rtl::OUString s(utf16, sizeof utf16 / sizeof (sal_Unicode));
- sal_Int32 i = 0;
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x10000), s.iterateCodePoints(&i));
- CPPUNIT_ASSERT_EQUAL(sal_Int32(2), i);
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x0041), s.iterateCodePoints(&i));
- CPPUNIT_ASSERT_EQUAL(sal_Int32(3), i);
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x10FFFF), s.iterateCodePoints(&i));
- CPPUNIT_ASSERT_EQUAL(sal_Int32(5), i);
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xDDEF), s.iterateCodePoints(&i));
- CPPUNIT_ASSERT_EQUAL(sal_Int32(6), i);
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xD9AB), s.iterateCodePoints(&i));
- CPPUNIT_ASSERT_EQUAL(sal_Int32(7), i);
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xD9AB), s.iterateCodePoints(&i, -1));
- CPPUNIT_ASSERT_EQUAL(sal_Int32(6), i);
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xDDEF), s.iterateCodePoints(&i, -1));
- CPPUNIT_ASSERT_EQUAL(sal_Int32(5), i);
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x10FFFF), s.iterateCodePoints(&i, -1));
- CPPUNIT_ASSERT_EQUAL(sal_Int32(3), i);
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x0041), s.iterateCodePoints(&i, -1));
- CPPUNIT_ASSERT_EQUAL(sal_Int32(2), i);
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x10000), s.iterateCodePoints(&i, -1));
- CPPUNIT_ASSERT_EQUAL(sal_Int32(0), i);
- i = 1;
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(0xDC00), s.iterateCodePoints(&i, 2));
- CPPUNIT_ASSERT_EQUAL(sal_Int32(3), i);
- i = 4;
- CPPUNIT_ASSERT_EQUAL(sal_uInt32(0x10000), s.iterateCodePoints(&i, -3));
- CPPUNIT_ASSERT_EQUAL(sal_Int32(0), i);
-}
-
-class convertFromString: public CppUnit::TestFixture {
-public:
- void test();
-
- CPPUNIT_TEST_SUITE(createFromCodePoints);
- CPPUNIT_TEST(test);
- CPPUNIT_TEST_SUITE_END();
-};
-
-void convertFromString::test() {
- rtl::OUString t;
- CPPUNIT_ASSERT(
- !rtl_convertStringToUString(
- &t.pData, RTL_CONSTASCII_STRINGPARAM("\x80"), RTL_TEXTENCODING_UTF8,
- (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
- RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
- RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)));
- CPPUNIT_ASSERT(
- !rtl_convertStringToUString(
- &t.pData, RTL_CONSTASCII_STRINGPARAM("\xC0"), RTL_TEXTENCODING_UTF8,
- (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
- RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
- RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)));
- CPPUNIT_ASSERT(
- !rtl_convertStringToUString(
- &t.pData, RTL_CONSTASCII_STRINGPARAM("\xFF"), RTL_TEXTENCODING_UTF8,
- (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
- RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
- RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)));
- CPPUNIT_ASSERT(
- rtl_convertStringToUString(
- &t.pData, RTL_CONSTASCII_STRINGPARAM("abc"), RTL_TEXTENCODING_UTF8,
- (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
- RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
- RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)));
- CPPUNIT_ASSERT(t.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("abc")));
-}
-
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OUString::valueOf, "rtl_OUString");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OUString::toInt, "rtl_OUString");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OUString::toDouble, "rtl_OUString");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OUString::toFloat, "rtl_OUString");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OUString::lastIndexOf, "rtl_OUString");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OUString::getToken, "rtl_OUString");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(
- rtl_OUString::convertToString, "rtl_OUString");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OUString::construction, "rtl_OUString");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(
- rtl_OUString::indexOfAscii, "rtl_OUString");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OUString::endsWith, "rtl_OUString");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(
- rtl_OUString::createFromCodePoints, "rtl_OUString");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(
- rtl_OUString::iterateCodePoints, "rtl_OUString");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(
- rtl_OUString::convertFromString, "rtl_OUString");
-
-} // namespace rtl_OUString
-
-
-// -----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-NOADDITIONAL;
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/oustring/rtl_ustr.cxx b/sal/qa/rtl/oustring/rtl_ustr.cxx
deleted file mode 100644
index 6179a170c..000000000
--- a/sal/qa/rtl/oustring/rtl_ustr.cxx
+++ /dev/null
@@ -1,1426 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-#include <testshl/simpleheader.hxx>
-
-/** print a UNI_CODE file name.
-*/
-inline void printOUString( ::rtl::OUString const & _suStr )
-{
- rtl::OString aString;
-
- t_print( "OUString: " );
- aString = ::rtl::OUStringToOString( _suStr, RTL_TEXTENCODING_ASCII_US );
- t_print( "%s\n", aString.getStr( ) );
-}
-
-
-namespace rtl_ustr
-{
-
- class compare : public CppUnit::TestFixture
- {
- public:
-
-
- void compare_000()
- {
- rtl_ustr_compare( NULL, NULL);
- // should not GPF
- }
-
- void compare_000_1()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
- rtl_ustr_compare( aStr1.getStr(), NULL);
- // should not GPF
- }
- void compare_001()
- {
- rtl::OUString aStr1;
- rtl::OUString aStr2;
-
- sal_Int32 nValue = rtl_ustr_compare( aStr1.getStr(), aStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void compare_002()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
- rtl::OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
-
- sal_Int32 nValue = rtl_ustr_compare( aStr1.getStr(), aStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void compare_003()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must differ."));
- rtl::OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("Line foo bar, ok, differ."));
-
- sal_Int32 nValue = rtl_ustr_compare( aStr1.getStr(), aStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings differ.", nValue != 0);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(compare);
- CPPUNIT_TEST(compare_000);
- CPPUNIT_TEST(compare_000_1);
- CPPUNIT_TEST(compare_001);
- CPPUNIT_TEST(compare_002);
- CPPUNIT_TEST(compare_003);
- CPPUNIT_TEST_SUITE_END();
-}; // class compare
-
-
- class compareIgnoreAsciiCase : public CppUnit::TestFixture
- {
- public:
-
- void compare_000()
- {
- rtl_ustr_compareIgnoreAsciiCase( NULL, NULL);
- }
-
- void compare_000_1()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
- rtl_ustr_compareIgnoreAsciiCase( aStr1.getStr(), NULL);
- }
- void compare_001()
- {
- rtl::OUString aStr1;
- rtl::OUString aStr2;
-
- sal_Int32 nValue = rtl_ustr_compareIgnoreAsciiCase( aStr1.getStr(), aStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void compare_002()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
- rtl::OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
-
- sal_Int32 nValue = rtl_ustr_compareIgnoreAsciiCase( aStr1.getStr(), aStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void compare_002_1()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
- rtl::OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("LINE MUST BE EQUAL."));
-
- sal_Int32 nValue = rtl_ustr_compareIgnoreAsciiCase( aStr1.getStr(), aStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal (if case insensitve).", nValue == 0);
- }
-
- void compare_003()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must differ."));
- rtl::OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("Line foo bar, ok, differ."));
-
- sal_Int32 nValue = rtl_ustr_compareIgnoreAsciiCase( aStr1.getStr(), aStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings differ.", nValue != 0);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(compareIgnoreAsciiCase);
- CPPUNIT_TEST(compare_000);
- CPPUNIT_TEST(compare_000_1);
- CPPUNIT_TEST(compare_001);
- CPPUNIT_TEST(compare_002);
- CPPUNIT_TEST(compare_002_1);
- CPPUNIT_TEST(compare_003);
- CPPUNIT_TEST_SUITE_END();
- }; // class compareIgnoreAsciiCase
-
-// -----------------------------------------------------------------------------
-
- class shortenedCompareIgnoreAsciiCase_WithLength : public CppUnit::TestFixture
- {
- public:
-
- void compare_000()
- {
- rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( NULL, 0, NULL, 0, 0);
- }
-
- void compare_000_1()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
- rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), aStr1.getLength(), NULL, 0, 1);
- }
- void compare_001()
- {
- rtl::OUString aStr1;
- rtl::OUString aStr2;
-
- sal_Int32 nValue = rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), aStr1.getLength(), aStr2.getStr(), aStr2.getLength(), aStr1.getLength());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void compare_002()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
- rtl::OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
-
- sal_Int32 nValue = rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), aStr1.getLength(),
- aStr2.getStr(), aStr2.getLength(),
- aStr1.getLength());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void compare_002_1()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
- rtl::OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("LINE MUST BE EQUAL."));
-
- sal_Int32 nValue = rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), aStr1.getLength(),
- aStr2.getStr(), aStr2.getLength(),
- aStr1.getLength());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal (if case insensitve).", nValue == 0);
- }
-
- void compare_003()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must differ."));
- rtl::OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("Line foo bar, ok, differ."));
-
- sal_Int32 nValue = rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), aStr1.getLength(),
- aStr2.getStr(), aStr2.getLength(),
- 5);
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal first 5 characters.", nValue == 0);
- }
-
- void compare_004()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must differ."));
- rtl::OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("Line foo bar, ok, differ."));
-
- sal_Int32 nValue = rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), aStr1.getLength(),
- aStr2.getStr(), aStr2.getLength(),
- aStr1.getLength());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings differ.", nValue != 0);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(shortenedCompareIgnoreAsciiCase_WithLength);
- CPPUNIT_TEST(compare_000);
- CPPUNIT_TEST(compare_000_1);
- CPPUNIT_TEST(compare_001);
- CPPUNIT_TEST(compare_002);
- CPPUNIT_TEST(compare_002_1);
- CPPUNIT_TEST(compare_003);
- CPPUNIT_TEST(compare_004);
- CPPUNIT_TEST_SUITE_END();
-}; // class compare
-
-
-// // -----------------------------------------------------------------------------
-//
-// class hashCode : public CppUnit::TestFixture
-// {
-// public:
-//
-// void hashCode_000()
-// {
-// sal_Int32 nHashCode = rtl_ustr_hashCode( NULL );
-// volatile int dummy = 0;
-// }
-//
-// void hashCode_001()
-// {
-// rtl::OString aStr1 = "Line for a hashCode.";
-// sal_Int32 nHashCode = rtl_ustr_hashCode( aStr1.getStr() );
-// t_print("hashcode: %d\n", nHashCode);
-// // CPPUNIT_ASSERT_MESSAGE("failed.", nValue == 0);
-// }
-//
-// void hashCode_002()
-// {
-// rtl::OString aStr1 = "Line for a hashCode.";
-// sal_Int32 nHashCode1 = rtl_ustr_hashCode( aStr1.getStr() );
-//
-// rtl::OString aStr2 = "Line for a hashCode.";
-// sal_Int32 nHashCode2 = rtl_ustr_hashCode( aStr2.getStr() );
-//
-// CPPUNIT_ASSERT_MESSAGE("hashcodes must be equal.", nHashCode1 == nHashCode2 );
-// }
-//
-// void hashCode_003()
-// {
-// rtl::OString aStr1 = "Line for a hashCode.";
-// sal_Int32 nHashCode1 = rtl_ustr_hashCode( aStr1.getStr() );
-//
-// rtl::OString aStr2 = "Line for an other hashcode.";
-// sal_Int32 nHashCode2 = rtl_ustr_hashCode( aStr2.getStr() );
-//
-// CPPUNIT_ASSERT_MESSAGE("hashcodes must differ.", nHashCode1 != nHashCode2 );
-// }
-//
-// // Change the following lines only, if you add, remove or rename
-// // member functions of the current class,
-// // because these macros are need by auto register mechanism.
-//
-// CPPUNIT_TEST_SUITE(hashCode);
-// CPPUNIT_TEST(hashCode_000);
-// CPPUNIT_TEST(hashCode_001);
-// CPPUNIT_TEST(hashCode_002);
-// CPPUNIT_TEST(hashCode_003);
-// CPPUNIT_TEST_SUITE_END();
-// }; // class compare
-//
-//
-// // -----------------------------------------------------------------------------
-//
- class indexOfChar : public CppUnit::TestFixture
- {
- public:
-
- void indexOfChar_000()
- {
- rtl_ustr_indexOfChar( NULL, 0 );
- }
-
- void indexOfChar_001()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a indexOfChar."));
-
- sal_Int32 nIndex = rtl_ustr_indexOfChar( aStr1.getStr(), 'L' );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 0);
-
- /* sal_Int32 */ nIndex = rtl_ustr_indexOfChar( aStr1.getStr(), 'i' );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 1);
-
- /* sal_Int32 */ nIndex = rtl_ustr_indexOfChar( aStr1.getStr(), 'n' );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 2);
-
- /* sal_Int32 */ nIndex = rtl_ustr_indexOfChar( aStr1.getStr(), 'e' );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 3);
- }
-
- void indexOfChar_002()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a indexOfChar."));
- sal_Int32 nIndex = rtl_ustr_indexOfChar( aStr1.getStr(), 'y' );
-
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == -1 );
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(indexOfChar);
- CPPUNIT_TEST(indexOfChar_000);
- CPPUNIT_TEST(indexOfChar_001);
- CPPUNIT_TEST(indexOfChar_002);
- CPPUNIT_TEST_SUITE_END();
- }; // class indexOfChar
-
-// // -----------------------------------------------------------------------------
- class lastIndexOfChar : public CppUnit::TestFixture
- {
- public:
-
- void lastIndexOfChar_000()
- {
- rtl_ustr_lastIndexOfChar( NULL, 0 );
- }
-
- void lastIndexOfChar_001()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a lastIndexOfChar."));
-
- sal_Int32 nIndex = rtl_ustr_lastIndexOfChar( aStr1.getStr(), 'C' );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 22);
-
- /* sal_Int32 */ nIndex = rtl_ustr_lastIndexOfChar( aStr1.getStr(), 'h' );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 23);
-
- /* sal_Int32 */ nIndex = rtl_ustr_lastIndexOfChar( aStr1.getStr(), 'a' );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 24);
-
- /* sal_Int32 */ nIndex = rtl_ustr_lastIndexOfChar( aStr1.getStr(), 'r' );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 25);
- }
-
- void lastIndexOfChar_002()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a lastIndexOfChar."));
- sal_Int32 nIndex = rtl_ustr_lastIndexOfChar( aStr1.getStr(), 'y' );
-
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == -1 );
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(lastIndexOfChar);
- CPPUNIT_TEST(lastIndexOfChar_000);
- CPPUNIT_TEST(lastIndexOfChar_001);
- CPPUNIT_TEST(lastIndexOfChar_002);
- CPPUNIT_TEST_SUITE_END();
- }; // class lastIndexOfChar
-
-
-// -----------------------------------------------------------------------------
-
- class indexOfStr : public CppUnit::TestFixture
- {
- public:
-
- void indexOfStr_000()
- {
- rtl_ustr_indexOfStr( NULL, 0 );
- }
-
- void indexOfStr_000_1()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a indexOfStr."));
- rtl_ustr_indexOfStr( aStr1.getStr(), 0 );
- }
-
- void indexOfStr_001()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a indexOfStr."));
-
- rtl::OUString suSearch(RTL_CONSTASCII_USTRINGPARAM("Line"));
- sal_Int32 nIndex = rtl_ustr_indexOfStr( aStr1.getStr(), suSearch );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 0);
-
- /* rtl::OUString */ suSearch(RTL_CONSTASCII_USTRINGPARAM("for"));
- /* sal_Int32 */ nIndex = rtl_ustr_indexOfStr( aStr1.getStr(), suSearch );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 5);
-
- /* rtl::OUString */ suSearch(RTL_CONSTASCII_USTRINGPARAM("a"));
- /* sal_Int32 */ nIndex = rtl_ustr_indexOfStr( aStr1.getStr(), suSearch );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 9);
-
- /* rtl::OUString */ suSearch(RTL_CONSTASCII_USTRINGPARAM("a index"));
- /* sal_Int32 */ nIndex = rtl_ustr_indexOfStr( aStr1.getStr(), suSearch );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex ==9);
- }
-
- void indexOfStr_002()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a indexOfStr."));
- rtl::OUString suSearch(RTL_CONSTASCII_USTRINGPARAM("not exist"));
- sal_Int32 nIndex = rtl_ustr_indexOfStr( aStr1.getStr(), suSearch );
-
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == -1 );
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(indexOfStr);
- CPPUNIT_TEST(indexOfStr_000);
- CPPUNIT_TEST(indexOfStr_001);
- CPPUNIT_TEST(indexOfStr_002);
- CPPUNIT_TEST_SUITE_END();
- }; // class compare
-// -----------------------------------------------------------------------------
-
-
- class lastIndexOfStr : public CppUnit::TestFixture
- {
- public:
-
- void lastIndexOfStr_000()
- {
- rtl_ustr_lastIndexOfStr( NULL, NULL );
- }
-
- void lastIndexOfStr_000_1()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a lastIndexOfStr."));
- rtl_ustr_lastIndexOfStr( aStr1.getStr(), NULL );
- }
-
- void lastIndexOfStr_001()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a lastIndexOfStr."));
- rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("Index"));
-
- sal_Int32 nIndex = rtl_ustr_lastIndexOfStr( aStr1.getStr(), aSearchStr.getStr() );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 15);
-
- /* rtl::OString */ aSearchStr = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Line"));
- /* sal_Int32 */ nIndex = rtl_ustr_lastIndexOfStr( aStr1.getStr(), aSearchStr.getStr() );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 0);
-
- /* rtl::OString */ aSearchStr = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(""));
- /* sal_Int32 */ nIndex = rtl_ustr_lastIndexOfStr( aStr1.getStr(), aSearchStr.getStr() );
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == -1);
- }
-
- void lastIndexOfStr_002()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a lastIndexOfStr."));
- rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("foo"));
- sal_Int32 nIndex = rtl_ustr_lastIndexOfStr( aStr1.getStr(), aSearchStr.getStr() );
-
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == -1 );
- }
-
- void lastIndexOfStr_003()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a lastIndexOfStr."));
- rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("O"));
- sal_Int32 nIndex = rtl_ustr_lastIndexOfStr( aStr1.getStr(), aSearchStr.getStr() );
-
- CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 20 );
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(lastIndexOfStr);
- CPPUNIT_TEST(lastIndexOfStr_000);
- CPPUNIT_TEST(lastIndexOfStr_001);
- CPPUNIT_TEST(lastIndexOfStr_002);
- CPPUNIT_TEST(lastIndexOfStr_003);
- CPPUNIT_TEST_SUITE_END();
- }; // class lastIndexOfStr
-
-// -----------------------------------------------------------------------------
-
- class replaceChar : public CppUnit::TestFixture
- {
- public:
-
- void replaceChar_000()
- {
- rtl_ustr_replaceChar( NULL, 0, 0 );
- }
-
- void replaceChar_001()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("replace char."));
- rtl::OUString aShouldStr1(RTL_CONSTASCII_USTRINGPARAM("ruplacu char."));
-
- sal_uInt32 nLength = aStr1.getLength() * sizeof(sal_Unicode);
- sal_Unicode* pStr = (sal_Unicode*) malloc( nLength + sizeof(sal_Unicode)); // length + 1 (null terminator)
- CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
- memset(pStr, 0, nLength + sizeof(sal_Unicode));
- memcpy(pStr, aStr1.getStr(), nLength);
-
- rtl_ustr_replaceChar( pStr, 'e', 'u' );
- rtl::OUString suStr(pStr, aStr1.getLength());
-
- CPPUNIT_ASSERT_MESSAGE("replace failed", aShouldStr1.equals(suStr) == sal_True);
- free(pStr);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(replaceChar);
- CPPUNIT_TEST(replaceChar_000);
- CPPUNIT_TEST(replaceChar_001);
- CPPUNIT_TEST_SUITE_END();
- }; // class replaceChar
-
-// -----------------------------------------------------------------------------
-
- class replaceChar_WithLength : public CppUnit::TestFixture
- {
- public:
-
- void replaceChar_WithLength_000()
- {
- rtl_ustr_replaceChar_WithLength( NULL, 0, 0, 0 );
- }
-
- void replaceChar_WithLength_000_1()
- {
- rtl_ustr_replaceChar_WithLength( NULL, 1, 0, 0 );
- }
- void replaceChar_WithLength_001()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("replace char."));
- rtl::OUString aShouldStr1(RTL_CONSTASCII_USTRINGPARAM("ruplace char."));
-
- sal_uInt32 nLength = aStr1.getLength() * sizeof(sal_Unicode);
- sal_Unicode* pStr = (sal_Unicode*) malloc(nLength);
- CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
- memcpy(pStr, aStr1.getStr(), nLength);
-
- rtl_ustr_replaceChar_WithLength( pStr, 6, 'e', 'u' );
- rtl::OUString suStr(pStr, aStr1.getLength());
-
- CPPUNIT_ASSERT_MESSAGE("replace failed", aShouldStr1.equals(suStr) == sal_True);
- free(pStr);
- }
-
- void replaceChar_WithLength_002()
- {
- rtl::OUString aStr1 (RTL_CONSTASCII_USTRINGPARAM("eeeeeeeeeeeee"));
- rtl::OUString aShouldStr1(RTL_CONSTASCII_USTRINGPARAM("uuuuuueeeeeee"));
-
- sal_uInt32 nLength = aStr1.getLength() * sizeof(sal_Unicode);
- sal_Unicode* pStr = (sal_Unicode*) malloc(nLength); // no null terminator is need
- CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
- memcpy(pStr, aStr1.getStr(), nLength);
-
- rtl_ustr_replaceChar_WithLength( pStr, 6, 'e', 'u' );
- rtl::OUString suStr(pStr, aStr1.getLength());
-
- CPPUNIT_ASSERT_MESSAGE("replace failed", aShouldStr1.equals(suStr) == sal_True);
- free(pStr);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(replaceChar_WithLength);
- CPPUNIT_TEST(replaceChar_WithLength_000);
- CPPUNIT_TEST(replaceChar_WithLength_000_1);
- CPPUNIT_TEST(replaceChar_WithLength_001);
- CPPUNIT_TEST(replaceChar_WithLength_002);
- CPPUNIT_TEST_SUITE_END();
- }; // class replaceChar
-
-
-// -----------------------------------------------------------------------------
-
- class toAsciiLowerCase : public CppUnit::TestFixture
- {
- public:
-
- void toAsciiLowerCase_000()
- {
- rtl_ustr_toAsciiLowerCase( NULL );
- }
-
- void toAsciiLowerCase_001()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("CHANGE THIS TO ASCII LOWER CASE."));
- rtl::OUString aShouldStr1(RTL_CONSTASCII_USTRINGPARAM("change this to ascii lower case."));
-
- sal_uInt32 nLength = aStr1.getLength() * sizeof(sal_Unicode);
- sal_Unicode* pStr = (sal_Unicode*) malloc(nLength + sizeof(sal_Unicode) ); // we need to add '\0' so one more
- CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
- memset(pStr, 0, nLength + sizeof(sal_Unicode)); // empty the sal_Unicode array
- memcpy(pStr, aStr1.getStr(), nLength);
-
- rtl_ustr_toAsciiLowerCase( pStr );
- rtl::OUString suStr(pStr, aStr1.getLength());
-
- CPPUNIT_ASSERT_MESSAGE("failed", aShouldStr1.equals(suStr) == sal_True);
- free(pStr);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(toAsciiLowerCase);
- CPPUNIT_TEST(toAsciiLowerCase_000);
- CPPUNIT_TEST(toAsciiLowerCase_001);
- CPPUNIT_TEST_SUITE_END();
- }; // class replaceChar
-
-
- class toAsciiLowerCase_WithLength : public CppUnit::TestFixture
- {
- public:
-
- void toAsciiLowerCase_WithLength_000()
- {
- rtl_ustr_toAsciiLowerCase_WithLength( NULL, 0 );
- }
-
- void toAsciiLowerCase_WithLength_001()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("CHANGE THIS TO ASCII LOWER CASE."));
- rtl::OUString aShouldStr1(RTL_CONSTASCII_USTRINGPARAM("change thiS TO ASCII LOWER CASE."));
-
- sal_uInt32 nLength = aStr1.getLength() * sizeof(sal_Unicode);
- sal_Unicode* pStr = (sal_Unicode*) malloc(nLength);
- CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
- memcpy(pStr, aStr1.getStr(), nLength);
-
- rtl_ustr_toAsciiLowerCase_WithLength( pStr, 10 );
-
- rtl::OUString suStr(pStr, aStr1.getLength());
- sal_Bool bResult = aShouldStr1.equals(suStr);
-
- printOUString(suStr);
- t_print("Result length: %d\n", suStr.getLength() );
- t_print("Result: %d\n", bResult);
-
- CPPUNIT_ASSERT_MESSAGE("failed", bResult == sal_True);
- free(pStr);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(toAsciiLowerCase_WithLength);
- CPPUNIT_TEST(toAsciiLowerCase_WithLength_000);
- CPPUNIT_TEST(toAsciiLowerCase_WithLength_001);
- CPPUNIT_TEST_SUITE_END();
- }; // class replaceChar
-
-// -----------------------------------------------------------------------------
-
- class toAsciiUpperCase : public CppUnit::TestFixture
- {
- public:
-
- void toAsciiUpperCase_000()
- {
- rtl_ustr_toAsciiUpperCase( NULL );
- }
-
- void toAsciiUpperCase_001()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("change this to ascii upper case."));
- rtl::OUString aShouldStr1(RTL_CONSTASCII_USTRINGPARAM("CHANGE THIS TO ASCII UPPER CASE."));
-
- sal_uInt32 nLength = aStr1.getLength() * sizeof(sal_Unicode);
- sal_Unicode* pStr = (sal_Unicode*) malloc(nLength + sizeof(sal_Unicode)); // length + null terminator
- CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
- memset(pStr, 0, nLength + sizeof(sal_Unicode));
- memcpy(pStr, aStr1.getStr(), nLength);
-
- rtl_ustr_toAsciiUpperCase( pStr );
- rtl::OUString suStr(pStr, aStr1.getLength());
-
- CPPUNIT_ASSERT_MESSAGE("failed", aShouldStr1.equals(suStr) == sal_True);
- free(pStr);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(toAsciiUpperCase);
- CPPUNIT_TEST(toAsciiUpperCase_000);
- CPPUNIT_TEST(toAsciiUpperCase_001);
- CPPUNIT_TEST_SUITE_END();
- }; // class replaceChar
-
-
- class toAsciiUpperCase_WithLength : public CppUnit::TestFixture
- {
- public:
-
- void toAsciiUpperCase_WithLength_000()
- {
- rtl_ustr_toAsciiUpperCase_WithLength( NULL, 0 );
- }
-
- void toAsciiUpperCase_WithLength_001()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("change this to ascii lower case."));
- rtl::OUString aShouldStr1(RTL_CONSTASCII_USTRINGPARAM("CHANGE THIs to ascii lower case."));
-
- sal_uInt32 nLength = aStr1.getLength() * sizeof(sal_Unicode);
- sal_Unicode* pStr = (sal_Unicode*) malloc(nLength);
- CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
-
- memcpy(pStr, aStr1.getStr(), nLength);
- rtl_ustr_toAsciiUpperCase_WithLength( pStr, 10 );
- rtl::OUString suStr(pStr, aStr1.getLength());
-
- // t_print("Uppercase with length: '%s'\n", aStr1.getStr());
- CPPUNIT_ASSERT_MESSAGE("failed", aShouldStr1.equals(suStr) == sal_True);
- free(pStr);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(toAsciiUpperCase_WithLength);
- CPPUNIT_TEST(toAsciiUpperCase_WithLength_000);
- CPPUNIT_TEST(toAsciiUpperCase_WithLength_001);
- CPPUNIT_TEST_SUITE_END();
- }; // class replaceChar
-
-
- // -----------------------------------------------------------------------------
-
- class trim_WithLength : public CppUnit::TestFixture
- {
- public:
- void trim_WithLength_000()
- {
- rtl_ustr_trim_WithLength(NULL, 0);
- // should not GPF
- }
-
- void trim_WithLength_000_1()
- {
- rtl::OUString suStr(RTL_CONSTASCII_USTRINGPARAM(" trim this"));
-
- sal_uInt32 nLength = suStr.getLength() * sizeof(sal_Unicode);
- sal_Unicode *pStr = (sal_Unicode*)malloc(nLength);
- memcpy(pStr, suStr.getStr(), nLength);
-
- rtl_ustr_trim_WithLength( pStr, 0 );
- free(pStr);
- }
-
- void trim_WithLength_001()
- {
- rtl::OUString suStr(RTL_CONSTASCII_USTRINGPARAM(" trim this"));
- sal_uInt32 nLength = suStr.getLength() * sizeof(sal_Unicode);
- sal_Unicode *pStr = (sal_Unicode*)malloc(nLength);
- memcpy(pStr, suStr.getStr(), nLength);
-
- rtl_ustr_trim_WithLength( pStr, 2 );
-
- CPPUNIT_ASSERT_MESSAGE("string should be empty", rtl::OUString(pStr).getLength() == 0);
- free(pStr);
- }
-
-
- void trim_WithLength_002()
- {
- rtl::OUString suStr(RTL_CONSTASCII_USTRINGPARAM("trim this"));
-
- sal_uInt32 nLength = suStr.getLength() * sizeof(sal_Unicode);
- sal_Unicode *pStr = (sal_Unicode*)malloc(nLength);
- memcpy(pStr, suStr.getStr(), nLength);
-
- rtl_ustr_trim_WithLength( pStr, 5 );
-
- CPPUNIT_ASSERT_MESSAGE("string should contain 'trim'", rtl::OUString(pStr).getLength() == 4);
- free(pStr);
- }
-
-
- void trim_WithLength_003()
- {
- rtl::OUString suStr(RTL_CONSTASCII_USTRINGPARAM(" trim this"));
-
- sal_uInt32 nLength = suStr.getLength() * sizeof(sal_Unicode);
- sal_Unicode *pStr = (sal_Unicode*)malloc(nLength);
- memcpy(pStr, suStr.getStr(), nLength);
-
- rtl_ustr_trim_WithLength( pStr, 11 );
-
- CPPUNIT_ASSERT_MESSAGE("string should contain 'trim'", rtl::OUString(pStr).getLength() == 4);
- free(pStr);
- }
-
- void trim_WithLength_004()
- {
- rtl::OUString suStr(RTL_CONSTASCII_USTRINGPARAM("\r\n\t \n\r trim \n this"));
-
- sal_uInt32 nLength = suStr.getLength() * sizeof(sal_Unicode);
- sal_Unicode *pStr = (sal_Unicode*)malloc(nLength);
- memcpy(pStr, suStr.getStr(), nLength);
-
- rtl_ustr_trim_WithLength( pStr, 17 );
-
- CPPUNIT_ASSERT_MESSAGE("string should contain 'trim'", rtl::OUString(pStr).getLength() == 4);
- free(pStr);
- }
-
- void trim_WithLength_005()
- {
- rtl::OUString suStr(RTL_CONSTASCII_USTRINGPARAM("\r\n\t \n\r trim \t this \n\r\t\t "));
-
- sal_uInt32 nLength = suStr.getLength() * sizeof(sal_Unicode);
- sal_Unicode *pStr = (sal_Unicode*)malloc(nLength);
- memcpy(pStr, suStr.getStr(), nLength);
-
- rtl_ustr_trim_WithLength( pStr, suStr.getLength() );
-
- CPPUNIT_ASSERT_MESSAGE("string should contain 'trim \\t this'", rtl::OUString(pStr).getLength() == 11);
- free(pStr);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(trim_WithLength);
- CPPUNIT_TEST(trim_WithLength_000);
- CPPUNIT_TEST(trim_WithLength_000_1);
- CPPUNIT_TEST(trim_WithLength_001);
- CPPUNIT_TEST(trim_WithLength_002);
- CPPUNIT_TEST(trim_WithLength_003);
- CPPUNIT_TEST(trim_WithLength_004);
- CPPUNIT_TEST(trim_WithLength_005);
- CPPUNIT_TEST_SUITE_END();
- };
-
- // -----------------------------------------------------------------------------
-
- class valueOfChar : public CppUnit::TestFixture
- {
- public:
- void valueOfChar_000()
- {
- rtl_ustr_valueOfChar(NULL, 0);
- // should not GPF
- }
- void valueOfChar_001()
- {
- sal_Unicode *pStr = (sal_Unicode*)malloc(RTL_USTR_MAX_VALUEOFCHAR);
- if (pStr)
- {
- rtl_ustr_valueOfChar(pStr, 'A');
-
- CPPUNIT_ASSERT_MESSAGE("string should contain 'A'", pStr[0] == L'A');
- free(pStr);
- }
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(valueOfChar);
- CPPUNIT_TEST(valueOfChar_000);
- CPPUNIT_TEST(valueOfChar_001);
- CPPUNIT_TEST_SUITE_END();
- };
-
-
-
-
- class ascii_compare_WithLength : public CppUnit::TestFixture
- {
- public:
- void zero_length()
- {
- sal_Unicode pUnicode[] = {0xffff, 0xffff};
- char const * pAscii = "reference";
-
- sal_Int32 value = rtl_ustr_ascii_compare_WithLength(pUnicode, 0, pAscii);
- CPPUNIT_ASSERT_MESSAGE("ref string is empty, compare failed, needs to be <0.", value < 0);
- }
-
- void equal_ascii_shorter()
- {
- rtl::OUString refStr(RTL_CONSTASCII_USTRINGPARAM("referenceString"));
- char const * pAscii = "reference";
-
- sal_Int32 value = rtl_ustr_ascii_compare_WithLength(refStr.pData->buffer, refStr.pData->length, pAscii);
- CPPUNIT_ASSERT_MESSAGE("ref string is bigger, compare failed, needs to be >0.", value > 0);
- }
-
- void equal_ascii_shorter_asciiLength()
- {
- rtl::OUString refStr(RTL_CONSTASCII_USTRINGPARAM("referenceString"));
- char const * pAscii = "reference";
-
- sal_Int32 value = rtl_ustr_ascii_compare_WithLength(refStr.pData->buffer, rtl_str_getLength(pAscii), pAscii);
- CPPUNIT_ASSERT_MESSAGE("ref string is bigger despite ascii length, compare failed, needs to be == 0.", value == 0);
- }
-
- void equal_ref_shorter()
- {
- rtl::OUString refStr(RTL_CONSTASCII_USTRINGPARAM("reference"));
- char const * pAscii = "referenceString";
-
- sal_Int32 value = rtl_ustr_ascii_compare_WithLength(refStr.pData->buffer, refStr.pData->length, pAscii);
- CPPUNIT_ASSERT_MESSAGE("ascii string is bigger, but only compared to ref length, needs to be 0.", value < 0);
- }
-
- void equal()
- {
- rtl::OUString refStr(RTL_CONSTASCII_USTRINGPARAM("reference"));
- char const * pAscii = "reference";
-
- sal_Int32 value = rtl_ustr_ascii_compare_WithLength(refStr.pData->buffer, refStr.pData->length, pAscii);
- CPPUNIT_ASSERT_MESSAGE("strings are equal, compare failed, needs to be 0.", value == 0);
- }
-
- void unequal_reference_bigger()
- {
- rtl::OUString refStr(RTL_CONSTASCII_USTRINGPARAM("defghi"));
- char const * pAscii = "abc";
-
- sal_Int32 value = rtl_ustr_ascii_compare_WithLength(refStr.pData->buffer, refStr.pData->length, pAscii);
- CPPUNIT_ASSERT_MESSAGE("strings are unequal and ref is bigger, needs to be >0.", value > 0);
- }
-
- void unequal_ascii_bigger()
- {
- rtl::OUString refStr(RTL_CONSTASCII_USTRINGPARAM("abc"));
- char const * pAscii = "defghi";
-
- sal_Int32 value = rtl_ustr_ascii_compare_WithLength(refStr.pData->buffer, refStr.pData->length, pAscii);
-
- CPPUNIT_ASSERT_MESSAGE("strings are unequal and ascii is bigger, needs to be <0.", value < 0);
- }
-
- CPPUNIT_TEST_SUITE(ascii_compare_WithLength);
- CPPUNIT_TEST(zero_length);
- CPPUNIT_TEST(equal_ascii_shorter);
- CPPUNIT_TEST(equal_ascii_shorter_asciiLength);
- CPPUNIT_TEST(equal_ref_shorter);
- CPPUNIT_TEST(equal);
- CPPUNIT_TEST(unequal_reference_bigger);
- CPPUNIT_TEST(unequal_ascii_bigger);
- CPPUNIT_TEST_SUITE_END();
- };
-
-
-
-
- class ascii_shortenedCompareIgnoreAsciiCase_WithLength : public CppUnit::TestFixture
- {
- public:
-
- void ascii_shortenedCompareIgnoreAsciiCase_WithLength_000()
- {
- rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( NULL, 0, NULL, 0);
- // should not GPF
- }
-
- void ascii_shortenedCompareIgnoreAsciiCase_WithLength_000_1()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
- rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), aStr1.getLength(), NULL, 0);
- // should not GPF
- }
- void ascii_shortenedCompareIgnoreAsciiCase_WithLength_000_2()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
- rtl::OString sStr2 = "Line is shorter.";
- rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), sStr2.getLength(), sStr2.getStr(), 0);
- // should not GPF
- }
- void ascii_shortenedCompareIgnoreAsciiCase_WithLength_001()
- {
- rtl::OUString suStr1;
- rtl::OString sStr2;
-
- sal_Int32 nValue = rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( suStr1, 0, sStr2.getStr(), 0);
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void ascii_shortenedCompareIgnoreAsciiCase_WithLength_002()
- {
- rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
- rtl::OString sStr2 = "Line must be equal.";
-
- sal_Int32 nValue = rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( suStr1.getStr(), suStr1.getLength(), sStr2.getStr(), sStr2.getLength());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void ascii_shortenedCompareIgnoreAsciiCase_WithLength_003()
- {
- rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must differ."));
- rtl::OString sStr2 = "Line must be differ and longer.";
-
- sal_Int32 nValue = rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( suStr1.getStr(), suStr1.getLength(), sStr2.getStr(), sStr2.getLength());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings differ.", nValue != 0);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(ascii_shortenedCompareIgnoreAsciiCase_WithLength);
- CPPUNIT_TEST(ascii_shortenedCompareIgnoreAsciiCase_WithLength_000);
- CPPUNIT_TEST(ascii_shortenedCompareIgnoreAsciiCase_WithLength_000_1);
- CPPUNIT_TEST(ascii_shortenedCompareIgnoreAsciiCase_WithLength_000_2);
- CPPUNIT_TEST(ascii_shortenedCompareIgnoreAsciiCase_WithLength_001);
- CPPUNIT_TEST(ascii_shortenedCompareIgnoreAsciiCase_WithLength_002);
- CPPUNIT_TEST(ascii_shortenedCompareIgnoreAsciiCase_WithLength_003);
- CPPUNIT_TEST_SUITE_END();
- }; // class ascii_shortenedCompareIgnoreAsciiCase_WithLength
-
-// -----------------------------------------------------------------------------
-
- class ascii_compareIgnoreAsciiCase_WithLength : public CppUnit::TestFixture
- {
- public:
-
- void ascii_compareIgnoreAsciiCase_WithLength_000()
- {
- rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( NULL, 0, NULL);
- // should not GPF
- }
-
- void ascii_compareIgnoreAsciiCase_WithLength_000_1()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
- rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( aStr1.getStr(), 0, NULL);
- // should not GPF
- }
- void ascii_compareIgnoreAsciiCase_WithLength_000_2()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
- rtl::OString sStr2 = "Line is shorter.";
- rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( aStr1.getStr(), sStr2.getLength(), sStr2.getStr());
- // should not GPF
- }
- void ascii_compareIgnoreAsciiCase_WithLength_001()
- {
- rtl::OUString suStr1;
- rtl::OString sStr2;
-
- sal_Int32 nValue = rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( suStr1, 0, sStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compareIgnoreAsciiCase_WithLength failed, strings are equal.", nValue == 0);
- }
-
- void ascii_compareIgnoreAsciiCase_WithLength_002()
- {
- rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
- rtl::OString sStr2 = "Line must be equal.";
-
- sal_Int32 nValue = rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( suStr1.getStr(), suStr1.getLength(), sStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void ascii_compareIgnoreAsciiCase_WithLength_003()
- {
- rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must differ."));
- rtl::OString sStr2 = "Line must be differ and longer.";
-
- sal_Int32 nValue = rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( suStr1.getStr(), suStr1.getLength(), sStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings differ.", nValue != 0);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(ascii_compareIgnoreAsciiCase_WithLength);
- CPPUNIT_TEST(ascii_compareIgnoreAsciiCase_WithLength_000);
- CPPUNIT_TEST(ascii_compareIgnoreAsciiCase_WithLength_000_1);
- CPPUNIT_TEST(ascii_compareIgnoreAsciiCase_WithLength_000_2);
- CPPUNIT_TEST(ascii_compareIgnoreAsciiCase_WithLength_001);
- CPPUNIT_TEST(ascii_compareIgnoreAsciiCase_WithLength_002);
- CPPUNIT_TEST(ascii_compareIgnoreAsciiCase_WithLength_003);
- CPPUNIT_TEST_SUITE_END();
- }; // class ascii_compareIgnoreAsciiCase_WithLength
-
-// -----------------------------------------------------------------------------
-
- class ascii_compare : public CppUnit::TestFixture
- {
- public:
-
- void ascii_compare_000()
- {
- rtl_ustr_ascii_compare( NULL, NULL);
- // should not GPF
- }
-
- void ascii_compare_000_1()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
- rtl_ustr_ascii_compare( aStr1.getStr(), NULL);
- // should not GPF
- }
- void ascii_compare_001()
- {
- rtl::OUString suStr1;
- rtl::OString sStr2;
-
- sal_Int32 nValue = rtl_ustr_ascii_compare( suStr1, sStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void ascii_compare_002()
- {
- rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
- rtl::OString sStr2 = "Line must be equal.";
-
- sal_Int32 nValue = rtl_ustr_ascii_compare( suStr1.getStr(), sStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void ascii_compare_003()
- {
- rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must differ."));
- rtl::OString sStr2 = "Line foo bar, ok, differ.";
-
- sal_Int32 nValue = rtl_ustr_ascii_compare( suStr1.getStr(), sStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings differ.", nValue != 0);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(ascii_compare);
- CPPUNIT_TEST(ascii_compare_000);
- CPPUNIT_TEST(ascii_compare_000_1);
- CPPUNIT_TEST(ascii_compare_001);
- CPPUNIT_TEST(ascii_compare_002);
- CPPUNIT_TEST(ascii_compare_003);
- CPPUNIT_TEST_SUITE_END();
- }; // class ascii_compare
-
-// -----------------------------------------------------------------------------
-
- class ascii_compareIgnoreAsciiCase : public CppUnit::TestFixture
- {
- public:
-
- void ascii_compareIgnoreAsciiCase_000()
- {
- rtl_ustr_ascii_compareIgnoreAsciiCase( NULL, NULL);
- // should not GPF
- }
-
- void ascii_compareIgnoreAsciiCase_000_1()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
- rtl_ustr_ascii_compareIgnoreAsciiCase( aStr1.getStr(), NULL);
- // should not GPF
- }
- void ascii_compareIgnoreAsciiCase_001()
- {
- rtl::OUString suStr1;
- rtl::OString sStr2;
-
- sal_Int32 nValue = rtl_ustr_ascii_compareIgnoreAsciiCase( suStr1, sStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void ascii_compareIgnoreAsciiCase_002()
- {
- rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
- rtl::OString sStr2 = "Line must be equal.";
-
- sal_Int32 nValue = rtl_ustr_ascii_compareIgnoreAsciiCase( suStr1.getStr(), sStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void ascii_compareIgnoreAsciiCase_002_1()
- {
- rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal, when ignore case."));
- rtl::OString sStr2 = "LINE MUST BE EQUAL, WHEN IGNORE CASE.";
-
- sal_Int32 nValue = rtl_ustr_ascii_compareIgnoreAsciiCase( suStr1.getStr(), sStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal (if case insensitve).", nValue == 0);
- }
-
- void ascii_compareIgnoreAsciiCase_003()
- {
- rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must differ."));
- rtl::OString sStr2 = "Line foo bar, ok, differ.";
-
- sal_Int32 nValue = rtl_ustr_ascii_compareIgnoreAsciiCase( suStr1.getStr(), sStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings differ.", nValue != 0);
- }
-
- //! LLA: some more tests with some high level strings
-
- // void ascii_compareIgnoreAsciiCase_001()
- // {
- // rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("change this to ascii upper case."));
- // rtl::OUString aShouldStr1(RTL_CONSTASCII_USTRINGPARAM("CHANGE THIS TO ASCII UPPER CASE."));
- //
- // sal_uInt32 nLength = suStr1.getLength() * sizeof(sal_Unicode);
- // sal_Unicode* pStr = (sal_Unicode*) malloc(nLength + sizeof(sal_Unicode)); // length + null terminator
- // CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
- // memset(pStr, 0, nLength + sizeof(sal_Unicode));
- // memcpy(pStr, suStr1.getStr(), nLength);
- //
- // rtl_ustr_ascii_compareIgnoreAsciiCase( pStr );
- // rtl::OUString suStr(pStr, suStr1.getLength());
- //
- // CPPUNIT_ASSERT_MESSAGE("failed", aShouldStr1.equals(suStr) == sal_True);
- // free(pStr);
- // }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(ascii_compareIgnoreAsciiCase);
- CPPUNIT_TEST(ascii_compareIgnoreAsciiCase_000);
- CPPUNIT_TEST(ascii_compareIgnoreAsciiCase_000_1);
- CPPUNIT_TEST(ascii_compareIgnoreAsciiCase_001);
- CPPUNIT_TEST(ascii_compareIgnoreAsciiCase_002);
- CPPUNIT_TEST(ascii_compareIgnoreAsciiCase_002_1);
- CPPUNIT_TEST(ascii_compareIgnoreAsciiCase_003);
- CPPUNIT_TEST_SUITE_END();
- }; // class ascii_compareIgnoreAsciiCase
-
-
- // sample out of inc/rtl/ustring.hxx
- // rtl_uString * pToken = NULL;
- // sal_Int32 nIndex = 0;
- // do
- // {
- // ...
- // nIndex = rtl_uString_getToken(&pToken, pStr, 0, ';', nIndex);
- // ...
- // }
- // while (nIndex >= 0);
-
- class getToken : public CppUnit::TestFixture
- {
- public:
-
- void getToken_000()
- {
- rtl_ustr_ascii_compareIgnoreAsciiCase( NULL, NULL);
- // should not GPF
- }
-
- void ascii_compareIgnoreAsciiCase_000_1()
- {
- rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
- rtl_ustr_ascii_compareIgnoreAsciiCase( aStr1.getStr(), NULL);
- // should not GPF
- }
- void ascii_compareIgnoreAsciiCase_001()
- {
- rtl::OUString suStr1;
- rtl::OString sStr2;
-
- sal_Int32 nValue = rtl_ustr_ascii_compareIgnoreAsciiCase( suStr1, sStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void ascii_compareIgnoreAsciiCase_002()
- {
- rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal."));
- rtl::OString sStr2 = "Line must be equal.";
-
- sal_Int32 nValue = rtl_ustr_ascii_compareIgnoreAsciiCase( suStr1.getStr(), sStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0);
- }
-
- void ascii_compareIgnoreAsciiCase_002_1()
- {
- rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal, when ignore case."));
- rtl::OString sStr2 = "LINE MUST BE EQUAL, WHEN IGNORE CASE.";
-
- sal_Int32 nValue = rtl_ustr_ascii_compareIgnoreAsciiCase( suStr1.getStr(), sStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal (if case insensitve).", nValue == 0);
- }
-
- void ascii_compareIgnoreAsciiCase_003()
- {
- rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must differ."));
- rtl::OString sStr2 = "Line foo bar, ok, differ.";
-
- sal_Int32 nValue = rtl_ustr_ascii_compareIgnoreAsciiCase( suStr1.getStr(), sStr2.getStr());
- CPPUNIT_ASSERT_MESSAGE("compare failed, strings differ.", nValue != 0);
- }
-
- //! LLA: some more tests with some high level strings
-
- // void ascii_compareIgnoreAsciiCase_001()
- // {
- // rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("change this to ascii upper case."));
- // rtl::OUString aShouldStr1(RTL_CONSTASCII_USTRINGPARAM("CHANGE THIS TO ASCII UPPER CASE."));
- //
- // sal_uInt32 nLength = suStr1.getLength() * sizeof(sal_Unicode);
- // sal_Unicode* pStr = (sal_Unicode*) malloc(nLength + sizeof(sal_Unicode)); // length + null terminator
- // CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
- // memset(pStr, 0, nLength + sizeof(sal_Unicode));
- // memcpy(pStr, suStr1.getStr(), nLength);
- //
- // rtl_ustr_ascii_compareIgnoreAsciiCase( pStr );
- // rtl::OUString suStr(pStr, suStr1.getLength());
- //
- // CPPUNIT_ASSERT_MESSAGE("failed", aShouldStr1.equals(suStr) == sal_True);
- // free(pStr);
- // }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(ascii_compareIgnoreAsciiCase);
- CPPUNIT_TEST(ascii_compareIgnoreAsciiCase_000);
- CPPUNIT_TEST(ascii_compareIgnoreAsciiCase_000_1);
- CPPUNIT_TEST(ascii_compareIgnoreAsciiCase_001);
- CPPUNIT_TEST(ascii_compareIgnoreAsciiCase_002);
- CPPUNIT_TEST(ascii_compareIgnoreAsciiCase_002_1);
- CPPUNIT_TEST(ascii_compareIgnoreAsciiCase_003);
- CPPUNIT_TEST_SUITE_END();
- }; // class ascii_compareIgnoreAsciiCase
-
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::compare, "rtl_ustr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::compareIgnoreAsciiCase, "rtl_ustr");
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::ascii_compare_WithLength, "rtl_ustr");
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::shortenedCompareIgnoreAsciiCase_WithLength, "rtl_ustr");
-// CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::hashCode, "rtl_ustr");
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::indexOfChar, "rtl_ustr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::lastIndexOfChar, "rtl_ustr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::indexOfStr, "rtl_ustr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::lastIndexOfStr, "rtl_ustr");
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::replaceChar, "rtl_ustr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::replaceChar_WithLength, "rtl_ustr");
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::toAsciiLowerCase, "rtl_ustr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::toAsciiLowerCase_WithLength, "rtl_ustr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::toAsciiUpperCase, "rtl_ustr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::toAsciiUpperCase_WithLength, "rtl_ustr");
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::trim_WithLength, "rtl_ustr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::valueOfChar, "rtl_ustr");
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::ascii_compare, "rtl_ustr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::ascii_compareIgnoreAsciiCase, "rtl_ustr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::ascii_compareIgnoreAsciiCase_WithLength, "rtl_ustr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_ustr::ascii_shortenedCompareIgnoreAsciiCase_WithLength, "rtl_ustr");
-
-} // namespace rtl_ustr
-
-// -----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-NOADDITIONAL;
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/oustring/rtl_ustr.xsce b/sal/qa/rtl/oustring/rtl_ustr.xsce
deleted file mode 100644
index 0c098eb83..000000000
--- a/sal/qa/rtl/oustring/rtl_ustr.xsce
+++ /dev/null
@@ -1,33 +0,0 @@
-# functions which are gpf
-
-rtl_ustr.compare.compare_000
-rtl_ustr.compare.compare_000_1
-
-rtl_ustr.compareIgnoreAsciiCase.compare_000
-rtl_ustr.compareIgnoreAsciiCase.compare_000_1
-
-rtl_ustr.indexOfChar.indexOfChar_000
-
-rtl_ustr.lastIndexOfChar.lastIndexOfChar_000
-
-rtl_ustr.indexOfStr.indexOfStr_000
-
-rtl_ustr.lastIndexOfStr.lastIndexOfStr_000
-
-rtl_ustr.replaceChar.replaceChar_000
-
-rtl_ustr.replaceChar_WithLength.replaceChar_WithLength_000_1
-
-rtl_ustr.toAsciiLowerCase.toAsciiLowerCase_000
-
-rtl_ustr.toAsciiUpperCase.toAsciiUpperCase_000
-
-rtl_ustr.valueOfChar.valueOfChar_000
-
-rtl_ustr.ascii_compare.ascii_compare_000
-rtl_ustr.ascii_compare.ascii_compare_000_1
-rtl_ustr.ascii_compareIgnoreAsciiCase.ascii_compareIgnoreAsciiCase_000
-rtl_ustr.ascii_compareIgnoreAsciiCase.ascii_compareIgnoreAsciiCase_000_1
-rtl_ustr.ascii_compareIgnoreAsciiCase_WithLength.ascii_compareIgnoreAsciiCase_WithLength_000
-rtl_ustr.ascii_compareIgnoreAsciiCase_WithLength.ascii_compareIgnoreAsciiCase_WithLength_000_1
-
diff --git a/sal/qa/rtl/oustringbuffer/makefile.mk b/sal/qa/rtl/oustringbuffer/makefile.mk
deleted file mode 100644
index 0db90281a..000000000
--- a/sal/qa/rtl/oustringbuffer/makefile.mk
+++ /dev/null
@@ -1,57 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ := ..$/..$/..
-PRJNAME := sal
-
-TARGET := qa_rtl_oustringbuffer
-
-ENABLE_EXCEPTIONS := TRUE
-
-.INCLUDE: settings.mk
-
-.IF "$(OS)" == "IOS"
-CFLAGSCXX += -DCPPUNIT_PLUGIN_EXPORTED_NAME=cppunitTest_$(TARGET)
-.ENDIF
-
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
-
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-
-SHL1TARGET := $(TARGET)
-SHL1OBJS := \
- $(SLO)$/test_oustringbuffer_utf32.obj \
- $(SLO)$/test_oustringbuffer_tostring.obj \
- $(SLO)$/test_oustringbuffer_noadditional.obj
-SHL1IMPLIB := i$(SHL1TARGET)
-SHL1STDLIBS := $(SALLIB) $(CPPUNITLIB)
-SHL1VERSIONMAP := $(PRJ)$/qa$/export.map
-DEF1NAME := $(SHL1TARGET)
-
-.INCLUDE: target.mk
-.INCLUDE: $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_noadditional.cxx b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_noadditional.cxx
deleted file mode 100644
index 18e8a6344..000000000
--- a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_noadditional.cxx
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-#include <cppunit/plugin/TestPlugIn.h>
-
-CPPUNIT_PLUGIN_IMPLEMENT();
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_tostring.cxx b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_tostring.cxx
deleted file mode 100644
index df38ce629..000000000
--- a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_tostring.cxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/TestAssert.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include "rtl/ustrbuf.hxx"
-#include "rtl/ustring.hxx"
-
-namespace test { namespace oustringbuffer {
-
-class ToString: public CppUnit::TestFixture {
-private:
- void testToString();
-
- CPPUNIT_TEST_SUITE(ToString);
- CPPUNIT_TEST(testToString);
- CPPUNIT_TEST_SUITE_END();
-};
-
-} }
-
-CPPUNIT_TEST_SUITE_REGISTRATION(test::oustringbuffer::ToString);
-
-void test::oustringbuffer::ToString::testToString() {
- rtl::OUStringBuffer sb(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("test string")));
- rtl::OUString str = sb.toString();
- CPPUNIT_ASSERT(str.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("test string")));
- // returned OUString must be independent from sb
- sb.append( (sal_Unicode)'a' );
- CPPUNIT_ASSERT(str.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("test string")));
- sb.setLength(0);
- CPPUNIT_ASSERT(str.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("test string")));
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx
deleted file mode 100644
index a7609c5d4..000000000
--- a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx
+++ /dev/null
@@ -1,136 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/TestAssert.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include "rtl/strbuf.hxx"
-#include "rtl/ustrbuf.hxx"
-#include "rtl/ustring.h"
-#include "rtl/ustring.hxx"
-
-namespace test { namespace oustringbuffer {
-
-class Utf32: public CppUnit::TestFixture {
-private:
- void appendUtf32();
-
- void insertUtf32();
-
- CPPUNIT_TEST_SUITE(Utf32);
- CPPUNIT_TEST(appendUtf32);
- CPPUNIT_TEST(insertUtf32);
- CPPUNIT_TEST_SUITE_END();
-};
-
-} }
-
-CPPUNIT_TEST_SUITE_REGISTRATION(test::oustringbuffer::Utf32);
-
-namespace {
-
-void appendString(rtl::OStringBuffer & buffer, rtl::OUString const & string) {
- buffer.append('"');
- for (int i = 0; i < string.getLength(); ++i) {
- buffer.append(RTL_CONSTASCII_STRINGPARAM("\\u"));
- sal_Unicode c = string[i];
- if (c < 0x1000) {
- buffer.append('0');
- if (c < 0x100) {
- buffer.append('0');
- if (c < 0x10) {
- buffer.append('0');
- }
- }
- }
- buffer.append(
- static_cast< sal_Int32 >(c), static_cast< sal_Int16 >(16));
- }
- buffer.append('"');
-}
-
-void createMessage(
- rtl::OStringBuffer & message, rtl::OUString const & string1,
- rtl::OUString const & string2)
-{
- message.setLength(0);
- appendString(message, string1);
- message.append(RTL_CONSTASCII_STRINGPARAM(" vs. "));
- appendString(message, string2);
-}
-
-}
-
-void test::oustringbuffer::Utf32::appendUtf32() {
- int const str1Len = 3;
- sal_Unicode const str1[str1Len] = { 'a', 'b', 'c' };
- int const str2Len = 4;
- sal_Unicode const str2[str2Len] = { 'a', 'b', 'c', 'd' };
- int const str3Len = 6;
- sal_Unicode const str3[str3Len] = { 'a', 'b', 'c', 'd', 0xD800, 0xDC00 };
- rtl::OStringBuffer message;
- rtl::OUStringBuffer buf1(rtl::OUString(str1, str1Len));
- buf1.appendUtf32('d');
- rtl::OUString res1(buf1.makeStringAndClear());
- createMessage(message, res1, rtl::OUString(str2, str2Len));
- CPPUNIT_ASSERT_MESSAGE(
- (const char *) message.getStr(), res1 == rtl::OUString(str2, str2Len));
- rtl::OUStringBuffer buf2(rtl::OUString(str2, str2Len));
- buf2.appendUtf32(0x10000);
- rtl::OUString res2(buf2.makeStringAndClear());
- createMessage(message, res2, rtl::OUString(str3, str3Len));
- CPPUNIT_ASSERT_MESSAGE(
- (const char *)message.getStr(), res2 == rtl::OUString(str3, str3Len));
-}
-
-void test::oustringbuffer::Utf32::insertUtf32() {
- int const str1Len = 3;
- sal_Unicode const str1[str1Len] = { 'a', 'b', 'c' };
- int const str2Len = 4;
- sal_Unicode const str2[str2Len] = { 'a', 'b', 'd', 'c' };
- int const str3Len = 6;
- sal_Unicode const str3[str3Len] = { 'a', 'b', 0xDBFF, 0xDFFF, 'd', 'c' };
- rtl::OStringBuffer message;
- rtl::OUStringBuffer buf1(rtl::OUString(str1, str1Len));
- buf1.insertUtf32(2, 'd');
- rtl::OUString res1(buf1.makeStringAndClear());
- createMessage(message, res1, rtl::OUString(str2, str2Len));
- CPPUNIT_ASSERT_MESSAGE(
- (const char *) message.getStr(), res1 == rtl::OUString(str2, str2Len));
- rtl::OUStringBuffer buf2(rtl::OUString(str2, str2Len));
- buf2.insertUtf32(2, 0x10FFFF);
- rtl::OUString res2(buf2.makeStringAndClear());
- createMessage(message, res2, rtl::OUString(str3, str3Len));
- CPPUNIT_ASSERT_MESSAGE(
- (const char *) message.getStr(), res2 == rtl::OUString(str3, str3Len));
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/process/child_process.cxx b/sal/qa/rtl/process/child_process.cxx
deleted file mode 100644
index 186860acf..000000000
--- a/sal/qa/rtl/process/child_process.cxx
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-#include <stdio.h>
-#include "sal/main.h"
-#include <rtl/process.h>
-#include <rtl_Process_Const.h>
-
-using namespace ::rtl;
-
-// ----------------------------------- Main -----------------------------------
-SAL_IMPLEMENT_MAIN_WITH_ARGS(, argv)
-{
- printf("# %s is called.\n", argv[0]);
-
- sal_Int32 nCount = rtl_getAppCommandArgCount();
- if ( nCount != 4 )
- {
- printf(
- "# not enough arguments found, need 4 found %ld.\n",
- sal::static_int_cast< long >(nCount));
- return 0;
- }
-
- OUString suArg[4];
- for( sal_Int32 i = 0 ; i < nCount ; i ++ )
- {
- rtl_getAppCommandArg( i , &(suArg[i].pData) );
- rtl::OString aString;
- aString = ::rtl::OUStringToOString( suArg[i], RTL_TEXTENCODING_ASCII_US );
- printf(
- "# Parameter[%ld] is %s\n", sal::static_int_cast< long >(i),
- aString.getStr());
- }
-
- if ( suArg[0].compareTo( suParam0) != 0 ||
- suArg[1].compareTo( suParam1) != 0 ||
- suArg[2].compareTo( suParam2) != 0 ||
- suArg[3].compareTo( suParam3) != 0 )
- {
- return 0;
- }
- return 2;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/process/child_process_id.cxx b/sal/qa/rtl/process/child_process_id.cxx
deleted file mode 100644
index 8431e867e..000000000
--- a/sal/qa/rtl/process/child_process_id.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-#include <stdio.h>
-#include "sal/main.h"
-#include <rtl/process.h>
-#include <rtl_Process_Const.h>
-
-void printUuid( sal_uInt8 *pNode )
-{
- for( sal_Int32 i1 = 0 ; i1 < 4 ; i1++ )
- {
- for( sal_Int32 i2 = 0 ; i2 < 4 ; i2++ )
- {
- sal_uInt8 nValue = pNode[i1*4 +i2];
- if (nValue < 16)
- {
- printf( "0");
- }
- printf( "%02x" ,nValue );
- }
- if( i1 == 3 )
- break;
- //printf( "-" );
- }
-}
-
-// ----------------------------------- Main -----------------------------------
-
-SAL_IMPLEMENT_MAIN()
-{
- sal_uInt8 pTargetUUID[16];
- rtl_getGlobalProcessId( pTargetUUID );
- printUuid( pTargetUUID );
- return 1;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/process/makefile.mk b/sal/qa/rtl/process/makefile.mk
deleted file mode 100644
index e3a26c931..000000000
--- a/sal/qa/rtl/process/makefile.mk
+++ /dev/null
@@ -1,76 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-INCPRE+= $(PRJ)$/qa$/inc
-
-PRJNAME=sal
-TARGET=rtl_Process
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
-
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-
-# BEGIN ----------------------------------------------------------------
-# auto generated Target:joblist by codegen.pl
-SHL1OBJS= \
- $(SLO)$/rtl_Process.obj
-
-SHL1TARGET= rtl_Process
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-
-DEF1NAME =$(SHL1TARGET)
-SHL1VERSIONMAP= $(PRJ)$/qa$/export.map
-# END ------------------------------------------------------------------
-
-OBJ3FILES=$(OBJ)$/child_process.obj
-APP3TARGET=child_process
-APP3OBJS=$(OBJ3FILES)
-APP3STDLIBS=$(SALLIB)
-
-OBJ4FILES=$(OBJ)$/child_process_id.obj
-APP4TARGET=child_process_id
-APP4OBJS=$(OBJ4FILES)
-APP4STDLIBS=$(SALLIB)
-
-#------------------------------- All object files -------------------------------
-# do this here, so we get right dependencies
-SLOFILES=$(SHL1OBJS)
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/process/rtl_Process.cxx b/sal/qa/rtl/process/rtl_Process.cxx
deleted file mode 100644
index f51a6edaf..000000000
--- a/sal/qa/rtl/process/rtl_Process.cxx
+++ /dev/null
@@ -1,302 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sal/types.h>
-
-#include <testshl/simpleheader.hxx>
-#include <rtl/ustring.hxx>
-#include <rtl/string.hxx>
-#include <rtl/process.h>
-#include <osl/process.h>
-#include <osl/module.hxx>
-
-#include "rtl_Process_Const.h"
-
-using namespace osl;
-
-using ::rtl::OUString;
-using ::rtl::OString;
-using ::rtl::OUStringToOString;
-
-/** print a UNI_CODE String. And also print some comments of the string.
-*/
-inline void printUString( const ::rtl::OUString & str, const sal_Char * msg = NULL )
-{
- if ( msg != NULL )
- {
- t_print("#%s #printUString_u# ", msg );
- }
- rtl::OString aString;
- aString = ::rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US );
- t_print("%s\n", (char *)aString.getStr( ) );
-}
-
-// -----------------------------------------------------------------------------
-inline ::rtl::OUString getModulePath( void )
-{
- ::rtl::OUString suDirPath;
- ::osl::Module::getUrlFromAddress(
- reinterpret_cast< oslGenericFunction >(getModulePath), suDirPath );
-
- printUString(suDirPath, "modulePath:");
- suDirPath = suDirPath.copy( 0, suDirPath.lastIndexOf('/') );
- suDirPath = suDirPath.copy( 0, suDirPath.lastIndexOf('/') + 1);
- suDirPath += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bin"));
- return suDirPath;
-}
-
-// -----------------------------------------------------------------------------
-
-namespace rtl_Process
-{
-class getAppCommandArg : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void getAppCommandArg_001()
- {
-#if defined(WNT)
- const rtl::OUString EXECUTABLE_NAME(RTL_CONSTASCII_USTRINGPARAM("child_process.exe"));
-#else
- const rtl::OUString EXECUTABLE_NAME(RTL_CONSTASCII_USTRINGPARAM("child_process"));
-#endif
- rtl::OUString suCWD = getModulePath();
- // rtl::OUString suCWD2 = getExecutableDirectory();
-
- printUString(suCWD, "path to the current module");
- // printUString(suCWD2, "suCWD2");
-
- oslProcess hProcess = NULL;
-
- const int nParameterCount = 4;
- rtl_uString* pParameters[ nParameterCount ];
-
- pParameters[0] = suParam0.pData;
- pParameters[1] = suParam1.pData;
- pParameters[2] = suParam2.pData;
- pParameters[3] = suParam3.pData;
-
- rtl::OUString suFileURL = suCWD;
- suFileURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
- suFileURL += EXECUTABLE_NAME;
-
- oslProcessError osl_error = osl_executeProcess(
- suFileURL.pData,
- pParameters,
- nParameterCount,
- osl_Process_WAIT,
- 0, /* osl_getCurrentSecurity() */
- suCWD.pData,
- NULL,
- 0,
- &hProcess );
-
- CPPUNIT_ASSERT_MESSAGE
- (
- "osl_createProcess failed",
- osl_error == osl_Process_E_None
- );
- //we could get return value only after the process terminated
- osl_joinProcess(hProcess);
- // CPPUNIT_ASSERT_MESSAGE
- // (
- // "osl_joinProcess returned with failure",
- // osl_Process_E_None == osl_error
- // );
- oslProcessInfo* pInfo = new oslProcessInfo;
- //please pay attention to initial the Size to sizeof(oslProcessInfo), or else
- //you will get unknow error when call osl_getProcessInfo
- pInfo->Size = sizeof(oslProcessInfo);
- osl_error = osl_getProcessInfo( hProcess, osl_Process_EXITCODE, pInfo );
- CPPUNIT_ASSERT_MESSAGE
- (
- "osl_getProcessInfo returned with failure",
- osl_Process_E_None == osl_error
- );
-
- t_print("the exit code is %d.\n", pInfo->Code );
- CPPUNIT_ASSERT_MESSAGE("rtl_getAppCommandArg or rtl_getAppCommandArgCount error.", pInfo->Code == 2);
- delete pInfo;
- }
-
-
- CPPUNIT_TEST_SUITE(getAppCommandArg);
- CPPUNIT_TEST(getAppCommandArg_001);
- // CPPUNIT_TEST(getAppCommandArg_002);
- CPPUNIT_TEST_SUITE_END();
-}; // class getAppCommandArg
-
-/************************************************************************
- * For diagnostics( from sal/test/testuuid.cxx )
- ************************************************************************/
-void printUuid( sal_uInt8 *pNode )
-{
- printf("# UUID is: ");
- for( sal_Int32 i1 = 0 ; i1 < 4 ; i1++ )
- {
- for( sal_Int32 i2 = 0 ; i2 < 4 ; i2++ )
- {
- sal_uInt8 nValue = pNode[i1*4 +i2];
- if (nValue < 16)
- {
- printf( "0");
- }
- printf( "%02x" ,nValue );
- }
- if( i1 == 3 )
- break;
- printf( "-" );
- }
- printf("\n");
-}
-
-/**************************************************************************
- * output UUID to a string
- **************************************************************************/
-void printUuidtoBuffer( sal_uInt8 *pNode, sal_Char * pBuffer )
-{
- sal_Int8 nPtr = 0;
- for( sal_Int32 i1 = 0 ; i1 < 16 ; i1++ )
- {
- sal_uInt8 nValue = pNode[i1];
- if (nValue < 16)
- {
- sprintf( (sal_Char *)(pBuffer + nPtr), "0");
- nPtr++;
- }
- sprintf( (sal_Char *)(pBuffer + nPtr), "%02x", nValue );
- nPtr += 2 ;
- }
-}
-
-class getGlobalProcessId : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
- //gets a 16-byte fixed size identifier which is guaranteed not to change during the current process.
- void getGlobalProcessId_001()
- {
- sal_uInt8 pTargetUUID1[16];
- sal_uInt8 pTargetUUID2[16];
- rtl_getGlobalProcessId( pTargetUUID1 );
- rtl_getGlobalProcessId( pTargetUUID2 );
- CPPUNIT_ASSERT_MESSAGE("getGlobalProcessId: got two same ProcessIds.", !memcmp( pTargetUUID1 , pTargetUUID2 , 16 ) );
- }
- //different processes different pids
- void getGlobalProcessId_002()
- {
-#if defined(WNT)
- const rtl::OUString EXEC_NAME(RTL_CONSTASCII_USTRINGPARAM("child_process_id.exe"));
-#else
- const rtl::OUString EXEC_NAME(RTL_CONSTASCII_USTRINGPARAM("child_process_id"));
-#endif
- sal_uInt8 pTargetUUID1[16];
- rtl_getGlobalProcessId( pTargetUUID1 );
- printUuid( pTargetUUID1 );
- sal_Char pUUID1[32];
- printUuidtoBuffer( pTargetUUID1, pUUID1 );
- printf("# UUID to String is %s\n", pUUID1);
-
- rtl::OUString suCWD = getModulePath();
- oslProcess hProcess = NULL;
- rtl::OUString suFileURL = suCWD;
- suFileURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
- suFileURL += EXEC_NAME;
- oslFileHandle* pChildOutputRead = new oslFileHandle();
- oslProcessError osl_error = osl_executeProcess_WithRedirectedIO(
- suFileURL.pData,
- NULL,
- 0,
- osl_Process_WAIT,
- 0,
- suCWD.pData,
- NULL,
- 0,
- &hProcess,
- NULL,
- pChildOutputRead,
- NULL);
-
- CPPUNIT_ASSERT_MESSAGE
- (
- "osl_createProcess failed",
- osl_error == osl_Process_E_None
- );
- //we could get return value only after the process terminated
- osl_joinProcess(hProcess);
-
- sal_Char pUUID2[33];
- pUUID2[32] = '\0';
- sal_uInt64 nRead = 0;
- osl_readFile( *pChildOutputRead, pUUID2, 32, &nRead );
- t_print("read buffer is %s, nRead is %d \n", pUUID2, nRead );
- OUString suUUID2 = OUString::createFromAscii( pUUID2 );
- CPPUNIT_ASSERT_MESSAGE("getGlobalProcessId: got two same ProcessIds.", suUUID2.equalsAsciiL( pUUID1, 32) == sal_False );
- }
-
- CPPUNIT_TEST_SUITE(getGlobalProcessId);
- CPPUNIT_TEST(getGlobalProcessId_001);
- CPPUNIT_TEST(getGlobalProcessId_002);
- CPPUNIT_TEST_SUITE_END();
-
-}; // class getGlobalProcessId
-
-} // namespace rtl_Process
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Process::getAppCommandArg, "rtl_Process");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Process::getGlobalProcessId, "rtl_Process");
-
-
-// -----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-NOADDITIONAL;
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/process/rtl_Process_Const.h b/sal/qa/rtl/process/rtl_Process_Const.h
deleted file mode 100644
index 106af3c73..000000000
--- a/sal/qa/rtl/process/rtl_Process_Const.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-
-#ifndef _RTL_PROCESS_CONST_H_
-#define _RTL_PROCESS_CONST_H_
-
-//------------------------------------------------------------------------
-#include <rtl/ustring.hxx>
-
-using namespace ::rtl;
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-//------------------------------------------------------------------------
-::rtl::OUString suParam0(RTL_CONSTASCII_USTRINGPARAM("-join"));
-::rtl::OUString suParam1(RTL_CONSTASCII_USTRINGPARAM("-with"));
-::rtl::OUString suParam2(RTL_CONSTASCII_USTRINGPARAM("-child"));
-::rtl::OUString suParam3(RTL_CONSTASCII_USTRINGPARAM("-process"));
-
-//------------------------------------------------------------------------
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* RTL_PROCESS_CONST_H*/
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/random/makefile.add b/sal/qa/rtl/random/makefile.add
deleted file mode 100644
index eb45c312e..000000000
--- a/sal/qa/rtl/random/makefile.add
+++ /dev/null
@@ -1,19 +0,0 @@
-# BEGIN ----------------------------------------------------------------
-# auto generated Target:job by codegen.pl
-SHL1OBJS= \
- $(SLO)$/rtl_random.obj
-
-SHL1TARGET= job
-SHL1STDLIBS=\
- $(SALLIB) \
- $(CPPUNITLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-# SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME =$(SHL1TARGET)
-# DEF1EXPORTFILE= export.exp
-SHL1VERSIONMAP= export.map
-# auto generated Target:job
-# END ------------------------------------------------------------------
-
diff --git a/sal/qa/rtl/random/makefile.mk b/sal/qa/rtl/random/makefile.mk
deleted file mode 100644
index ef5a86ced..000000000
--- a/sal/qa/rtl/random/makefile.mk
+++ /dev/null
@@ -1,58 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-PRJ=..$/..$/..
-
-PRJNAME=sal
-TARGET=qa_rtl_random
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-DLLPRE = # no leading "lib" on .so files
-
-SHL1OBJS= \
- $(SLO)$/rtl_random.obj
-
-SHL1TARGET= rtl_Random
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-DEF1NAME =$(SHL1TARGET)
-SHL1VERSIONMAP= $(PRJ)$/qa$/export.map
-
-#------------------------------- All object files -------------------------------
-SLOFILES= \
- $(SHL1OBJS)
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/random/random.txt b/sal/qa/rtl/random/random.txt
deleted file mode 100644
index d7eb1f1b2..000000000
--- a/sal/qa/rtl/random/random.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-rtl_random.createPool.createPool_001
-rtl_random.destroyPool.destroyPool_001
-rtl_random.addBytes.addBytes_001
-rtl_random.getBytes.getBytes_001
-
diff --git a/sal/qa/rtl/random/rtl_random.cxx b/sal/qa/rtl/random/rtl_random.cxx
deleted file mode 100644
index 411e89732..000000000
--- a/sal/qa/rtl/random/rtl_random.cxx
+++ /dev/null
@@ -1,418 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-#include <algorithm>
-
-#include <cppunit/TestAssert.h>
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
-
-#include <osl/diagnose.h>
-#include <rtl/random.h>
-
-#include <string.h>
-
-namespace rtl_random
-{
-
-class createPool : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- // insert your test code here.
- // this is only demonstration code
- void createPool_001()
- {
- // this is demonstration code
-
- rtlRandomPool aPool = rtl_random_createPool();
-
- // LLA: seems to be that an other test is not possible for createPool()
- CPPUNIT_ASSERT_MESSAGE("create failed", aPool != NULL);
-
- rtl_random_destroyPool(aPool);
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(createPool);
- CPPUNIT_TEST(createPool_001);
- CPPUNIT_TEST_SUITE_END();
-}; // class createPool
-
-
-class destroyPool : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- // insert your test code here.
- void destroyPool_000()
- {
- // GPF, if failed
- rtl_random_destroyPool(NULL);
- }
-
- void destroyPool_001()
- {
- rtlRandomPool aPool = rtl_random_createPool();
-
- // LLA: seems to be that an other test is not possible for createPool()
- CPPUNIT_ASSERT_MESSAGE("create failed", aPool != NULL);
-
- rtl_random_destroyPool(aPool);
- }
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(destroyPool);
- CPPUNIT_TEST(destroyPool_000);
- CPPUNIT_TEST(destroyPool_001);
- CPPUNIT_TEST_SUITE_END();
-}; // class destroyPool
-
-
-class addBytes : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- // insert your test code here.
- // this is only demonstration code
- void addBytes_000()
- {
- rtlRandomPool aPool = rtl_random_createPool();
-
- sal_uInt32 nBufLen = 4;
- sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen ];
- memset(pBuffer, 0, nBufLen);
-
- rtlRandomError aError = rtl_random_addBytes(NULL, NULL, 0);
- CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_Argument);
-
- /* rtlRandomError */ aError = rtl_random_addBytes(aPool, NULL, 0);
- CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_Argument);
-
- /* rtlRandomError */ aError = rtl_random_addBytes(aPool, pBuffer, nBufLen);
- CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None);
-
- rtl_random_destroyPool(aPool);
- delete [] pBuffer;
-
- }
-
- void addBytes_001()
- {
- rtlRandomPool aPool = rtl_random_createPool();
-
- sal_uInt32 nBufLen = 4;
- sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen ];
-
- memset(pBuffer, 0, nBufLen);
-
- rtl_random_addBytes(aPool, pBuffer, nBufLen);
-
- printf("%2x %2x %2x %2x\n", pBuffer[0], pBuffer[1], pBuffer[2], pBuffer[3]);
-
- rtl_random_destroyPool(aPool);
- delete [] pBuffer;
- }
-
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(addBytes);
- CPPUNIT_TEST(addBytes_000);
- CPPUNIT_TEST(addBytes_001);
- CPPUNIT_TEST_SUITE_END();
-}; // class addBytes
-
-
-class Statistics
-{
- int m_nDispensation[256];
-
- int m_nMin;
- int m_nMax;
- int m_nAverage;
- int m_nMinDeviation;
- int m_nMaxDeviation;
-
-public:
- void clearDispensation()
- {
- for (int i = 0;i < 256;++i) // clear array
- {
- m_nDispensation[i] = 0;
- }
- }
- Statistics()
- : m_nMin(0)
- , m_nMax(0)
- , m_nAverage(0)
- , m_nMinDeviation(0)
- , m_nMaxDeviation(0)
- {
- clearDispensation();
- }
- ~Statistics(){}
-
- void addValue(sal_Int16 _nIndex, sal_Int32 _nValue)
- {
- OSL_ASSERT(_nIndex >= 0 && _nIndex < 256);
- m_nDispensation[_nIndex] += _nValue;
- }
-
- void build(sal_Int32 _nCountMax)
- {
- m_nMin = _nCountMax;
- m_nMax = 0;
-
- m_nAverage = _nCountMax / 256;
-
- m_nMinDeviation = _nCountMax;
- m_nMaxDeviation = 0;
-
- for (int i = 0;i < 256;++i) // show dispensation
- {
- m_nMin = std::min(m_nMin, m_nDispensation[i]);
- m_nMax = std::max(m_nMax, m_nDispensation[i]);
-
- m_nMinDeviation = std::min(m_nMinDeviation, abs(m_nAverage - m_nDispensation[i]));
- m_nMaxDeviation = std::max(m_nMaxDeviation, abs(m_nAverage - m_nDispensation[i]));
- }
- }
-
- void print()
- {
- // LLA: these are only info values
- printf("\nSome statistics\n");
- printf("Min: %d\n", m_nMin);
- printf("Max: %d\n", m_nMax);
- printf("Average: %d\n", m_nAverage);
- printf("Min abs deviation: %d\n", m_nMinDeviation);
- printf("Max abs deviation: %d\n", m_nMaxDeviation);
- }
-
- sal_Int32 getAverage() const {return m_nAverage;}
- sal_Int32 getMaxDeviation() const {return m_nMaxDeviation;}
-
-};
-
-class getBytes : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- // insert your test code here.
- void getBytes_000()
- {
- rtlRandomPool aPool = rtl_random_createPool();
-
- sal_uInt32 nBufLen = 4;
- sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen ];
- memset(pBuffer, 0, nBufLen);
-
- rtlRandomError aError = rtl_random_getBytes(NULL, NULL, 0);
- CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_Argument);
-
- /* rtlRandomError */ aError = rtl_random_getBytes(aPool, NULL, 0);
- CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_Argument);
-
- /* rtlRandomError */ aError = rtl_random_getBytes(aPool, pBuffer, nBufLen);
- CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None);
-
- rtl_random_destroyPool(aPool);
- delete [] pBuffer;
- }
-
- void getBytes_001()
- {
- rtlRandomPool aPool = rtl_random_createPool();
-
- sal_uInt32 nBufLen = 4;
- sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen ];
- memset(pBuffer, 0, nBufLen);
-
- rtlRandomError aError = rtl_random_getBytes(aPool, pBuffer, nBufLen);
- CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None);
-
- printf("%2x %2x %2x %2x\n", pBuffer[0], pBuffer[1], pBuffer[2], pBuffer[3]);
-
- rtl_random_destroyPool(aPool);
- delete [] pBuffer;
- }
-
- void getBytes_002()
- {
- rtlRandomPool aPool = rtl_random_createPool();
-
- sal_uInt32 nBufLen = 4;
- sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen << 1 ];
- memset(pBuffer, 0, nBufLen << 1);
-
- CPPUNIT_ASSERT_MESSAGE("memset failed", pBuffer[4] == 0 && pBuffer[5] == 0 && pBuffer[6] == 0 && pBuffer[7] == 0);
-
- rtlRandomError aError = rtl_random_getBytes(aPool, pBuffer, nBufLen);
- CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None);
-
- printf("%2x %2x %2x %2x %2x %2x %2x %2x\n", pBuffer[0], pBuffer[1], pBuffer[2], pBuffer[3], pBuffer[4], pBuffer[5], pBuffer[6], pBuffer[7]);
-
- CPPUNIT_ASSERT_MESSAGE("internal memory overwrite", pBuffer[4] == 0 && pBuffer[5] == 0 && pBuffer[6] == 0 && pBuffer[7] == 0);
-
- rtl_random_destroyPool(aPool);
- delete [] pBuffer;
- }
-
- void getBytes_003()
- {
- rtlRandomPool aPool = rtl_random_createPool();
-
- sal_uInt32 nBufLen = 1;
- sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen ];
- memset(pBuffer, 0, nBufLen);
-
- Statistics aStat;
-
- CPPUNIT_ASSERT_MESSAGE("memset failed", pBuffer[0] == 0);
-
- int nCount = 0;
-
- int nCountMax = 1000000;
- for(nCount = 0;nCount < nCountMax; ++nCount) // run 100000000 through getBytes(...)
- {
- /* rtlRandomError aError = */ rtl_random_getBytes(aPool, pBuffer, nBufLen);
- /* CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None); */
-
- aStat.addValue(pBuffer[0], 1);
- }
-
- aStat.build(nCountMax);
- aStat.print();
-
- CPPUNIT_ASSERT_MESSAGE("deviation should be less average", aStat.getMaxDeviation() < aStat.getAverage());
-
- rtl_random_destroyPool(aPool);
- delete [] pBuffer;
- }
-
- void getBytes_003_1()
- {
- rtlRandomPool aPool = rtl_random_createPool();
-
- sal_uInt32 nBufLen = 256;
- sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen ];
- memset(pBuffer, 0, nBufLen);
-
- Statistics aStat;
-
- CPPUNIT_ASSERT_MESSAGE("memset failed", pBuffer[0] == 0);
-
- int nCount = 0;
-
- int nCountMax = 10000;
- for(nCount = 0;nCount < nCountMax; ++nCount) // run 100000000 through getBytes(...)
- {
- /* rtlRandomError aError = */ rtl_random_getBytes(aPool, pBuffer, nBufLen);
- // CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None);
-
- for (sal_uInt32 i=0;i<nBufLen;++i)
- aStat.addValue(pBuffer[i], 1);
- }
-
- aStat.build(nCountMax * nBufLen);
- aStat.print();
-
- CPPUNIT_ASSERT_MESSAGE("deviation should be less average", aStat.getMaxDeviation() < aStat.getAverage());
-
- rtl_random_destroyPool(aPool);
- delete [] pBuffer;
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(getBytes);
- CPPUNIT_TEST(getBytes_000);
- CPPUNIT_TEST(getBytes_001);
- CPPUNIT_TEST(getBytes_002);
- CPPUNIT_TEST(getBytes_003);
- CPPUNIT_TEST(getBytes_003_1);
- CPPUNIT_TEST_SUITE_END();
-}; // class getBytes
-
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_random::createPool);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_random::destroyPool);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_random::addBytes);
-CPPUNIT_TEST_SUITE_REGISTRATION(rtl_random::getBytes);
-} // namespace rtl_random
-
-CPPUNIT_PLUGIN_IMPLEMENT();
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/strings/makefile.mk b/sal/qa/rtl/strings/makefile.mk
deleted file mode 100644
index c58476e59..000000000
--- a/sal/qa/rtl/strings/makefile.mk
+++ /dev/null
@@ -1,58 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ := ..$/..$/..
-PRJNAME := sal
-
-TARGET := qa_rtl_strings
-
-ENABLE_EXCEPTIONS := TRUE
-
-.INCLUDE: settings.mk
-
-.IF "$(OS)" == "IOS"
-CFLAGSCXX += -DCPPUNIT_PLUGIN_EXPORTED_NAME=cppunitTest_$(TARGET)
-.ENDIF
-
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
-
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-
-SHL1TARGET := $(TARGET)
-SHL1OBJS := \
- $(SLO)$/test_oustring_compare.obj \
- $(SLO)$/test_oustring_convert.obj \
- $(SLO)$/test_oustring_endswith.obj \
- $(SLO)$/test_oustring_noadditional.obj
-SHL1IMPLIB := i$(SHL1TARGET)
-SHL1STDLIBS := $(SALLIB) $(CPPUNITLIB)
-SHL1VERSIONMAP := $(PRJ)$/qa$/export.map
-DEF1NAME := $(SHL1TARGET)
-
-.INCLUDE: target.mk
-.INCLUDE: $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/strings/test_oustring_compare.cxx b/sal/qa/rtl/strings/test_oustring_compare.cxx
deleted file mode 100644
index 1d4246d5e..000000000
--- a/sal/qa/rtl/strings/test_oustring_compare.cxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include "rtl/string.h"
-#include "rtl/ustring.hxx"
-
-namespace test { namespace oustring {
-
-class Compare: public CppUnit::TestFixture
-{
-private:
- void equalsIgnoreAsciiCaseAscii();
-
-CPPUNIT_TEST_SUITE(Compare);
-CPPUNIT_TEST(equalsIgnoreAsciiCaseAscii);
-CPPUNIT_TEST_SUITE_END();
-};
-
-} }
-
-CPPUNIT_TEST_SUITE_REGISTRATION(test::oustring::Compare);
-
-void test::oustring::Compare::equalsIgnoreAsciiCaseAscii()
-{
- CPPUNIT_ASSERT(!rtl::OUString().equalsIgnoreAsciiCaseAscii("abc"));
- CPPUNIT_ASSERT(!rtl::OUString().equalsIgnoreAsciiCaseAsciiL(
- RTL_CONSTASCII_STRINGPARAM("abc")));
- CPPUNIT_ASSERT(!rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("abc")).
- equalsIgnoreAsciiCaseAscii(""));
- CPPUNIT_ASSERT(!rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("abc")).
- equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("")));
-
- CPPUNIT_ASSERT(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("abc")).
- equalsIgnoreAsciiCaseAscii("abc"));
- CPPUNIT_ASSERT(!rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("abcd")).
- equalsIgnoreAsciiCaseAscii("abc"));
- CPPUNIT_ASSERT(!rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("abc")).
- equalsIgnoreAsciiCaseAscii("abcd"));
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/strings/test_oustring_convert.cxx b/sal/qa/rtl/strings/test_oustring_convert.cxx
deleted file mode 100644
index 1a1933e45..000000000
--- a/sal/qa/rtl/strings/test_oustring_convert.cxx
+++ /dev/null
@@ -1,188 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include "rtl/strbuf.hxx"
-#include "rtl/string.hxx"
-#include "rtl/ustring.hxx"
-#include <sal/macros.h>
-
-namespace test { namespace oustring {
-
-class Convert: public CppUnit::TestFixture
-{
-private:
- void convertToString();
-
- CPPUNIT_TEST_SUITE(Convert);
- CPPUNIT_TEST(convertToString);
- CPPUNIT_TEST_SUITE_END();
-};
-
-} }
-
-CPPUNIT_TEST_SUITE_REGISTRATION(test::oustring::Convert);
-
-namespace {
-
-struct TestConvertToString
-{
- sal_Unicode aSource[100];
- sal_Int32 nLength;
- rtl_TextEncoding nEncoding;
- sal_uInt32 nFlags;
- char const * pStrict;
- char const * pRelaxed;
-};
-
-void testConvertToString(TestConvertToString const & rTest)
-{
- const rtl::OUString aSource(rTest.aSource, rTest.nLength);
- rtl::OString aStrict(RTL_CONSTASCII_STRINGPARAM("12345"));
- bool bSuccess = aSource.convertToString(&aStrict, rTest.nEncoding,
- rTest.nFlags);
- rtl::OString aRelaxed(rtl::OUStringToOString(aSource, rTest.nEncoding,
- rTest.nFlags));
-
- rtl::OStringBuffer aPrefix;
- aPrefix.append(RTL_CONSTASCII_STRINGPARAM("{"));
- for (sal_Int32 i = 0; i < rTest.nLength; ++i)
- {
- aPrefix.append(RTL_CONSTASCII_STRINGPARAM("U+"));
- aPrefix.append(static_cast< sal_Int32 >(rTest.aSource[i]), 16);
- if (i + 1 < rTest.nLength)
- aPrefix.append(RTL_CONSTASCII_STRINGPARAM(","));
- }
- aPrefix.append(RTL_CONSTASCII_STRINGPARAM("}, "));
- aPrefix.append(static_cast< sal_Int32 >(rTest.nEncoding));
- aPrefix.append(RTL_CONSTASCII_STRINGPARAM(", 0x"));
- aPrefix.append(static_cast< sal_Int32 >(rTest.nFlags), 16);
- aPrefix.append(RTL_CONSTASCII_STRINGPARAM(" -> "));
-
- if (bSuccess)
- {
- if (rTest.pStrict == 0 || !aStrict.equals(rTest.pStrict))
- {
- rtl::OStringBuffer aMessage(aPrefix);
- aMessage.append(RTL_CONSTASCII_STRINGPARAM("strict = \""));
- aMessage.append(aStrict);
- aMessage.append(RTL_CONSTASCII_STRINGPARAM("\""));
- CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), false);
- }
- }
- else
- {
- if (!aStrict.equals(rtl::OString(RTL_CONSTASCII_STRINGPARAM("12345"))))
- {
- rtl::OStringBuffer aMessage(aPrefix);
- aMessage.append(RTL_CONSTASCII_STRINGPARAM("modified output"));
- CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), false);
- }
- if (rTest.pStrict != 0)
- {
- rtl::OStringBuffer aMessage(aPrefix);
- aMessage.append(RTL_CONSTASCII_STRINGPARAM("failed"));
- CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), false);
- }
- }
- if (!aRelaxed.equals(rTest.pRelaxed))
- {
- rtl::OStringBuffer aMessage(aPrefix);
- aMessage.append(RTL_CONSTASCII_STRINGPARAM("relaxed = \""));
- aMessage.append(aRelaxed);
- aMessage.append(RTL_CONSTASCII_STRINGPARAM("\""));
- CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), false);
- }
-}
-
-}
-
-void test::oustring::Convert::convertToString()
-{
- TestConvertToString const aTests[]
- = { { { 0 },
- 0,
- RTL_TEXTENCODING_ASCII_US,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR
- | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR,
- "",
- "" },
- { { 0 },
- 0,
- RTL_TEXTENCODING_ASCII_US,
- OUSTRING_TO_OSTRING_CVTFLAGS,
- "",
- "" },
- { { 0x0041,0x0042,0x0043 },
- 3,
- RTL_TEXTENCODING_ASCII_US,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR
- | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR,
- "ABC",
- "ABC" },
- { { 0x0041,0x0042,0x0043 },
- 3,
- RTL_TEXTENCODING_ASCII_US,
- OUSTRING_TO_OSTRING_CVTFLAGS,
- "ABC",
- "ABC" },
- { { 0xB800 },
- 1,
- RTL_TEXTENCODING_ISO_2022_JP,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR
- | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR,
- 0,
- "" },
- { { 0x3001, 0xB800 },
- 2,
- RTL_TEXTENCODING_ISO_2022_JP,
- OUSTRING_TO_OSTRING_CVTFLAGS,
- "\x1b\x24\x42\x21\x22\x1b\x28\x42\x3f",
- "\x1b\x24\x42\x21\x22\x1b\x28\x42\x3f" },
- { { 0x0041,0x0100,0x0042 },
- 3,
- RTL_TEXTENCODING_ISO_8859_1,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR
- | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR,
- 0,
- "A" },
- { { 0x0041,0x0100,0x0042 },
- 3,
- RTL_TEXTENCODING_ISO_8859_1,
- OUSTRING_TO_OSTRING_CVTFLAGS,
- "A?B",
- "A?B" } };
- for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i)
- testConvertToString(aTests[i]);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/strings/test_oustring_endswith.cxx b/sal/qa/rtl/strings/test_oustring_endswith.cxx
deleted file mode 100644
index 390808105..000000000
--- a/sal/qa/rtl/strings/test_oustring_endswith.cxx
+++ /dev/null
@@ -1,126 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include "rtl/strbuf.hxx"
-#include "rtl/string.h"
-#include "rtl/string.hxx"
-#include "rtl/textenc.h"
-#include "rtl/ustring.hxx"
-#include "sal/types.h"
-#include <sal/macros.h>
-
-namespace test { namespace oustring {
-
-class EndsWith: public CppUnit::TestFixture
-{
-private:
- void endsWith();
-
- CPPUNIT_TEST_SUITE(EndsWith);
- CPPUNIT_TEST(endsWith);
- CPPUNIT_TEST_SUITE_END();
-};
-
-} }
-
-CPPUNIT_TEST_SUITE_REGISTRATION(test::oustring::EndsWith);
-
-namespace {
-
-void appendString(rtl::OStringBuffer & buffer, rtl::OString const & string)
-{
- buffer.append('"');
- for (int i = 0; i < string.getLength(); ++i) {
- char c = string[i];
- if (c < ' ' || c == '"' || c == '\\' || c > '~') {
- buffer.append('\\');
- sal_Int32 n = static_cast< sal_Int32 >(
- static_cast< unsigned char >(c));
- if (n < 16) {
- buffer.append('0');
- }
- buffer.append(n, 16);
- } else {
- buffer.append(c);
- }
- }
- buffer.append('"');
-}
-
-}
-
-void test::oustring::EndsWith::endsWith()
-{
- struct Data {
- char const * str1;
- sal_Int32 str1Len;
- char const * str2;
- sal_Int32 str2Len;
- bool endsWith;
- };
- Data const data[] = {
- { RTL_CONSTASCII_STRINGPARAM(""), RTL_CONSTASCII_STRINGPARAM(""),
- true },
- { RTL_CONSTASCII_STRINGPARAM("abc"), RTL_CONSTASCII_STRINGPARAM(""),
- true },
- { RTL_CONSTASCII_STRINGPARAM(""), RTL_CONSTASCII_STRINGPARAM("abc"),
- false },
- { RTL_CONSTASCII_STRINGPARAM("ABC"), RTL_CONSTASCII_STRINGPARAM("abc"),
- true },
- { RTL_CONSTASCII_STRINGPARAM("abcd"), RTL_CONSTASCII_STRINGPARAM("bcd"),
- true },
- { RTL_CONSTASCII_STRINGPARAM("bcd"), RTL_CONSTASCII_STRINGPARAM("abcd"),
- false },
- { RTL_CONSTASCII_STRINGPARAM("a\0b\0c"),
- RTL_CONSTASCII_STRINGPARAM("b\0c"), true },
- { RTL_CONSTASCII_STRINGPARAM("a\0b\0c"),
- RTL_CONSTASCII_STRINGPARAM("b"), false } };
- for (size_t i = 0; i < SAL_N_ELEMENTS(data); ++i) {
- rtl::OStringBuffer msg;
- appendString(msg, rtl::OString(data[i].str1, data[i].str1Len));
- msg.append(
- RTL_CONSTASCII_STRINGPARAM(".endsWithIgnoreAsciiCaseAsciiL("));
- appendString(msg, rtl::OString(data[i].str2, data[i].str2Len));
- msg.append(RTL_CONSTASCII_STRINGPARAM(") == "));
- msg.append(static_cast< sal_Bool >(data[i].endsWith));
- CPPUNIT_ASSERT_MESSAGE(
- msg.getStr(),
- rtl::OUString(
- data[i].str1, data[i].str1Len,
- RTL_TEXTENCODING_ASCII_US).endsWithIgnoreAsciiCaseAsciiL(
- data[i].str2, data[i].str2Len)
- == data[i].endsWith);
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/strings/test_oustring_noadditional.cxx b/sal/qa/rtl/strings/test_oustring_noadditional.cxx
deleted file mode 100644
index d5a1de59f..000000000
--- a/sal/qa/rtl/strings/test_oustring_noadditional.cxx
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-#include <cppunit/plugin/TestPlugIn.h>
-
-CPPUNIT_PLUGIN_IMPLEMENT();
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/textenc/makefile.mk b/sal/qa/rtl/textenc/makefile.mk
deleted file mode 100644
index 4e6126235..000000000
--- a/sal/qa/rtl/textenc/makefile.mk
+++ /dev/null
@@ -1,75 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-
-PRJNAME=sal
-TARGET=qa_rtl_textenc
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
-
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-
-# --- BEGIN --------------------------------------------------------
-SHL1OBJS= \
- $(SLO)$/rtl_textcvt.obj
-SHL1TARGET= rtl_textcvt
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-DEF1NAME =$(SHL1TARGET)
-SHL1VERSIONMAP = $(PRJ)$/qa$/export.map
-
-# END --------------------------------------------------------------
-
-# --- BEGIN --------------------------------------------------------
-SHL2OBJS= \
- $(SLO)$/rtl_tencinfo.obj
-SHL2TARGET= rtl_tencinfo
-SHL2STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL2IMPLIB= i$(SHL2TARGET)
-DEF2NAME =$(SHL2TARGET)
-SHL2VERSIONMAP = $(PRJ)$/qa$/export.map
-
-# END --------------------------------------------------------------
-
-#------------------------------- All object files -------------------------------
-# do this here, so we get right dependencies
-# SLOFILES=$(SHL1OBJS)
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/textenc/rtl_tencinfo.cxx b/sal/qa/rtl/textenc/rtl_tencinfo.cxx
deleted file mode 100644
index 89c1e4b1d..000000000
--- a/sal/qa/rtl/textenc/rtl_tencinfo.cxx
+++ /dev/null
@@ -1,1904 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-#include <string.h>
-
-#include <osl/thread.h>
-#include <rtl/tencinfo.h>
-
-#include <testshl/simpleheader.hxx>
-
-// -----------------------------------------------------------------------------
-
-namespace rtl_tencinfo
-{
- class getBestMime : public CppUnit::TestFixture
- {
- public:
- void setUp()
- {
- }
-
- void check( const sal_Char* _pRTL_TEXTENCODING, rtl_TextEncoding _aCurrentEncode )
- {
- const sal_Char *pCharSet = rtl_getBestMimeCharsetFromTextEncoding( _aCurrentEncode );
- if (pCharSet == 0)
- {
- t_print("rtl_getBestMimeCharsetFromTextEncoding(%s) (%d) doesn't seem to exist.\n\n", _pRTL_TEXTENCODING, _aCurrentEncode);
- }
- else
- {
- t_print(T_VERBOSE, "'%s' is charset: '%s'\n", _pRTL_TEXTENCODING, pCharSet);
-
- rtl_TextEncoding eTextEnc = rtl_getTextEncodingFromMimeCharset( pCharSet );
- if (_aCurrentEncode != eTextEnc &&
- eTextEnc != RTL_TEXTENCODING_DONTKNOW)
- {
- t_print("rtl_getBestMimeCharsetFromTextEncoding(%s) is charset: %s\n", _pRTL_TEXTENCODING, pCharSet);
- t_print("rtl_getTextEncodingFromMimeCharset() differ: %s %d -> %d\n\n", _pRTL_TEXTENCODING, _aCurrentEncode, eTextEnc );
- }
- // rtl::OString sError = "getTextEncodingFromMimeCharset(";
- // sError += pCharSet;
- // sError += ") returns null";
- // CPPUNIT_ASSERT_MESSAGE(sError.getStr(), eTextEnc != RTL_TEXTENCODING_DONTKNOW);
- // CPPUNIT_ASSERT_MESSAGE("Does not realize itself", _aCurrentEncode == eTextEnc );
- }
- }
-
-// the defines for the follows test could be found in file inc/rtl/textenc.h
-
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_MS_1252()
- {
- check( "RTL_TEXTENCODING_MS_1252", RTL_TEXTENCODING_MS_1252 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_APPLE_ROMAN()
- {
- check( "RTL_TEXTENCODING_APPLE_ROMAN", RTL_TEXTENCODING_APPLE_ROMAN );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_IBM_437()
- {
- check( "RTL_TEXTENCODING_IBM_437", RTL_TEXTENCODING_IBM_437 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_IBM_850()
- {
- check( "RTL_TEXTENCODING_IBM_850", RTL_TEXTENCODING_IBM_850 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_IBM_860()
- {
- check( "RTL_TEXTENCODING_IBM_860", RTL_TEXTENCODING_IBM_860 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_IBM_861()
- {
- check( "RTL_TEXTENCODING_IBM_861", RTL_TEXTENCODING_IBM_861 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_IBM_863()
- {
- check( "RTL_TEXTENCODING_IBM_863", RTL_TEXTENCODING_IBM_863 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_IBM_865()
- {
- check( "RTL_TEXTENCODING_IBM_865", RTL_TEXTENCODING_IBM_865 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_SYMBOL()
- {
- check( "RTL_TEXTENCODING_SYMBOL", RTL_TEXTENCODING_SYMBOL );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_ASCII_US()
- {
- check( "RTL_TEXTENCODING_ASCII_US", RTL_TEXTENCODING_ASCII_US );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_ISO_8859_1()
- {
- check( "RTL_TEXTENCODING_ISO_8859_1", RTL_TEXTENCODING_ISO_8859_1 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_ISO_8859_2()
- {
- check( "RTL_TEXTENCODING_ISO_8859_2", RTL_TEXTENCODING_ISO_8859_2 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_ISO_8859_3()
- {
- check( "RTL_TEXTENCODING_ISO_8859_3", RTL_TEXTENCODING_ISO_8859_3 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_ISO_8859_4()
- {
- check( "RTL_TEXTENCODING_ISO_8859_4", RTL_TEXTENCODING_ISO_8859_4 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_ISO_8859_5()
- {
- check( "RTL_TEXTENCODING_ISO_8859_5", RTL_TEXTENCODING_ISO_8859_5 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_ISO_8859_6()
- {
- check( "RTL_TEXTENCODING_ISO_8859_6", RTL_TEXTENCODING_ISO_8859_6 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_ISO_8859_7()
- {
- check( "RTL_TEXTENCODING_ISO_8859_7", RTL_TEXTENCODING_ISO_8859_7 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_ISO_8859_8()
- {
- check( "RTL_TEXTENCODING_ISO_8859_8", RTL_TEXTENCODING_ISO_8859_8 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_ISO_8859_9()
- {
- check( "RTL_TEXTENCODING_ISO_8859_9", RTL_TEXTENCODING_ISO_8859_9 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_ISO_8859_14()
- {
- check( "RTL_TEXTENCODING_ISO_8859_14", RTL_TEXTENCODING_ISO_8859_14 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_ISO_8859_15()
- {
- check( "RTL_TEXTENCODING_ISO_8859_15", RTL_TEXTENCODING_ISO_8859_15 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_IBM_737()
- {
- check( "RTL_TEXTENCODING_IBM_737", RTL_TEXTENCODING_IBM_737 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_IBM_775()
- {
- check( "RTL_TEXTENCODING_IBM_775", RTL_TEXTENCODING_IBM_775 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_IBM_852()
- {
- check( "RTL_TEXTENCODING_IBM_852", RTL_TEXTENCODING_IBM_852 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_IBM_855()
- {
- check( "RTL_TEXTENCODING_IBM_855", RTL_TEXTENCODING_IBM_855 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_IBM_857()
- {
- check( "RTL_TEXTENCODING_IBM_857", RTL_TEXTENCODING_IBM_857 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_IBM_862()
- {
- check( "RTL_TEXTENCODING_IBM_862", RTL_TEXTENCODING_IBM_862 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_IBM_864()
- {
- check( "RTL_TEXTENCODING_IBM_864", RTL_TEXTENCODING_IBM_864 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_IBM_866()
- {
- check( "RTL_TEXTENCODING_IBM_866", RTL_TEXTENCODING_IBM_866 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_IBM_869()
- {
- check( "RTL_TEXTENCODING_IBM_869", RTL_TEXTENCODING_IBM_869 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_MS_874()
- {
- check( "RTL_TEXTENCODING_MS_874", RTL_TEXTENCODING_MS_874 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_MS_1250()
- {
- check( "RTL_TEXTENCODING_MS_1250", RTL_TEXTENCODING_MS_1250 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_MS_1251()
- {
- check( "RTL_TEXTENCODING_MS_1251", RTL_TEXTENCODING_MS_1251 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_MS_1253()
- {
- check( "RTL_TEXTENCODING_MS_1253", RTL_TEXTENCODING_MS_1253 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_MS_1254()
- {
- check( "RTL_TEXTENCODING_MS_1254", RTL_TEXTENCODING_MS_1254 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_MS_1255()
- {
- check( "RTL_TEXTENCODING_MS_1255", RTL_TEXTENCODING_MS_1255 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_MS_1256()
- {
- check( "RTL_TEXTENCODING_MS_1256", RTL_TEXTENCODING_MS_1256 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_MS_1257()
- {
- check( "RTL_TEXTENCODING_MS_1257", RTL_TEXTENCODING_MS_1257 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_MS_1258()
- {
- check( "RTL_TEXTENCODING_MS_1258", RTL_TEXTENCODING_MS_1258 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_APPLE_ARABIC()
- {
- check( "RTL_TEXTENCODING_APPLE_ARABIC", RTL_TEXTENCODING_APPLE_ARABIC );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_APPLE_CENTEURO()
- {
- check( "RTL_TEXTENCODING_APPLE_CENTEURO", RTL_TEXTENCODING_APPLE_CENTEURO );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_APPLE_CROATIAN()
- {
- check( "RTL_TEXTENCODING_APPLE_CROATIAN", RTL_TEXTENCODING_APPLE_CROATIAN );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_APPLE_CYRILLIC()
- {
- check( "RTL_TEXTENCODING_APPLE_CYRILLIC", RTL_TEXTENCODING_APPLE_CYRILLIC );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_APPLE_DEVANAGARI()
- {
- check( "RTL_TEXTENCODING_APPLE_DEVANAGARI", RTL_TEXTENCODING_APPLE_DEVANAGARI );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_APPLE_FARSI()
- {
- check( "RTL_TEXTENCODING_APPLE_FARSI", RTL_TEXTENCODING_APPLE_FARSI );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_APPLE_GREEK()
- {
- check( "RTL_TEXTENCODING_APPLE_GREEK", RTL_TEXTENCODING_APPLE_GREEK );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_APPLE_GUJARATI()
- {
- check( "RTL_TEXTENCODING_APPLE_GUJARATI", RTL_TEXTENCODING_APPLE_GUJARATI );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_APPLE_GURMUKHI()
- {
- check( "RTL_TEXTENCODING_APPLE_GURMUKHI", RTL_TEXTENCODING_APPLE_GURMUKHI );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_APPLE_HEBREW()
- {
- check( "RTL_TEXTENCODING_APPLE_HEBREW", RTL_TEXTENCODING_APPLE_HEBREW );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_APPLE_ICELAND()
- {
- check( "RTL_TEXTENCODING_APPLE_ICELAND", RTL_TEXTENCODING_APPLE_ICELAND );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_APPLE_ROMANIAN()
- {
- check( "RTL_TEXTENCODING_APPLE_ROMANIAN", RTL_TEXTENCODING_APPLE_ROMANIAN );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_APPLE_THAI()
- {
- check( "RTL_TEXTENCODING_APPLE_THAI", RTL_TEXTENCODING_APPLE_THAI );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_APPLE_TURKISH()
- {
- check( "RTL_TEXTENCODING_APPLE_TURKISH", RTL_TEXTENCODING_APPLE_TURKISH );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_APPLE_UKRAINIAN()
- {
- check( "RTL_TEXTENCODING_APPLE_UKRAINIAN", RTL_TEXTENCODING_APPLE_UKRAINIAN );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_APPLE_CHINSIMP()
- {
- check( "RTL_TEXTENCODING_APPLE_CHINSIMP", RTL_TEXTENCODING_APPLE_CHINSIMP );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_APPLE_CHINTRAD()
- {
- check( "RTL_TEXTENCODING_APPLE_CHINTRAD", RTL_TEXTENCODING_APPLE_CHINTRAD );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_APPLE_JAPANESE()
- {
- check( "RTL_TEXTENCODING_APPLE_JAPANESE", RTL_TEXTENCODING_APPLE_JAPANESE );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_APPLE_KOREAN()
- {
- check( "RTL_TEXTENCODING_APPLE_KOREAN", RTL_TEXTENCODING_APPLE_KOREAN );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_MS_932()
- {
- check( "RTL_TEXTENCODING_MS_932", RTL_TEXTENCODING_MS_932 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_MS_936()
- {
- check( "RTL_TEXTENCODING_MS_936", RTL_TEXTENCODING_MS_936 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_MS_949()
- {
- check( "RTL_TEXTENCODING_MS_949", RTL_TEXTENCODING_MS_949 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_MS_950()
- {
- check( "RTL_TEXTENCODING_MS_950", RTL_TEXTENCODING_MS_950 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_SHIFT_JIS()
- {
- check( "RTL_TEXTENCODING_SHIFT_JIS", RTL_TEXTENCODING_SHIFT_JIS );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_GB_2312()
- {
- check( "RTL_TEXTENCODING_GB_2312", RTL_TEXTENCODING_GB_2312 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_GBT_12345()
- {
- check( "RTL_TEXTENCODING_GBT_12345", RTL_TEXTENCODING_GBT_12345 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_GBK()
- {
- check( "RTL_TEXTENCODING_GBK", RTL_TEXTENCODING_GBK );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_BIG5()
- {
- check( "RTL_TEXTENCODING_BIG5", RTL_TEXTENCODING_BIG5 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_EUC_JP()
- {
- check( "RTL_TEXTENCODING_EUC_JP", RTL_TEXTENCODING_EUC_JP );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_EUC_CN()
- {
- check( "RTL_TEXTENCODING_EUC_CN", RTL_TEXTENCODING_EUC_CN );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_EUC_TW()
- {
- check( "RTL_TEXTENCODING_EUC_TW", RTL_TEXTENCODING_EUC_TW );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_ISO_2022_JP()
- {
- check( "RTL_TEXTENCODING_ISO_2022_JP", RTL_TEXTENCODING_ISO_2022_JP );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_ISO_2022_CN()
- {
- check( "RTL_TEXTENCODING_ISO_2022_CN", RTL_TEXTENCODING_ISO_2022_CN );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_KOI8_R()
- {
- check( "RTL_TEXTENCODING_KOI8_R", RTL_TEXTENCODING_KOI8_R );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_UTF7()
- {
- check( "RTL_TEXTENCODING_UTF7", RTL_TEXTENCODING_UTF7 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_UTF8()
- {
- check( "RTL_TEXTENCODING_UTF8", RTL_TEXTENCODING_UTF8 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_ISO_8859_10()
- {
- check( "RTL_TEXTENCODING_ISO_8859_10", RTL_TEXTENCODING_ISO_8859_10 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_ISO_8859_13()
- {
- check( "RTL_TEXTENCODING_ISO_8859_13", RTL_TEXTENCODING_ISO_8859_13 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_EUC_KR()
- {
- check( "RTL_TEXTENCODING_EUC_KR", RTL_TEXTENCODING_EUC_KR );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_ISO_2022_KR()
- {
- check( "RTL_TEXTENCODING_ISO_2022_KR", RTL_TEXTENCODING_ISO_2022_KR );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_JIS_X_0201()
- {
- check( "RTL_TEXTENCODING_JIS_X_0201", RTL_TEXTENCODING_JIS_X_0201 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_JIS_X_0208()
- {
- check( "RTL_TEXTENCODING_JIS_X_0208", RTL_TEXTENCODING_JIS_X_0208 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_JIS_X_0212()
- {
- check( "RTL_TEXTENCODING_JIS_X_0212", RTL_TEXTENCODING_JIS_X_0212 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_MS_1361()
- {
- check( "RTL_TEXTENCODING_MS_1361", RTL_TEXTENCODING_MS_1361 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_GB_18030()
- {
- check( "RTL_TEXTENCODING_GB_18030", RTL_TEXTENCODING_GB_18030 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_BIG5_HKSCS()
- {
- check( "RTL_TEXTENCODING_BIG5_HKSCS", RTL_TEXTENCODING_BIG5_HKSCS );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_TIS_620()
- {
- check( "RTL_TEXTENCODING_TIS_620", RTL_TEXTENCODING_TIS_620 );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_KOI8_U()
- {
- check( "RTL_TEXTENCODING_KOI8_U", RTL_TEXTENCODING_KOI8_U );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_ISCII_DEVANAGARI()
- {
- check( "RTL_TEXTENCODING_ISCII_DEVANAGARI", RTL_TEXTENCODING_ISCII_DEVANAGARI );
- }
- // ----------------------------------------
- void MimeCharsetFromTextEncoding_JAVA_UTF8()
- {
- check( "RTL_TEXTENCODING_JAVA_UTF8", RTL_TEXTENCODING_JAVA_UTF8 );
- }
-
-/* ATTENTION! Whenever some encoding is added here, make sure to update
- * rtl_isOctetEncoding in tencinfo.c.
- */
-
-// RTL_TEXTENCODING_USER_START
-// RTL_TEXTENCODING_USER_END
-
-// check( "RTL_TEXTENCODING_UCS4", RTL_TEXTENCODING_UCS4 );
-// check( "RTL_TEXTENCODING_UCS2", RTL_TEXTENCODING_UCS2 );
-// check( "RTL_TEXTENCODING_UNICODE", RTL_TEXTENCODING_UNICODE /* RTL_TEXTENCODING_UCS2 */ );
-
- CPPUNIT_TEST_SUITE( getBestMime );
-
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1252 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ROMAN );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_437 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_850 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_860 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_861 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_863 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_865 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_SYMBOL );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_ASCII_US );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_1 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_2 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_3 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_4 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_5 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_6 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_7 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_8 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_9 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_14 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_15 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_737 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_775 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_852 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_855 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_857 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_862 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_864 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_866 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_869 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_874 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1250 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1251 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1253 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1254 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1255 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1256 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1257 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1258 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ARABIC );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CENTEURO );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CROATIAN );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CYRILLIC );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_DEVANAGARI );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_FARSI );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_GREEK );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_GUJARATI );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_GURMUKHI );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_HEBREW );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ICELAND );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ROMANIAN );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_THAI );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_TURKISH );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_UKRAINIAN );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CHINSIMP );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CHINTRAD );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_JAPANESE );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_KOREAN );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_932 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_936 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_949 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_950 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_SHIFT_JIS );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_GB_2312 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_GBT_12345 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_GBK );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_BIG5 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_JP );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_CN );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_TW );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_2022_JP );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_2022_CN );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_KOI8_R );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_UTF7 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_UTF8 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_10 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_13 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_KR );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_2022_KR );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_JIS_X_0201 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_JIS_X_0208 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_JIS_X_0212 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1361 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_GB_18030 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_BIG5_HKSCS );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_TIS_620 );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_KOI8_U );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISCII_DEVANAGARI );
- CPPUNIT_TEST( MimeCharsetFromTextEncoding_JAVA_UTF8 );
-
- CPPUNIT_TEST_SUITE_END( );
- };
-
- // -----------------------------------------------------------------------------
-
- class getBestUnix : public CppUnit::TestFixture
- {
- public:
- void setUp()
- {
- }
-
- void check( const sal_Char* _pRTL_TEXTENCODING, rtl_TextEncoding _aCurrentEncode )
- {
- const sal_Char *pCharSet = rtl_getBestUnixCharsetFromTextEncoding( _aCurrentEncode );
- if (pCharSet == 0)
- {
- t_print("rtl_getBestUnixCharsetFromTextEncoding(%s) (%d) doesn't seem to exist.\n\n", _pRTL_TEXTENCODING, _aCurrentEncode);
- }
- else
- {
- t_print(T_VERBOSE, "'%s' is charset: '%s'\n", _pRTL_TEXTENCODING, pCharSet);
-
- rtl_TextEncoding eTextEnc = rtl_getTextEncodingFromUnixCharset( pCharSet );
- if (_aCurrentEncode != eTextEnc &&
- eTextEnc != RTL_TEXTENCODING_DONTKNOW)
- {
- t_print("rtl_getBestUnixCharsetFromTextEncoding(%s) is charset: %s\n", _pRTL_TEXTENCODING, pCharSet);
- t_print("rtl_getTextEncodingFromUnixCharset() differ: %s %d -> %d\n\n", _pRTL_TEXTENCODING, _aCurrentEncode, eTextEnc );
- }
- // rtl::OString sError = "getTextEncodingFromUnixCharset(";
- // sError += pCharSet;
- // sError += ") returns null";
- // CPPUNIT_ASSERT_MESSAGE(sError.getStr(), eTextEnc != RTL_TEXTENCODING_DONTKNOW);
- // CPPUNIT_ASSERT_MESSAGE("Does not realize itself", _aCurrentEncode == eTextEnc );
- }
- }
-
-
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_MS_1252()
- {
- check( "RTL_TEXTENCODING_MS_1252", RTL_TEXTENCODING_MS_1252 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_APPLE_ROMAN()
- {
- check( "RTL_TEXTENCODING_APPLE_ROMAN", RTL_TEXTENCODING_APPLE_ROMAN );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_IBM_437()
- {
- check( "RTL_TEXTENCODING_IBM_437", RTL_TEXTENCODING_IBM_437 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_IBM_850()
- {
- check( "RTL_TEXTENCODING_IBM_850", RTL_TEXTENCODING_IBM_850 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_IBM_860()
- {
- check( "RTL_TEXTENCODING_IBM_860", RTL_TEXTENCODING_IBM_860 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_IBM_861()
- {
- check( "RTL_TEXTENCODING_IBM_861", RTL_TEXTENCODING_IBM_861 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_IBM_863()
- {
- check( "RTL_TEXTENCODING_IBM_863", RTL_TEXTENCODING_IBM_863 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_IBM_865()
- {
- check( "RTL_TEXTENCODING_IBM_865", RTL_TEXTENCODING_IBM_865 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_SYMBOL()
- {
- check( "RTL_TEXTENCODING_SYMBOL", RTL_TEXTENCODING_SYMBOL );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_ASCII_US()
- {
- check( "RTL_TEXTENCODING_ASCII_US", RTL_TEXTENCODING_ASCII_US );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_ISO_8859_1()
- {
- check( "RTL_TEXTENCODING_ISO_8859_1", RTL_TEXTENCODING_ISO_8859_1 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_ISO_8859_2()
- {
- check( "RTL_TEXTENCODING_ISO_8859_2", RTL_TEXTENCODING_ISO_8859_2 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_ISO_8859_3()
- {
- check( "RTL_TEXTENCODING_ISO_8859_3", RTL_TEXTENCODING_ISO_8859_3 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_ISO_8859_4()
- {
- check( "RTL_TEXTENCODING_ISO_8859_4", RTL_TEXTENCODING_ISO_8859_4 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_ISO_8859_5()
- {
- check( "RTL_TEXTENCODING_ISO_8859_5", RTL_TEXTENCODING_ISO_8859_5 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_ISO_8859_6()
- {
- check( "RTL_TEXTENCODING_ISO_8859_6", RTL_TEXTENCODING_ISO_8859_6 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_ISO_8859_7()
- {
- check( "RTL_TEXTENCODING_ISO_8859_7", RTL_TEXTENCODING_ISO_8859_7 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_ISO_8859_8()
- {
- check( "RTL_TEXTENCODING_ISO_8859_8", RTL_TEXTENCODING_ISO_8859_8 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_ISO_8859_9()
- {
- check( "RTL_TEXTENCODING_ISO_8859_9", RTL_TEXTENCODING_ISO_8859_9 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_ISO_8859_14()
- {
- check( "RTL_TEXTENCODING_ISO_8859_14", RTL_TEXTENCODING_ISO_8859_14 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_ISO_8859_15()
- {
- check( "RTL_TEXTENCODING_ISO_8859_15", RTL_TEXTENCODING_ISO_8859_15 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_IBM_737()
- {
- check( "RTL_TEXTENCODING_IBM_737", RTL_TEXTENCODING_IBM_737 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_IBM_775()
- {
- check( "RTL_TEXTENCODING_IBM_775", RTL_TEXTENCODING_IBM_775 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_IBM_852()
- {
- check( "RTL_TEXTENCODING_IBM_852", RTL_TEXTENCODING_IBM_852 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_IBM_855()
- {
- check( "RTL_TEXTENCODING_IBM_855", RTL_TEXTENCODING_IBM_855 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_IBM_857()
- {
- check( "RTL_TEXTENCODING_IBM_857", RTL_TEXTENCODING_IBM_857 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_IBM_862()
- {
- check( "RTL_TEXTENCODING_IBM_862", RTL_TEXTENCODING_IBM_862 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_IBM_864()
- {
- check( "RTL_TEXTENCODING_IBM_864", RTL_TEXTENCODING_IBM_864 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_IBM_866()
- {
- check( "RTL_TEXTENCODING_IBM_866", RTL_TEXTENCODING_IBM_866 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_IBM_869()
- {
- check( "RTL_TEXTENCODING_IBM_869", RTL_TEXTENCODING_IBM_869 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_MS_874()
- {
- check( "RTL_TEXTENCODING_MS_874", RTL_TEXTENCODING_MS_874 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_MS_1250()
- {
- check( "RTL_TEXTENCODING_MS_1250", RTL_TEXTENCODING_MS_1250 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_MS_1251()
- {
- check( "RTL_TEXTENCODING_MS_1251", RTL_TEXTENCODING_MS_1251 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_MS_1253()
- {
- check( "RTL_TEXTENCODING_MS_1253", RTL_TEXTENCODING_MS_1253 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_MS_1254()
- {
- check( "RTL_TEXTENCODING_MS_1254", RTL_TEXTENCODING_MS_1254 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_MS_1255()
- {
- check( "RTL_TEXTENCODING_MS_1255", RTL_TEXTENCODING_MS_1255 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_MS_1256()
- {
- check( "RTL_TEXTENCODING_MS_1256", RTL_TEXTENCODING_MS_1256 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_MS_1257()
- {
- check( "RTL_TEXTENCODING_MS_1257", RTL_TEXTENCODING_MS_1257 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_MS_1258()
- {
- check( "RTL_TEXTENCODING_MS_1258", RTL_TEXTENCODING_MS_1258 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_APPLE_ARABIC()
- {
- check( "RTL_TEXTENCODING_APPLE_ARABIC", RTL_TEXTENCODING_APPLE_ARABIC );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_APPLE_CENTEURO()
- {
- check( "RTL_TEXTENCODING_APPLE_CENTEURO", RTL_TEXTENCODING_APPLE_CENTEURO );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_APPLE_CROATIAN()
- {
- check( "RTL_TEXTENCODING_APPLE_CROATIAN", RTL_TEXTENCODING_APPLE_CROATIAN );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_APPLE_CYRILLIC()
- {
- check( "RTL_TEXTENCODING_APPLE_CYRILLIC", RTL_TEXTENCODING_APPLE_CYRILLIC );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_APPLE_DEVANAGARI()
- {
- check( "RTL_TEXTENCODING_APPLE_DEVANAGARI", RTL_TEXTENCODING_APPLE_DEVANAGARI );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_APPLE_FARSI()
- {
- check( "RTL_TEXTENCODING_APPLE_FARSI", RTL_TEXTENCODING_APPLE_FARSI );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_APPLE_GREEK()
- {
- check( "RTL_TEXTENCODING_APPLE_GREEK", RTL_TEXTENCODING_APPLE_GREEK );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_APPLE_GUJARATI()
- {
- check( "RTL_TEXTENCODING_APPLE_GUJARATI", RTL_TEXTENCODING_APPLE_GUJARATI );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_APPLE_GURMUKHI()
- {
- check( "RTL_TEXTENCODING_APPLE_GURMUKHI", RTL_TEXTENCODING_APPLE_GURMUKHI );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_APPLE_HEBREW()
- {
- check( "RTL_TEXTENCODING_APPLE_HEBREW", RTL_TEXTENCODING_APPLE_HEBREW );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_APPLE_ICELAND()
- {
- check( "RTL_TEXTENCODING_APPLE_ICELAND", RTL_TEXTENCODING_APPLE_ICELAND );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_APPLE_ROMANIAN()
- {
- check( "RTL_TEXTENCODING_APPLE_ROMANIAN", RTL_TEXTENCODING_APPLE_ROMANIAN );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_APPLE_THAI()
- {
- check( "RTL_TEXTENCODING_APPLE_THAI", RTL_TEXTENCODING_APPLE_THAI );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_APPLE_TURKISH()
- {
- check( "RTL_TEXTENCODING_APPLE_TURKISH", RTL_TEXTENCODING_APPLE_TURKISH );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_APPLE_UKRAINIAN()
- {
- check( "RTL_TEXTENCODING_APPLE_UKRAINIAN", RTL_TEXTENCODING_APPLE_UKRAINIAN );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_APPLE_CHINSIMP()
- {
- check( "RTL_TEXTENCODING_APPLE_CHINSIMP", RTL_TEXTENCODING_APPLE_CHINSIMP );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_APPLE_CHINTRAD()
- {
- check( "RTL_TEXTENCODING_APPLE_CHINTRAD", RTL_TEXTENCODING_APPLE_CHINTRAD );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_APPLE_JAPANESE()
- {
- check( "RTL_TEXTENCODING_APPLE_JAPANESE", RTL_TEXTENCODING_APPLE_JAPANESE );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_APPLE_KOREAN()
- {
- check( "RTL_TEXTENCODING_APPLE_KOREAN", RTL_TEXTENCODING_APPLE_KOREAN );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_MS_932()
- {
- check( "RTL_TEXTENCODING_MS_932", RTL_TEXTENCODING_MS_932 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_MS_936()
- {
- check( "RTL_TEXTENCODING_MS_936", RTL_TEXTENCODING_MS_936 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_MS_949()
- {
- check( "RTL_TEXTENCODING_MS_949", RTL_TEXTENCODING_MS_949 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_MS_950()
- {
- check( "RTL_TEXTENCODING_MS_950", RTL_TEXTENCODING_MS_950 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_SHIFT_JIS()
- {
- check( "RTL_TEXTENCODING_SHIFT_JIS", RTL_TEXTENCODING_SHIFT_JIS );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_GB_2312()
- {
- check( "RTL_TEXTENCODING_GB_2312", RTL_TEXTENCODING_GB_2312 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_GBT_12345()
- {
- check( "RTL_TEXTENCODING_GBT_12345", RTL_TEXTENCODING_GBT_12345 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_GBK()
- {
- check( "RTL_TEXTENCODING_GBK", RTL_TEXTENCODING_GBK );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_BIG5()
- {
- check( "RTL_TEXTENCODING_BIG5", RTL_TEXTENCODING_BIG5 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_EUC_JP()
- {
- check( "RTL_TEXTENCODING_EUC_JP", RTL_TEXTENCODING_EUC_JP );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_EUC_CN()
- {
- check( "RTL_TEXTENCODING_EUC_CN", RTL_TEXTENCODING_EUC_CN );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_EUC_TW()
- {
- check( "RTL_TEXTENCODING_EUC_TW", RTL_TEXTENCODING_EUC_TW );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_ISO_2022_JP()
- {
- check( "RTL_TEXTENCODING_ISO_2022_JP", RTL_TEXTENCODING_ISO_2022_JP );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_ISO_2022_CN()
- {
- check( "RTL_TEXTENCODING_ISO_2022_CN", RTL_TEXTENCODING_ISO_2022_CN );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_KOI8_R()
- {
- check( "RTL_TEXTENCODING_KOI8_R", RTL_TEXTENCODING_KOI8_R );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_UTF7()
- {
- check( "RTL_TEXTENCODING_UTF7", RTL_TEXTENCODING_UTF7 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_UTF8()
- {
- check( "RTL_TEXTENCODING_UTF8", RTL_TEXTENCODING_UTF8 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_ISO_8859_10()
- {
- check( "RTL_TEXTENCODING_ISO_8859_10", RTL_TEXTENCODING_ISO_8859_10 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_ISO_8859_13()
- {
- check( "RTL_TEXTENCODING_ISO_8859_13", RTL_TEXTENCODING_ISO_8859_13 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_EUC_KR()
- {
- check( "RTL_TEXTENCODING_EUC_KR", RTL_TEXTENCODING_EUC_KR );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_ISO_2022_KR()
- {
- check( "RTL_TEXTENCODING_ISO_2022_KR", RTL_TEXTENCODING_ISO_2022_KR );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_JIS_X_0201()
- {
- check( "RTL_TEXTENCODING_JIS_X_0201", RTL_TEXTENCODING_JIS_X_0201 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_JIS_X_0208()
- {
- check( "RTL_TEXTENCODING_JIS_X_0208", RTL_TEXTENCODING_JIS_X_0208 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_JIS_X_0212()
- {
- check( "RTL_TEXTENCODING_JIS_X_0212", RTL_TEXTENCODING_JIS_X_0212 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_MS_1361()
- {
- check( "RTL_TEXTENCODING_MS_1361", RTL_TEXTENCODING_MS_1361 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_GB_18030()
- {
- check( "RTL_TEXTENCODING_GB_18030", RTL_TEXTENCODING_GB_18030 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_BIG5_HKSCS()
- {
- check( "RTL_TEXTENCODING_BIG5_HKSCS", RTL_TEXTENCODING_BIG5_HKSCS );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_TIS_620()
- {
- check( "RTL_TEXTENCODING_TIS_620", RTL_TEXTENCODING_TIS_620 );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_KOI8_U()
- {
- check( "RTL_TEXTENCODING_KOI8_U", RTL_TEXTENCODING_KOI8_U );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_ISCII_DEVANAGARI()
- {
- check( "RTL_TEXTENCODING_ISCII_DEVANAGARI", RTL_TEXTENCODING_ISCII_DEVANAGARI );
- }
- // ----------------------------------------
- void UnixCharsetFromTextEncoding_JAVA_UTF8()
- {
- check( "RTL_TEXTENCODING_JAVA_UTF8", RTL_TEXTENCODING_JAVA_UTF8 );
- }
- // ----------------------------------------
-
- CPPUNIT_TEST_SUITE( getBestUnix );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1252 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ROMAN );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_437 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_850 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_860 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_861 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_863 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_865 );
-
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_SYMBOL );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_ASCII_US );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_1 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_2 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_3 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_4 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_5 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_6 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_7 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_8 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_9 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_14 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_15 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_737 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_775 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_852 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_855 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_857 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_862 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_864 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_866 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_869 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_874 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1250 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1251 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1253 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1254 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1255 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1256 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1257 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1258 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ARABIC );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CENTEURO );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CROATIAN );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CYRILLIC );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_DEVANAGARI );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_FARSI );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_GREEK );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_GUJARATI );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_GURMUKHI );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_HEBREW );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ICELAND );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ROMANIAN );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_THAI );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_TURKISH );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_UKRAINIAN );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CHINSIMP );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CHINTRAD );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_JAPANESE );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_KOREAN );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_932 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_936 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_949 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_950 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_SHIFT_JIS );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_GB_2312 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_GBT_12345 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_GBK );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_BIG5 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_JP );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_CN );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_TW );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_2022_JP );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_2022_CN );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_KOI8_R );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_UTF7 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_UTF8 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_10 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_13 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_KR );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_2022_KR );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_JIS_X_0201 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_JIS_X_0208 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_JIS_X_0212 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1361 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_GB_18030 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_BIG5_HKSCS );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_TIS_620 );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_KOI8_U );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISCII_DEVANAGARI );
- CPPUNIT_TEST( UnixCharsetFromTextEncoding_JAVA_UTF8 );
-
- CPPUNIT_TEST_SUITE_END( );
- };
-
- // -----------------------------------------------------------------------------
-
-
- class getBestWindows : public CppUnit::TestFixture
- {
- public:
- void setUp()
- {
- }
-
- void check( const sal_Char* _pRTL_TEXTENCODING, rtl_TextEncoding _aCurrentEncode )
- {
- const sal_uInt8 nCharSet = rtl_getBestWindowsCharsetFromTextEncoding( _aCurrentEncode );
- if (nCharSet == 1)
- {
- t_print("rtl_getBestWindowsCharsetFromTextEncoding(%s) (%d) doesn't seem to exist.\n\n", _pRTL_TEXTENCODING, _aCurrentEncode);
- }
- else
- {
- t_print(T_VERBOSE, "'%s' is charset: '%d'\n", _pRTL_TEXTENCODING, nCharSet);
-
- rtl_TextEncoding eTextEnc = rtl_getTextEncodingFromWindowsCharset( nCharSet );
- if (_aCurrentEncode != eTextEnc &&
- eTextEnc != RTL_TEXTENCODING_DONTKNOW)
- {
- t_print("rtl_getBestUnixCharsetFromTextEncoding(%s) is charset: %d\n", _pRTL_TEXTENCODING, nCharSet);
- t_print("rtl_getTextEncodingFromWindowsCharset() differ: %s %d -> %d\n\n", _pRTL_TEXTENCODING, _aCurrentEncode, eTextEnc );
- }
- // rtl::OString sError = "getTextEncodingFromWindowsCharset(";
- // sError += rtl::OString::valueOf(nCharSet);
- // sError += ") returns nul.";
-
- // CPPUNIT_ASSERT_MESSAGE(sError.getStr(), eTextEnc != RTL_TEXTENCODING_DONTKNOW);
- // CPPUNIT_ASSERT_MESSAGE("Does not realize itself", _aCurrentEncode == eTextEnc );
- }
- }
-
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_MS_1252()
- {
- check( "RTL_TEXTENCODING_MS_1252", RTL_TEXTENCODING_MS_1252 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_APPLE_ROMAN()
- {
- check( "RTL_TEXTENCODING_APPLE_ROMAN", RTL_TEXTENCODING_APPLE_ROMAN );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_IBM_437()
- {
- check( "RTL_TEXTENCODING_IBM_437", RTL_TEXTENCODING_IBM_437 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_IBM_850()
- {
- check( "RTL_TEXTENCODING_IBM_850", RTL_TEXTENCODING_IBM_850 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_IBM_860()
- {
- check( "RTL_TEXTENCODING_IBM_860", RTL_TEXTENCODING_IBM_860 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_IBM_861()
- {
- check( "RTL_TEXTENCODING_IBM_861", RTL_TEXTENCODING_IBM_861 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_IBM_863()
- {
- check( "RTL_TEXTENCODING_IBM_863", RTL_TEXTENCODING_IBM_863 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_IBM_865()
- {
- check( "RTL_TEXTENCODING_IBM_865", RTL_TEXTENCODING_IBM_865 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_SYMBOL()
- {
- check( "RTL_TEXTENCODING_SYMBOL", RTL_TEXTENCODING_SYMBOL );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_ASCII_US()
- {
- check( "RTL_TEXTENCODING_ASCII_US", RTL_TEXTENCODING_ASCII_US );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_ISO_8859_1()
- {
- check( "RTL_TEXTENCODING_ISO_8859_1", RTL_TEXTENCODING_ISO_8859_1 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_ISO_8859_2()
- {
- check( "RTL_TEXTENCODING_ISO_8859_2", RTL_TEXTENCODING_ISO_8859_2 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_ISO_8859_3()
- {
- check( "RTL_TEXTENCODING_ISO_8859_3", RTL_TEXTENCODING_ISO_8859_3 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_ISO_8859_4()
- {
- check( "RTL_TEXTENCODING_ISO_8859_4", RTL_TEXTENCODING_ISO_8859_4 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_ISO_8859_5()
- {
- check( "RTL_TEXTENCODING_ISO_8859_5", RTL_TEXTENCODING_ISO_8859_5 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_ISO_8859_6()
- {
- check( "RTL_TEXTENCODING_ISO_8859_6", RTL_TEXTENCODING_ISO_8859_6 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_ISO_8859_7()
- {
- check( "RTL_TEXTENCODING_ISO_8859_7", RTL_TEXTENCODING_ISO_8859_7 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_ISO_8859_8()
- {
- check( "RTL_TEXTENCODING_ISO_8859_8", RTL_TEXTENCODING_ISO_8859_8 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_ISO_8859_9()
- {
- check( "RTL_TEXTENCODING_ISO_8859_9", RTL_TEXTENCODING_ISO_8859_9 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_ISO_8859_14()
- {
- check( "RTL_TEXTENCODING_ISO_8859_14", RTL_TEXTENCODING_ISO_8859_14 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_ISO_8859_15()
- {
- check( "RTL_TEXTENCODING_ISO_8859_15", RTL_TEXTENCODING_ISO_8859_15 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_IBM_737()
- {
- check( "RTL_TEXTENCODING_IBM_737", RTL_TEXTENCODING_IBM_737 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_IBM_775()
- {
- check( "RTL_TEXTENCODING_IBM_775", RTL_TEXTENCODING_IBM_775 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_IBM_852()
- {
- check( "RTL_TEXTENCODING_IBM_852", RTL_TEXTENCODING_IBM_852 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_IBM_855()
- {
- check( "RTL_TEXTENCODING_IBM_855", RTL_TEXTENCODING_IBM_855 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_IBM_857()
- {
- check( "RTL_TEXTENCODING_IBM_857", RTL_TEXTENCODING_IBM_857 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_IBM_862()
- {
- check( "RTL_TEXTENCODING_IBM_862", RTL_TEXTENCODING_IBM_862 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_IBM_864()
- {
- check( "RTL_TEXTENCODING_IBM_864", RTL_TEXTENCODING_IBM_864 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_IBM_866()
- {
- check( "RTL_TEXTENCODING_IBM_866", RTL_TEXTENCODING_IBM_866 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_IBM_869()
- {
- check( "RTL_TEXTENCODING_IBM_869", RTL_TEXTENCODING_IBM_869 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_MS_874()
- {
- check( "RTL_TEXTENCODING_MS_874", RTL_TEXTENCODING_MS_874 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_MS_1250()
- {
- check( "RTL_TEXTENCODING_MS_1250", RTL_TEXTENCODING_MS_1250 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_MS_1251()
- {
- check( "RTL_TEXTENCODING_MS_1251", RTL_TEXTENCODING_MS_1251 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_MS_1253()
- {
- check( "RTL_TEXTENCODING_MS_1253", RTL_TEXTENCODING_MS_1253 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_MS_1254()
- {
- check( "RTL_TEXTENCODING_MS_1254", RTL_TEXTENCODING_MS_1254 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_MS_1255()
- {
- check( "RTL_TEXTENCODING_MS_1255", RTL_TEXTENCODING_MS_1255 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_MS_1256()
- {
- check( "RTL_TEXTENCODING_MS_1256", RTL_TEXTENCODING_MS_1256 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_MS_1257()
- {
- check( "RTL_TEXTENCODING_MS_1257", RTL_TEXTENCODING_MS_1257 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_MS_1258()
- {
- check( "RTL_TEXTENCODING_MS_1258", RTL_TEXTENCODING_MS_1258 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_APPLE_ARABIC()
- {
- check( "RTL_TEXTENCODING_APPLE_ARABIC", RTL_TEXTENCODING_APPLE_ARABIC );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_APPLE_CENTEURO()
- {
- check( "RTL_TEXTENCODING_APPLE_CENTEURO", RTL_TEXTENCODING_APPLE_CENTEURO );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_APPLE_CROATIAN()
- {
- check( "RTL_TEXTENCODING_APPLE_CROATIAN", RTL_TEXTENCODING_APPLE_CROATIAN );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_APPLE_CYRILLIC()
- {
- check( "RTL_TEXTENCODING_APPLE_CYRILLIC", RTL_TEXTENCODING_APPLE_CYRILLIC );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_APPLE_DEVANAGARI()
- {
- check( "RTL_TEXTENCODING_APPLE_DEVANAGARI", RTL_TEXTENCODING_APPLE_DEVANAGARI );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_APPLE_FARSI()
- {
- check( "RTL_TEXTENCODING_APPLE_FARSI", RTL_TEXTENCODING_APPLE_FARSI );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_APPLE_GREEK()
- {
- check( "RTL_TEXTENCODING_APPLE_GREEK", RTL_TEXTENCODING_APPLE_GREEK );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_APPLE_GUJARATI()
- {
- check( "RTL_TEXTENCODING_APPLE_GUJARATI", RTL_TEXTENCODING_APPLE_GUJARATI );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_APPLE_GURMUKHI()
- {
- check( "RTL_TEXTENCODING_APPLE_GURMUKHI", RTL_TEXTENCODING_APPLE_GURMUKHI );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_APPLE_HEBREW()
- {
- check( "RTL_TEXTENCODING_APPLE_HEBREW", RTL_TEXTENCODING_APPLE_HEBREW );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_APPLE_ICELAND()
- {
- check( "RTL_TEXTENCODING_APPLE_ICELAND", RTL_TEXTENCODING_APPLE_ICELAND );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_APPLE_ROMANIAN()
- {
- check( "RTL_TEXTENCODING_APPLE_ROMANIAN", RTL_TEXTENCODING_APPLE_ROMANIAN );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_APPLE_THAI()
- {
- check( "RTL_TEXTENCODING_APPLE_THAI", RTL_TEXTENCODING_APPLE_THAI );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_APPLE_TURKISH()
- {
- check( "RTL_TEXTENCODING_APPLE_TURKISH", RTL_TEXTENCODING_APPLE_TURKISH );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_APPLE_UKRAINIAN()
- {
- check( "RTL_TEXTENCODING_APPLE_UKRAINIAN", RTL_TEXTENCODING_APPLE_UKRAINIAN );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_APPLE_CHINSIMP()
- {
- check( "RTL_TEXTENCODING_APPLE_CHINSIMP", RTL_TEXTENCODING_APPLE_CHINSIMP );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_APPLE_CHINTRAD()
- {
- check( "RTL_TEXTENCODING_APPLE_CHINTRAD", RTL_TEXTENCODING_APPLE_CHINTRAD );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_APPLE_JAPANESE()
- {
- check( "RTL_TEXTENCODING_APPLE_JAPANESE", RTL_TEXTENCODING_APPLE_JAPANESE );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_APPLE_KOREAN()
- {
- check( "RTL_TEXTENCODING_APPLE_KOREAN", RTL_TEXTENCODING_APPLE_KOREAN );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_MS_932()
- {
- check( "RTL_TEXTENCODING_MS_932", RTL_TEXTENCODING_MS_932 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_MS_936()
- {
- check( "RTL_TEXTENCODING_MS_936", RTL_TEXTENCODING_MS_936 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_MS_949()
- {
- check( "RTL_TEXTENCODING_MS_949", RTL_TEXTENCODING_MS_949 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_MS_950()
- {
- check( "RTL_TEXTENCODING_MS_950", RTL_TEXTENCODING_MS_950 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_SHIFT_JIS()
- {
- check( "RTL_TEXTENCODING_SHIFT_JIS", RTL_TEXTENCODING_SHIFT_JIS );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_GB_2312()
- {
- check( "RTL_TEXTENCODING_GB_2312", RTL_TEXTENCODING_GB_2312 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_GBT_12345()
- {
- check( "RTL_TEXTENCODING_GBT_12345", RTL_TEXTENCODING_GBT_12345 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_GBK()
- {
- check( "RTL_TEXTENCODING_GBK", RTL_TEXTENCODING_GBK );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_BIG5()
- {
- check( "RTL_TEXTENCODING_BIG5", RTL_TEXTENCODING_BIG5 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_EUC_JP()
- {
- check( "RTL_TEXTENCODING_EUC_JP", RTL_TEXTENCODING_EUC_JP );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_EUC_CN()
- {
- check( "RTL_TEXTENCODING_EUC_CN", RTL_TEXTENCODING_EUC_CN );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_EUC_TW()
- {
- check( "RTL_TEXTENCODING_EUC_TW", RTL_TEXTENCODING_EUC_TW );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_ISO_2022_JP()
- {
- check( "RTL_TEXTENCODING_ISO_2022_JP", RTL_TEXTENCODING_ISO_2022_JP );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_ISO_2022_CN()
- {
- check( "RTL_TEXTENCODING_ISO_2022_CN", RTL_TEXTENCODING_ISO_2022_CN );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_KOI8_R()
- {
- check( "RTL_TEXTENCODING_KOI8_R", RTL_TEXTENCODING_KOI8_R );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_UTF7()
- {
- check( "RTL_TEXTENCODING_UTF7", RTL_TEXTENCODING_UTF7 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_UTF8()
- {
- check( "RTL_TEXTENCODING_UTF8", RTL_TEXTENCODING_UTF8 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_ISO_8859_10()
- {
- check( "RTL_TEXTENCODING_ISO_8859_10", RTL_TEXTENCODING_ISO_8859_10 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_ISO_8859_13()
- {
- check( "RTL_TEXTENCODING_ISO_8859_13", RTL_TEXTENCODING_ISO_8859_13 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_EUC_KR()
- {
- check( "RTL_TEXTENCODING_EUC_KR", RTL_TEXTENCODING_EUC_KR );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_ISO_2022_KR()
- {
- check( "RTL_TEXTENCODING_ISO_2022_KR", RTL_TEXTENCODING_ISO_2022_KR );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_JIS_X_0201()
- {
- check( "RTL_TEXTENCODING_JIS_X_0201", RTL_TEXTENCODING_JIS_X_0201 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_JIS_X_0208()
- {
- check( "RTL_TEXTENCODING_JIS_X_0208", RTL_TEXTENCODING_JIS_X_0208 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_JIS_X_0212()
- {
- check( "RTL_TEXTENCODING_JIS_X_0212", RTL_TEXTENCODING_JIS_X_0212 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_MS_1361()
- {
- check( "RTL_TEXTENCODING_MS_1361", RTL_TEXTENCODING_MS_1361 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_GB_18030()
- {
- check( "RTL_TEXTENCODING_GB_18030", RTL_TEXTENCODING_GB_18030 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_BIG5_HKSCS()
- {
- check( "RTL_TEXTENCODING_BIG5_HKSCS", RTL_TEXTENCODING_BIG5_HKSCS );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_TIS_620()
- {
- check( "RTL_TEXTENCODING_TIS_620", RTL_TEXTENCODING_TIS_620 );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_KOI8_U()
- {
- check( "RTL_TEXTENCODING_KOI8_U", RTL_TEXTENCODING_KOI8_U );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_ISCII_DEVANAGARI()
- {
- check( "RTL_TEXTENCODING_ISCII_DEVANAGARI", RTL_TEXTENCODING_ISCII_DEVANAGARI );
- }
- // ----------------------------------------
- void WindowsCharsetFromTextEncoding_JAVA_UTF8()
- {
- check( "RTL_TEXTENCODING_JAVA_UTF8", RTL_TEXTENCODING_JAVA_UTF8 );
- }
- // ----------------------------------------
-
- CPPUNIT_TEST_SUITE( getBestWindows );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1252 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_ROMAN );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_437 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_850 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_860 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_861 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_863 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_865 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_SYMBOL );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ASCII_US );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_1 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_2 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_3 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_4 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_5 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_6 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_7 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_8 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_9 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_14 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_15 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_737 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_775 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_852 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_855 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_857 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_862 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_864 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_866 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_IBM_869 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_874 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1250 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1251 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1253 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1254 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1255 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1256 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1257 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1258 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_ARABIC );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CENTEURO );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CROATIAN );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CYRILLIC );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_DEVANAGARI );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_FARSI );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_GREEK );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_GUJARATI );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_GURMUKHI );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_HEBREW );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_ICELAND );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_ROMANIAN );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_THAI );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_TURKISH );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_UKRAINIAN );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CHINSIMP );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_CHINTRAD );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_JAPANESE );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_APPLE_KOREAN );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_932 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_936 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_949 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_950 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_SHIFT_JIS );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_GB_2312 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_GBT_12345 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_GBK );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_BIG5 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_EUC_JP );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_EUC_CN );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_EUC_TW );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_2022_JP );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_2022_CN );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_KOI8_R );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_UTF7 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_UTF8 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_10 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_8859_13 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_EUC_KR );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISO_2022_KR );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_JIS_X_0201 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_JIS_X_0208 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_JIS_X_0212 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_MS_1361 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_GB_18030 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_BIG5_HKSCS );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_TIS_620 );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_KOI8_U );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_ISCII_DEVANAGARI );
- CPPUNIT_TEST( WindowsCharsetFromTextEncoding_JAVA_UTF8 );
-
- CPPUNIT_TEST_SUITE_END( );
- };
- class getTextEncodingInfo: public CppUnit::TestFixture
- {
- public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- // not implemented encoding test
- void getTextEncodingInfo_001()
- {
- rtl_TextEncodingInfo aInfo1, aInfo2, aInfo3, aInfo4, aInfo5;
- aInfo1.StructSize = 4;
- // not implemented
- sal_Bool bRes1 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo1 );
- // implemented
- sal_Bool bRes11 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC, &aInfo1 );
- CPPUNIT_ASSERT_MESSAGE("should return sal_False.", bRes1 == sal_False && bRes11 == sal_False );
-
- aInfo2.StructSize = 5;
- sal_Bool bRes2 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo2 );
- sal_Bool bRes21 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC, &aInfo2 );
- CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes2 == sal_True && bRes21 == sal_True && aInfo2.MinimumCharSize >=1 );
-
- aInfo3.StructSize = 6;
- sal_Bool bRes3 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo3 );
- sal_Bool bRes31 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC, &aInfo3 );
- CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes3 == sal_True && bRes31 == sal_True );
-//&& aInfo2.MinimumCharSize >=1 );
-
- aInfo4.StructSize = 8;
- sal_Bool bRes4 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo4 );
- sal_Bool bRes41 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_CYRILLIC, &aInfo4);
- CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes4 == sal_True && bRes41 == sal_True);
-// && aInfo2.MinimumCharSize >=1 );
-
- aInfo5.StructSize = sizeof aInfo5;
- sal_Bool bRes5 = rtl_getTextEncodingInfo( RTL_TEXTENCODING_APPLE_ARABIC, &aInfo5 );
- CPPUNIT_ASSERT_MESSAGE("StructSize<6 should return sal_True", bRes5 == sal_False && aInfo5.Flags == 0);
-
- }
- CPPUNIT_TEST_SUITE(getTextEncodingInfo);
- CPPUNIT_TEST(getTextEncodingInfo_001);
- //CPPUNIT_TEST(getTextEncodingInfo_002);
- CPPUNIT_TEST_SUITE_END();
- };
-}
-
-namespace {
-
-class TestEncodingFromUnix: public CppUnit::TestFixture {
-public:
- void testIso8859() {
- check(RTL_TEXTENCODING_DONTKNOW, "ISO8859");
- check(RTL_TEXTENCODING_DONTKNOW, "ISO8859-0");
- check(RTL_TEXTENCODING_DONTKNOW, "ISO8859-01");
- check(RTL_TEXTENCODING_DONTKNOW, "ISO8859_1");
- check(RTL_TEXTENCODING_DONTKNOW, "ISO88591");
- check(RTL_TEXTENCODING_ISO_8859_1, "ISO8859-1");
- check(RTL_TEXTENCODING_ISO_8859_2, "ISO8859-2");
- check(RTL_TEXTENCODING_ISO_8859_3, "ISO8859-3");
- check(RTL_TEXTENCODING_ISO_8859_4, "ISO8859-4");
- check(RTL_TEXTENCODING_ISO_8859_5, "ISO8859-5");
- check(RTL_TEXTENCODING_ISO_8859_6, "ISO8859-6");
- check(RTL_TEXTENCODING_ISO_8859_7, "ISO8859-7");
- check(RTL_TEXTENCODING_ISO_8859_8, "ISO8859-8");
- check(RTL_TEXTENCODING_ISO_8859_9, "ISO8859-9");
- check(RTL_TEXTENCODING_ISO_8859_10, "ISO8859-10");
- check(RTL_TEXTENCODING_TIS_620, "ISO8859-11");
- check(RTL_TEXTENCODING_ISO_8859_13, "ISO8859-13");
- check(RTL_TEXTENCODING_ISO_8859_14, "ISO8859-14");
- check(RTL_TEXTENCODING_ISO_8859_15, "ISO8859-15");
- }
-
- void testTis620() {
- check(RTL_TEXTENCODING_DONTKNOW, "TIS620");
- check(RTL_TEXTENCODING_TIS_620, "TIS620-0");
- check(RTL_TEXTENCODING_DONTKNOW, "TIS620-1");
- check(RTL_TEXTENCODING_TIS_620, "TIS620-2529");
- check(RTL_TEXTENCODING_TIS_620, "TIS620-2533");
- check(RTL_TEXTENCODING_DONTKNOW, "TIS620.2529-0");
- check(RTL_TEXTENCODING_TIS_620, "TIS620.2529-1");
- check(RTL_TEXTENCODING_DONTKNOW, "TIS620.2529-2");
- check(RTL_TEXTENCODING_TIS_620, "TIS620.2533-0");
- check(RTL_TEXTENCODING_TIS_620, "TIS620.2533-1");
- check(RTL_TEXTENCODING_DONTKNOW, "TIS620.2533-2");
- }
-
- CPPUNIT_TEST_SUITE(TestEncodingFromUnix);
- CPPUNIT_TEST(testIso8859);
- CPPUNIT_TEST(testTis620);
- CPPUNIT_TEST_SUITE_END();
-
-private:
- void check(rtl_TextEncoding expected, char const * input) {
- CPPUNIT_ASSERT_EQUAL_MESSAGE(
- input, expected, rtl_getTextEncodingFromUnixCharset(input));
- }
-};
-
-}
-
-// -----------------------------------------------------------------------------
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( rtl_tencinfo::getBestMime, "rtl_tencinfo" );
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( rtl_tencinfo::getBestUnix, "rtl_tencinfo" );
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( rtl_tencinfo::getBestWindows, "rtl_tencinfo" );
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( rtl_tencinfo::getTextEncodingInfo, "rtl_tencinfo" );
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(
- TestEncodingFromUnix, "TestEncodingFromUnix");
-
-// -----------------------------------------------------------------------------
-
-NOADDITIONAL;
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/textenc/rtl_textcvt.cxx b/sal/qa/rtl/textenc/rtl_textcvt.cxx
deleted file mode 100644
index 5adafc5ee..000000000
--- a/sal/qa/rtl/textenc/rtl_textcvt.cxx
+++ /dev/null
@@ -1,2905 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-#include "sal/config.h"
-
-#include <cstddef>
-#include <cstring>
-
-#include "testshl/simpleheader.hxx"
-#include "rtl/string.hxx"
-#include "rtl/tencinfo.h"
-#include "rtl/textcvt.h"
-#include "rtl/textenc.h"
-#include "sal/types.h"
-#include <sal/macros.h>
-
-namespace {
-
-struct SingleByteCharSet {
- rtl_TextEncoding m_nEncoding;
- sal_Unicode m_aMap[256];
-};
-
-void testSingleByteCharSet(SingleByteCharSet const & rSet) {
- sal_Char aText[256];
- sal_Unicode aUnicode[256];
- sal_Size nNumber = 0;
- for (int i = 0; i < 256; ++i) {
- if (rSet.m_aMap[i] != 0xFFFF) {
- aText[nNumber++] = static_cast< sal_Char >(i);
- }
- }
- {
- rtl_TextToUnicodeConverter aConverter
- = rtl_createTextToUnicodeConverter(rSet.m_nEncoding);
- rtl_TextToUnicodeContext aContext
- = rtl_createTextToUnicodeContext(aConverter);
- CPPUNIT_ASSERT_MESSAGE("failure #1", aConverter && aContext);
- sal_Size nSize;
- sal_uInt32 nInfo;
- sal_Size nConverted;
- nSize = rtl_convertTextToUnicode(
- aConverter, aContext, aText, nNumber, aUnicode, nNumber,
- (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR
- | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
- | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR),
- &nInfo, &nConverted);
- CPPUNIT_ASSERT_MESSAGE(
- "failure #2",
- nSize == nNumber && nInfo == 0 && nConverted == nNumber);
- rtl_destroyTextToUnicodeContext(aConverter, aContext);
- rtl_destroyTextToUnicodeConverter(aConverter);
- }
- {
- bool bSuccess = true;
- int j = 0;
- for (int i = 0; i < 256; ++i) {
- if (rSet.m_aMap[i] != 0xFFFF && aUnicode[j++] != rSet.m_aMap[i]) {
- bSuccess = false;
- break;
- }
- }
- CPPUNIT_ASSERT_MESSAGE("failure #3", bSuccess);
- }
- if (rSet.m_nEncoding == RTL_TEXTENCODING_ASCII_US) {
- nNumber = 128;
- }
- {
- rtl_UnicodeToTextConverter aConverter
- = rtl_createUnicodeToTextConverter(rSet.m_nEncoding);
- rtl_UnicodeToTextContext aContext
- = rtl_createUnicodeToTextContext(aConverter);
- CPPUNIT_ASSERT_MESSAGE("failure #4", aConverter && aContext);
- sal_Size nSize;
- sal_uInt32 nInfo;
- sal_Size nConverted;
- nSize = rtl_convertUnicodeToText(
- aConverter, aContext, aUnicode, nNumber, aText, nNumber,
- (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR
- | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR),
- &nInfo, &nConverted);
- CPPUNIT_ASSERT_MESSAGE(
- "failure #5",
- nSize == nNumber && nInfo == 0 && nConverted == nNumber);
- rtl_destroyUnicodeToTextContext(aConverter, aContext);
- rtl_destroyUnicodeToTextConverter(aConverter);
- }
- {
- bool bSuccess = true;
- int j = 0;
- for (int i = 0; i < 256; ++i) {
- if (rSet.m_aMap[i] != 0xFFFF
- && aText[j++] != static_cast< sal_Char >(i))
- {
- bSuccess = false;
- break;
- }
- }
- CPPUNIT_ASSERT_MESSAGE("failure #6", bSuccess);
- }
- for (int i = 0; i < 256; ++i) {
- if (rSet.m_aMap[i] == 0xFFFF) {
- aText[0] = static_cast< sal_Char >(i);
- rtl_TextToUnicodeConverter aConverter
- = rtl_createTextToUnicodeConverter(rSet.m_nEncoding);
- rtl_TextToUnicodeContext aContext
- = rtl_createTextToUnicodeContext(aConverter);
- CPPUNIT_ASSERT_MESSAGE("failure #7", aConverter && aContext);
- sal_Size nSize;
- sal_uInt32 nInfo;
- sal_Size nConverted;
- nSize = rtl_convertTextToUnicode(
- aConverter, aContext, aText, 1, aUnicode, 1,
- (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR
- | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
- | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR),
- &nInfo, &nConverted);
- CPPUNIT_ASSERT_MESSAGE(
- "failure #9",
- (nSize == 0
- && (nInfo
- == (RTL_TEXTTOUNICODE_INFO_ERROR
- | RTL_TEXTTOUNICODE_INFO_UNDEFINED))
- && nConverted == 0));
- rtl_destroyTextToUnicodeContext(aConverter, aContext);
- rtl_destroyTextToUnicodeConverter(aConverter);
- }
- }
-}
-
-int const TEST_STRING_SIZE = 1000;
-
-struct ComplexCharSetTest {
- rtl_TextEncoding m_nEncoding;
- char const * m_pText;
- sal_Size m_nTextSize;
- sal_Unicode m_aUnicode[TEST_STRING_SIZE];
- sal_Size m_nUnicodeSize;
- bool m_bNoContext;
- bool m_bForward;
- bool m_bReverse;
- bool m_bGlobalSignature;
- sal_uInt32 m_nReverseUndefined;
-};
-
-void doComplexCharSetTest(ComplexCharSetTest const & rTest) {
- if (rTest.m_bForward) {
- sal_Unicode aUnicode[TEST_STRING_SIZE];
- rtl_TextToUnicodeConverter aConverter
- = rtl_createTextToUnicodeConverter(rTest.m_nEncoding);
- rtl_TextToUnicodeContext aContext
- = rtl_createTextToUnicodeContext(aConverter);
- CPPUNIT_ASSERT_MESSAGE("failure #10", aConverter && aContext);
- sal_Size nSize;
- sal_uInt32 nInfo;
- sal_Size nConverted;
- nSize = rtl_convertTextToUnicode(
- aConverter, aContext,
- reinterpret_cast< sal_Char const * >(rTest.m_pText),
- rTest.m_nTextSize, aUnicode, TEST_STRING_SIZE,
- (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR
- | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
- | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR
- | RTL_TEXTTOUNICODE_FLAGS_FLUSH
- | (rTest.m_bGlobalSignature ?
- RTL_TEXTTOUNICODE_FLAGS_GLOBAL_SIGNATURE : 0)),
- &nInfo, &nConverted);
- CPPUNIT_ASSERT_MESSAGE(
- "failure #11",
- (nSize == rTest.m_nUnicodeSize && nInfo == 0
- && nConverted == rTest.m_nTextSize));
- rtl_destroyTextToUnicodeContext(aConverter, aContext);
- rtl_destroyTextToUnicodeConverter(aConverter);
- bool bSuccess = true;
- for (sal_Size i = 0; i < rTest.m_nUnicodeSize; ++i) {
- if (aUnicode[i] != rTest.m_aUnicode[i]) {
- bSuccess = false;
- break;
- }
- }
- CPPUNIT_ASSERT_MESSAGE("failure #12", bSuccess);
- }
- if (rTest.m_bForward) {
- sal_Unicode aUnicode[TEST_STRING_SIZE];
- rtl_TextToUnicodeConverter aConverter
- = rtl_createTextToUnicodeConverter(rTest.m_nEncoding);
- rtl_TextToUnicodeContext aContext
- = rtl_createTextToUnicodeContext(aConverter);
- CPPUNIT_ASSERT_MESSAGE("failure #13", aConverter && aContext);
- if (aContext != (rtl_TextToUnicodeContext) 1) {
- sal_Size nInput = 0;
- sal_Size nOutput = 0;
- for (bool bFlush = true; nInput < rTest.m_nTextSize || bFlush;) {
- sal_Size nSrcBytes = 1;
- sal_uInt32 nFlags
- = (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR
- | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
- | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR
- | (rTest.m_bGlobalSignature ?
- RTL_TEXTTOUNICODE_FLAGS_GLOBAL_SIGNATURE : 0));
- if (nInput >= rTest.m_nTextSize) {
- nSrcBytes = 0;
- nFlags |= RTL_TEXTTOUNICODE_FLAGS_FLUSH;
- bFlush = false;
- }
- sal_uInt32 nInfo;
- sal_Size nConverted;
- sal_Size nSize = rtl_convertTextToUnicode(
- aConverter, aContext,
- reinterpret_cast< sal_Char const * >(rTest.m_pText + nInput),
- nSrcBytes, aUnicode + nOutput, TEST_STRING_SIZE - nOutput,
- nFlags, &nInfo, &nConverted);
- nOutput += nSize;
- nInput += nConverted;
- CPPUNIT_ASSERT_MESSAGE(
- "failure #14",
- (nInfo & ~RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL) == 0);
- }
- CPPUNIT_ASSERT_MESSAGE(
- "failure #15",
- nOutput == rTest.m_nUnicodeSize && nInput == rTest.m_nTextSize);
- bool bSuccess = true;
- for (sal_Size i = 0; i < rTest.m_nUnicodeSize; ++i) {
- if (aUnicode[i] != rTest.m_aUnicode[i]) {
- bSuccess = false;
- break;
- }
- }
- CPPUNIT_ASSERT_MESSAGE("failure #16", bSuccess);
- }
- rtl_destroyTextToUnicodeContext(aConverter, aContext);
- rtl_destroyTextToUnicodeConverter(aConverter);
- }
- if (rTest.m_bNoContext && rTest.m_bForward) {
- sal_Unicode aUnicode[TEST_STRING_SIZE];
- int nSize = 0;
- rtl_TextToUnicodeConverter aConverter
- = rtl_createTextToUnicodeConverter(rTest.m_nEncoding);
- CPPUNIT_ASSERT_MESSAGE("failure #17", aConverter);
- for (sal_Size i = 0;;) {
- if (i == rTest.m_nTextSize) {
- goto done;
- }
- sal_Char c1 = rTest.m_pText[i++];
- sal_Unicode aUC[2];
- sal_uInt32 nInfo = 0;
- sal_Size nCvtBytes;
- sal_Size nChars = rtl_convertTextToUnicode(
- aConverter, 0, &c1, 1, aUC, 2,
- (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR
- | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
- | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR
- | (rTest.m_bGlobalSignature ?
- RTL_TEXTTOUNICODE_FLAGS_GLOBAL_SIGNATURE : 0)),
- &nInfo, &nCvtBytes);
- if ((nInfo & RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL) != 0) {
- sal_Char sBuffer[10];
- sBuffer[0] = c1;
- sal_uInt16 nLen = 1;
- while ((nInfo & RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL) != 0
- && nLen < 10)
- {
- if (i == rTest.m_nTextSize) {
- goto done;
- }
- c1 = rTest.m_pText[i++];
- sBuffer[nLen++] = c1;
- nChars = rtl_convertTextToUnicode(
- aConverter, 0, sBuffer, nLen, aUC, 2,
- (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR
- | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
- | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR
- | (rTest.m_bGlobalSignature ?
- RTL_TEXTTOUNICODE_FLAGS_GLOBAL_SIGNATURE : 0)),
- &nInfo, &nCvtBytes);
- }
- if (nChars == 1 && nInfo == 0) {
- OSL_ASSERT(nCvtBytes == nLen);
- aUnicode[nSize++] = aUC[0];
- } else if (nChars == 2 && nInfo == 0) {
- OSL_ASSERT(nCvtBytes == nLen);
- aUnicode[nSize++] = aUC[0];
- aUnicode[nSize++] = aUC[1];
- } else {
- OSL_ASSERT(
- (nInfo & RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL) == 0
- && nChars == 0 && nInfo != 0);
- aUnicode[nSize++] = sBuffer[0];
- i -= nLen - 1;
- }
- } else if (nChars == 1 && nInfo == 0) {
- OSL_ASSERT(nCvtBytes == 1);
- aUnicode[nSize++] = aUC[0];
- } else if (nChars == 2 && nInfo == 0) {
- OSL_ASSERT(nCvtBytes == 1);
- aUnicode[nSize++] = aUC[0];
- aUnicode[nSize++] = aUC[1];
- } else {
- OSL_ASSERT(nChars == 0 && nInfo != 0);
- aUnicode[nSize++] = c1;
- }
- }
- done:
- rtl_destroyTextToUnicodeConverter(aConverter);
- bool bSuccess = true;
- for (sal_Size i = 0; i < rTest.m_nUnicodeSize; ++i) {
- if (aUnicode[i] != rTest.m_aUnicode[i]) {
- bSuccess = false;
- break;
- }
- }
- CPPUNIT_ASSERT_MESSAGE("failure #18", bSuccess);
- }
- if (rTest.m_bReverse) {
- sal_Char aText[TEST_STRING_SIZE];
- rtl_UnicodeToTextConverter aConverter
- = rtl_createUnicodeToTextConverter(rTest.m_nEncoding);
- rtl_UnicodeToTextContext aContext
- = rtl_createUnicodeToTextContext(aConverter);
- CPPUNIT_ASSERT_MESSAGE("failure #19", aConverter && aContext);
- sal_Size nSize;
- sal_uInt32 nInfo;
- sal_Size nConverted;
- nSize = rtl_convertUnicodeToText(
- aConverter, aContext, rTest.m_aUnicode, rTest.m_nUnicodeSize, aText,
- TEST_STRING_SIZE,
- (rTest.m_nReverseUndefined | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR
- | RTL_UNICODETOTEXT_FLAGS_FLUSH
- | (rTest.m_bGlobalSignature ?
- RTL_UNICODETOTEXT_FLAGS_GLOBAL_SIGNATURE : 0)),
- &nInfo, &nConverted);
- CPPUNIT_ASSERT_MESSAGE(
- "failure #20",
- (nSize == rTest.m_nTextSize
- && (nInfo == 0
- || (nInfo == RTL_UNICODETOTEXT_INFO_UNDEFINED
- && (rTest.m_nReverseUndefined
- != RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR)))
- && nConverted == rTest.m_nUnicodeSize));
- rtl_destroyUnicodeToTextContext(aConverter, aContext);
- rtl_destroyUnicodeToTextConverter(aConverter);
- bool bSuccess = true;
- for (sal_Size i = 0; i < rTest.m_nTextSize; ++i) {
- if (aText[i] != rTest.m_pText[i]) {
- bSuccess = false;
- break;
- }
- }
- CPPUNIT_ASSERT_MESSAGE("failure #21", bSuccess);
- }
-}
-
-void doComplexCharSetCutTest(ComplexCharSetTest const & rTest) {
- if (rTest.m_bNoContext) {
- sal_Unicode aUnicode[TEST_STRING_SIZE];
- rtl_TextToUnicodeConverter aConverter
- = rtl_createTextToUnicodeConverter(rTest.m_nEncoding);
- CPPUNIT_ASSERT_MESSAGE("failure #22", aConverter);
- sal_Size nSize;
- sal_uInt32 nInfo;
- sal_Size nConverted;
- nSize = rtl_convertTextToUnicode(
- aConverter, 0, reinterpret_cast< sal_Char const * >(rTest.m_pText),
- rTest.m_nTextSize, aUnicode, TEST_STRING_SIZE,
- (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR
- | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
- | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR),
- &nInfo, &nConverted);
- CPPUNIT_ASSERT_MESSAGE(
- "failure #23",
- (nSize <= rTest.m_nUnicodeSize
- && (nInfo == RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL
- || (nInfo
- == (RTL_TEXTTOUNICODE_INFO_ERROR
- | RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL)))
- && nConverted < rTest.m_nTextSize));
- rtl_destroyTextToUnicodeConverter(aConverter);
- bool bSuccess = true;
- for (sal_Size i = 0; i < nSize; ++i) {
- if (aUnicode[i] != rTest.m_aUnicode[i]) {
- bSuccess = false;
- break;
- }
- }
- CPPUNIT_ASSERT_MESSAGE("failure #24", bSuccess);
- }
-}
-
-class Test: public CppUnit::TestFixture {
-public:
- void testSingleByte();
-
- void testComplex();
-
- void testComplexCut();
-
- void testSRCBUFFERTOSMALL();
-
- void testMime();
-
- void testWindows();
-
- void testInfo();
-
- CPPUNIT_TEST_SUITE(Test);
- CPPUNIT_TEST(testSingleByte);
- CPPUNIT_TEST(testComplex);
- CPPUNIT_TEST(testComplexCut);
- CPPUNIT_TEST(testSRCBUFFERTOSMALL);
- CPPUNIT_TEST(testMime);
- CPPUNIT_TEST(testWindows);
- CPPUNIT_TEST(testInfo);
- CPPUNIT_TEST_SUITE_END();
-};
-
-void Test::testSingleByte() {
- static SingleByteCharSet const data[]
- = { { RTL_TEXTENCODING_MS_1250,
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x20AC,0xFFFF,0x201A,0xFFFF,0x201E,0x2026,0x2020,0x2021,
- 0xFFFF,0x2030,0x0160,0x2039,0x015A,0x0164,0x017D,0x0179,
- 0xFFFF,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
- 0xFFFF,0x2122,0x0161,0x203A,0x015B,0x0165,0x017E,0x017A,
- 0x00A0,0x02C7,0x02D8,0x0141,0x00A4,0x0104,0x00A6,0x00A7,
- 0x00A8,0x00A9,0x015E,0x00AB,0x00AC,0x00AD,0x00AE,0x017B,
- 0x00B0,0x00B1,0x02DB,0x0142,0x00B4,0x00B5,0x00B6,0x00B7,
- 0x00B8,0x0105,0x015F,0x00BB,0x013D,0x02DD,0x013E,0x017C,
- 0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7,
- 0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E,
- 0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7,
- 0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF,
- 0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7,
- 0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F,
- 0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7,
- 0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9 } },
- { RTL_TEXTENCODING_MS_1251,
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x0402,0x0403,0x201A,0x0453,0x201E,0x2026,0x2020,0x2021,
- 0x20AC,0x2030,0x0409,0x2039,0x040A,0x040C,0x040B,0x040F,
- 0x0452,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
- 0xFFFF,0x2122,0x0459,0x203A,0x045A,0x045C,0x045B,0x045F,
- 0x00A0,0x040E,0x045E,0x0408,0x00A4,0x0490,0x00A6,0x00A7,
- 0x0401,0x00A9,0x0404,0x00AB,0x00AC,0x00AD,0x00AE,0x0407,
- 0x00B0,0x00B1,0x0406,0x0456,0x0491,0x00B5,0x00B6,0x00B7,
- 0x0451,0x2116,0x0454,0x00BB,0x0458,0x0405,0x0455,0x0457,
- 0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0416,0x0417,
- 0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,0x041F,
- 0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,0x0427,
- 0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E,0x042F,
- 0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0436,0x0437,
- 0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,0x043F,
- 0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,0x0447,
- 0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E,0x044F } },
- { RTL_TEXTENCODING_MS_1252,
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x20AC,0xFFFF,0x201A,0x0192,0x201E,0x2026,0x2020,0x2021,
- 0x02C6,0x2030,0x0160,0x2039,0x0152,0xFFFF,0x017D,0xFFFF,
- 0xFFFF,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
- 0x02DC,0x2122,0x0161,0x203A,0x0153,0xFFFF,0x017E,0x0178,
- 0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
- 0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
- 0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,
- 0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,
- 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
- 0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,
- 0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,
- 0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,
- 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
- 0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,
- 0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF } },
- { RTL_TEXTENCODING_MS_1253,
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x20AC,0xFFFF,0x201A,0x0192,0x201E,0x2026,0x2020,0x2021,
- 0xFFFF,0x2030,0xFFFF,0x2039,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
- 0xFFFF,0x2122,0xFFFF,0x203A,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0x00A0,0x0385,0x0386,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
- 0x00A8,0x00A9,0xFFFF,0x00AB,0x00AC,0x00AD,0x00AE,0x2015,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x0384,0x00B5,0x00B6,0x00B7,
- 0x0388,0x0389,0x038A,0x00BB,0x038C,0x00BD,0x038E,0x038F,
- 0x0390,0x0391,0x0392,0x0393,0x0394,0x0395,0x0396,0x0397,
- 0x0398,0x0399,0x039A,0x039B,0x039C,0x039D,0x039E,0x039F,
- 0x03A0,0x03A1,0xFFFF,0x03A3,0x03A4,0x03A5,0x03A6,0x03A7,
- 0x03A8,0x03A9,0x03AA,0x03AB,0x03AC,0x03AD,0x03AE,0x03AF,
- 0x03B0,0x03B1,0x03B2,0x03B3,0x03B4,0x03B5,0x03B6,0x03B7,
- 0x03B8,0x03B9,0x03BA,0x03BB,0x03BC,0x03BD,0x03BE,0x03BF,
- 0x03C0,0x03C1,0x03C2,0x03C3,0x03C4,0x03C5,0x03C6,0x03C7,
- 0x03C8,0x03C9,0x03CA,0x03CB,0x03CC,0x03CD,0x03CE,0xFFFF } },
- { RTL_TEXTENCODING_MS_1254,
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x20AC,0xFFFF,0x201A,0x0192,0x201E,0x2026,0x2020,0x2021,
- 0x02C6,0x2030,0x0160,0x2039,0x0152,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
- 0x02DC,0x2122,0x0161,0x203A,0x0153,0xFFFF,0xFFFF,0x0178,
- 0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
- 0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
- 0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,
- 0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,
- 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
- 0x011E,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,
- 0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x0130,0x015E,0x00DF,
- 0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,
- 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
- 0x011F,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,
- 0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x0131,0x015F,0x00FF } },
- { RTL_TEXTENCODING_APPLE_ROMAN,
- { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E, 0x7F,
- 0x00C4,0x00C5,0x00C7,0x00C9,0x00D1,0x00D6,0x00DC,0x00E1,
- 0x00E0,0x00E2,0x00E4,0x00E3,0x00E5,0x00E7,0x00E9,0x00E8,
- 0x00EA,0x00EB,0x00ED,0x00EC,0x00EE,0x00EF,0x00F1,0x00F3,
- 0x00F2,0x00F4,0x00F6,0x00F5,0x00FA,0x00F9,0x00FB,0x00FC,
- 0x2020,0x00B0,0x00A2,0x00A3,0x00A7,0x2022,0x00B6,0x00DF,
- 0x00AE,0x00A9,0x2122,0x00B4,0x00A8,0x2260,0x00C6,0x00D8,
- 0x221E,0x00B1,0x2264,0x2265,0x00A5,0x00B5,0x2202,0x2211,
- 0x220F,0x03C0,0x222B,0x00AA,0x00BA,0x03A9,0x00E6,0x00F8,
- 0x00BF,0x00A1,0x00AC,0x221A,0x0192,0x2248,0x2206,0x00AB,
- 0x00BB,0x2026,0x00A0,0x00C0,0x00C3,0x00D5,0x0152,0x0153,
- 0x2013,0x2014,0x201C,0x201D,0x2018,0x2019,0x00F7,0x25CA,
- 0x00FF,0x0178,0x2044,0x20AC,0x2039,0x203A,0xFB01,0xFB02,
- 0x2021,0x00B7,0x201A,0x201E,0x2030,0x00C2,0x00CA,0x00C1,
- 0x00CB,0x00C8,0x00CD,0x00CE,0x00CF,0x00CC,0x00D3,0x00D4,
- 0xF8FF,0x00D2,0x00DA,0x00DB,0x00D9,0x0131,0x02C6,0x02DC,
- 0x00AF,0x02D8,0x02D9,0x02DA,0x00B8,0x02DD,0x02DB,0x02C7 } },
- { RTL_TEXTENCODING_IBM_437,
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x00c7,0x00fc,0x00e9,0x00e2,0x00e4,0x00e0,0x00e5,0x00e7,
- 0x00ea,0x00eb,0x00e8,0x00ef,0x00ee,0x00ec,0x00c4,0x00c5,
- 0x00c9,0x00e6,0x00c6,0x00f4,0x00f6,0x00f2,0x00fb,0x00f9,
- 0x00ff,0x00d6,0x00dc,0x00a2,0x00a3,0x00a5,0x20a7,0x0192,
- 0x00e1,0x00ed,0x00f3,0x00fa,0x00f1,0x00d1,0x00aa,0x00ba,
- 0x00bf,0x2310,0x00ac,0x00bd,0x00bc,0x00a1,0x00ab,0x00bb,
- 0x2591,0x2592,0x2593,0x2502,0x2524,0x2561,0x2562,0x2556,
- 0x2555,0x2563,0x2551,0x2557,0x255d,0x255c,0x255b,0x2510,
- 0x2514,0x2534,0x252c,0x251c,0x2500,0x253c,0x255e,0x255f,
- 0x255a,0x2554,0x2569,0x2566,0x2560,0x2550,0x256c,0x2567,
- 0x2568,0x2564,0x2565,0x2559,0x2558,0x2552,0x2553,0x256b,
- 0x256a,0x2518,0x250c,0x2588,0x2584,0x258c,0x2590,0x2580,
- 0x03b1,0x00df,0x0393,0x03c0,0x03a3,0x03c3,0x00b5,0x03c4,
- 0x03a6,0x0398,0x03a9,0x03b4,0x221e,0x03c6,0x03b5,0x2229,
- 0x2261,0x00b1,0x2265,0x2264,0x2320,0x2321,0x00f7,0x2248,
- 0x00b0,0x2219,0x00b7,0x221a,0x207f,0x00b2,0x25a0,0x00a0 } },
- // ...
- { RTL_TEXTENCODING_ASCII_US,
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x20AC,0xFFFF,0x201A,0x0192,0x201E,0x2026,0x2020,0x2021, // !
- 0x02C6,0x2030,0x0160,0x2039,0x0152,0xFFFF,0x017D,0xFFFF, // !
- 0xFFFF,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014, // !
- 0x02DC,0x2122,0x0161,0x203A,0x0153,0xFFFF,0x017E,0x0178, // !
- 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,
- 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
- 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7,
- 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
- 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
- 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
- 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
- 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
- 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
- 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
- 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
- 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF } },
- { RTL_TEXTENCODING_ISO_8859_1,
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,
- 0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,
- 0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,
- 0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F,
- 0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
- 0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
- 0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,
- 0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,
- 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
- 0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,
- 0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,
- 0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,
- 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
- 0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,
- 0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF } },
- { RTL_TEXTENCODING_ISO_8859_2,
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,
- 0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,
- 0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,
- 0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F,
- 0x00A0,0x0104,0x02D8,0x0141,0x00A4,0x013D,0x015A,0x00A7,
- 0x00A8,0x0160,0x015E,0x0164,0x0179,0x00AD,0x017D,0x017B,
- 0x00B0,0x0105,0x02DB,0x0142,0x00B4,0x013E,0x015B,0x02C7,
- 0x00B8,0x0161,0x015F,0x0165,0x017A,0x02DD,0x017E,0x017C,
- 0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7,
- 0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E,
- 0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7,
- 0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF,
- 0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7,
- 0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F,
- 0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7,
- 0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9 } },
- { RTL_TEXTENCODING_ISO_8859_3,
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,
- 0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,
- 0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,
- 0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F,
- 0x00A0,0x0126,0x02D8,0x00A3,0x00A4,0xFFFF,0x0124,0x00A7,
- 0x00A8,0x0130,0x015E,0x011E,0x0134,0x00AD,0xFFFF,0x017B,
- 0x00B0,0x0127,0x00B2,0x00B3,0x00B4,0x00B5,0x0125,0x00B7,
- 0x00B8,0x0131,0x015F,0x011F,0x0135,0x00BD,0xFFFF,0x017C,
- 0x00C0,0x00C1,0x00C2,0xFFFF,0x00C4,0x010A,0x0108,0x00C7,
- 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
- 0xFFFF,0x00D1,0x00D2,0x00D3,0x00D4,0x0120,0x00D6,0x00D7,
- 0x011C,0x00D9,0x00DA,0x00DB,0x00DC,0x016C,0x015C,0x00DF,
- 0x00E0,0x00E1,0x00E2,0xFFFF,0x00E4,0x010B,0x0109,0x00E7,
- 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
- 0xFFFF,0x00F1,0x00F2,0x00F3,0x00F4,0x0121,0x00F6,0x00F7,
- 0x011D,0x00F9,0x00FA,0x00FB,0x00FC,0x016D,0x015D,0x02D9 } },
- // ...
- { RTL_TEXTENCODING_ISO_8859_6,
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,
- 0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,
- 0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,
- 0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F,
- 0x00A0,0xFFFF,0xFFFF,0xFFFF,0x00A4,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x060C,0x00AD,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0x061B,0xFFFF,0xFFFF,0xFFFF,0x061F,
- 0xFFFF,0x0621,0x0622,0x0623,0x0624,0x0625,0x0626,0x0627,
- 0x0628,0x0629,0x062A,0x062B,0x062C,0x062D,0x062E,0x062F,
- 0x0630,0x0631,0x0632,0x0633,0x0634,0x0635,0x0636,0x0637,
- 0x0638,0x0639,0x063A,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0x0640,0x0641,0x0642,0x0643,0x0644,0x0645,0x0646,0x0647,
- 0x0648,0x0649,0x064A,0x064B,0x064C,0x064D,0x064E,0x064F,
- 0x0650,0x0651,0x0652,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF } },
- // ...
- { RTL_TEXTENCODING_ISO_8859_8,
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,
- 0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,
- 0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,
- 0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F,
- 0x00A0,0xFFFF,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
- 0x00A8,0x00A9,0x00D7,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
- 0x00B8,0x00B9,0x00F7,0x00BB,0x00BC,0x00BD,0x00BE,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x2017,
- 0x05D0,0x05D1,0x05D2,0x05D3,0x05D4,0x05D5,0x05D6,0x05D7,
- 0x05D8,0x05D9,0x05DA,0x05DB,0x05DC,0x05DD,0x05DE,0x05DF,
- 0x05E0,0x05E1,0x05E2,0x05E3,0x05E4,0x05E5,0x05E6,0x05E7,
- 0x05E8,0x05E9,0x05EA,0xFFFF,0xFFFF,0x200E,0x200F,0xFFFF } },
- // ...
- { RTL_TEXTENCODING_TIS_620,
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,
- 0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,
- 0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,
- 0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F,
- 0x00A0,0x0E01,0x0E02,0x0E03,0x0E04,0x0E05,0x0E06,0x0E07, // !
- 0x0E08,0x0E09,0x0E0A,0x0E0B,0x0E0C,0x0E0D,0x0E0E,0x0E0F,
- 0x0E10,0x0E11,0x0E12,0x0E13,0x0E14,0x0E15,0x0E16,0x0E17,
- 0x0E18,0x0E19,0x0E1A,0x0E1B,0x0E1C,0x0E1D,0x0E1E,0x0E1F,
- 0x0E20,0x0E21,0x0E22,0x0E23,0x0E24,0x0E25,0x0E26,0x0E27,
- 0x0E28,0x0E29,0x0E2A,0x0E2B,0x0E2C,0x0E2D,0x0E2E,0x0E2F,
- 0x0E30,0x0E31,0x0E32,0x0E33,0x0E34,0x0E35,0x0E36,0x0E37,
- 0x0E38,0x0E39,0x0E3A,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x0E3F,
- 0x0E40,0x0E41,0x0E42,0x0E43,0x0E44,0x0E45,0x0E46,0x0E47,
- 0x0E48,0x0E49,0x0E4A,0x0E4B,0x0E4C,0x0E4D,0x0E4E,0x0E4F,
- 0x0E50,0x0E51,0x0E52,0x0E53,0x0E54,0x0E55,0x0E56,0x0E57,
- 0x0E58,0x0E59,0x0E5A,0x0E5B,0xFFFF,0xFFFF,0xFFFF,0xFFFF } },
- { RTL_TEXTENCODING_MS_874,
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x20AC,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x2026,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0x00A0,0x0E01,0x0E02,0x0E03,0x0E04,0x0E05,0x0E06,0x0E07,
- 0x0E08,0x0E09,0x0E0A,0x0E0B,0x0E0C,0x0E0D,0x0E0E,0x0E0F,
- 0x0E10,0x0E11,0x0E12,0x0E13,0x0E14,0x0E15,0x0E16,0x0E17,
- 0x0E18,0x0E19,0x0E1A,0x0E1B,0x0E1C,0x0E1D,0x0E1E,0x0E1F,
- 0x0E20,0x0E21,0x0E22,0x0E23,0x0E24,0x0E25,0x0E26,0x0E27,
- 0x0E28,0x0E29,0x0E2A,0x0E2B,0x0E2C,0x0E2D,0x0E2E,0x0E2F,
- 0x0E30,0x0E31,0x0E32,0x0E33,0x0E34,0x0E35,0x0E36,0x0E37,
- 0x0E38,0x0E39,0x0E3A,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x0E3F,
- 0x0E40,0x0E41,0x0E42,0x0E43,0x0E44,0x0E45,0x0E46,0x0E47,
- 0x0E48,0x0E49,0x0E4A,0x0E4B,0x0E4C,0x0E4D,0x0E4E,0x0E4F,
- 0x0E50,0x0E51,0x0E52,0x0E53,0x0E54,0x0E55,0x0E56,0x0E57,
- 0x0E58,0x0E59,0x0E5A,0x0E5B,0xFFFF,0xFFFF,0xFFFF,0xFFFF } },
- { RTL_TEXTENCODING_MS_1255,
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x20AC,0xFFFF,0x201A,0x0192,0x201E,0x2026,0x2020,0x2021,
- 0x02C6,0x2030,0xFFFF,0x2039,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
- 0x02DC,0x2122,0xFFFF,0x203A,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0x00A0,0x00A1,0x00A2,0x00A3,0x20AA,0x00A5,0x00A6,0x00A7,
- 0x00A8,0x00A9,0x00D7,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
- 0x00B8,0x00B9,0x00F7,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,
- 0x05B0,0x05B1,0x05B2,0x05B3,0x05B4,0x05B5,0x05B6,0x05B7,
- 0x05B8,0x05B9,0xFFFF,0x05BB,0x05BC,0x05BD,0x05BE,0x05BF,
- 0x05C0,0x05C1,0x05C2,0x05C3,0x05F0,0x05F1,0x05F2,0x05F3,
- 0x05F4,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0x05D0,0x05D1,0x05D2,0x05D3,0x05D4,0x05D5,0x05D6,0x05D7,
- 0x05D8,0x05D9,0x05DA,0x05DB,0x05DC,0x05DD,0x05DE,0x05DF,
- 0x05E0,0x05E1,0x05E2,0x05E3,0x05E4,0x05E5,0x05E6,0x05E7,
- 0x05E8,0x05E9,0x05EA,0xFFFF,0xFFFF,0x200E,0x200F,0xFFFF } },
- { RTL_TEXTENCODING_MS_1256,
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x20AC,0x067E,0x201A,0x0192,0x201E,0x2026,0x2020,0x2021,
- 0x02C6,0x2030,0x0679,0x2039,0x0152,0x0686,0x0698,0x0688,
- 0x06AF,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
- 0x06A9,0x2122,0x0691,0x203A,0x0153,0x200C,0x200D,0x06BA,
- 0x00A0,0x060C,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
- 0x00A8,0x00A9,0x06BE,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
- 0x00B8,0x00B9,0x061B,0x00BB,0x00BC,0x00BD,0x00BE,0x061F,
- 0x06C1,0x0621,0x0622,0x0623,0x0624,0x0625,0x0626,0x0627,
- 0x0628,0x0629,0x062A,0x062B,0x062C,0x062D,0x062E,0x062F,
- 0x0630,0x0631,0x0632,0x0633,0x0634,0x0635,0x0636,0x00D7,
- 0x0637,0x0638,0x0639,0x063A,0x0640,0x0641,0x0642,0x0643,
- 0x00E0,0x0644,0x00E2,0x0645,0x0646,0x0647,0x0648,0x00E7,
- 0x00E8,0x00E9,0x00EA,0x00EB,0x0649,0x064A,0x00EE,0x00EF,
- 0x064B,0x064C,0x064D,0x064E,0x00F4,0x064F,0x0650,0x00F7,
- 0x0651,0x00F9,0x0652,0x00FB,0x00FC,0x200E,0x200F,0x06D2 } },
- { RTL_TEXTENCODING_MS_1257,
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x20AC,0xFFFF,0x201A,0xFFFF,0x201E,0x2026,0x2020,0x2021,
- 0xFFFF,0x2030,0xFFFF,0x2039,0xFFFF,0x00A8,0x02C7,0x00B8,
- 0xFFFF,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
- 0xFFFF,0x2122,0xFFFF,0x203A,0xFFFF,0x00AF,0x02DB,0xFFFF,
- 0x00A0,0xFFFF,0x00A2,0x00A3,0x00A4,0xFFFF,0x00A6,0x00A7,
- 0x00D8,0x00A9,0x0156,0x00AB,0x00AC,0x00AD,0x00AE,0x00C6,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
- 0x00F8,0x00B9,0x0157,0x00BB,0x00BC,0x00BD,0x00BE,0x00E6,
- 0x0104,0x012E,0x0100,0x0106,0x00C4,0x00C5,0x0118,0x0112,
- 0x010C,0x00C9,0x0179,0x0116,0x0122,0x0136,0x012A,0x013B,
- 0x0160,0x0143,0x0145,0x00D3,0x014C,0x00D5,0x00D6,0x00D7,
- 0x0172,0x0141,0x015A,0x016A,0x00DC,0x017B,0x017D,0x00DF,
- 0x0105,0x012F,0x0101,0x0107,0x00E4,0x00E5,0x0119,0x0113,
- 0x010D,0x00E9,0x017A,0x0117,0x0123,0x0137,0x012B,0x013C,
- 0x0161,0x0144,0x0146,0x00F3,0x014D,0x00F5,0x00F6,0x00F7,
- 0x0173,0x0142,0x015B,0x016B,0x00FC,0x017C,0x017E,0x02D9 } },
- { RTL_TEXTENCODING_MS_1258,
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x20AC,0xFFFF,0x201A,0x0192,0x201E,0x2026,0x2020,0x2021,
- 0x02C6,0x2030,0xFFFF,0x2039,0x0152,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
- 0x02DC,0x2122,0xFFFF,0x203A,0x0153,0xFFFF,0xFFFF,0x0178,
- 0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
- 0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
- 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
- 0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,
- 0x00C0,0x00C1,0x00C2,0x0102,0x00C4,0x00C5,0x00C6,0x00C7,
- 0x00C8,0x00C9,0x00CA,0x00CB,0x0300,0x00CD,0x00CE,0x00CF,
- 0x0110,0x00D1,0x0309,0x00D3,0x00D4,0x01A0,0x00D6,0x00D7,
- 0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x01AF,0x0303,0x00DF,
- 0x00E0,0x00E1,0x00E2,0x0103,0x00E4,0x00E5,0x00E6,0x00E7,
- 0x00E8,0x00E9,0x00EA,0x00EB,0x0301,0x00ED,0x00EE,0x00EF,
- 0x0111,0x00F1,0x0323,0x00F3,0x00F4,0x01A1,0x00F6,0x00F7,
- 0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x01B0,0x20AB,0x00FF } },
- { RTL_TEXTENCODING_KOI8_U, // RFC 2319
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x2500,0x2502,0x250C,0x2510,0x2514,0x2518,0x251C,0x2524,
- 0x252C,0x2534,0x253C,0x2580,0x2584,0x2588,0x258C,0x2590,
- 0x2591,0x2592,0x2593,0x2320,0x25A0,0x2219,0x221A,0x2248,
- 0x2264,0x2265,0x00A0,0x2321,0x00B0,0x00B2,0x00B7,0x00F7,
- 0x2550,0x2551,0x2552,0x0451,0x0454,0x2554,0x0456,0x0457,
- 0x2557,0x2558,0x2559,0x255A,0x255B,0x0491,0x255D,0x255E,
- 0x255F,0x2560,0x2561,0x0401,0x0404,0x2563,0x0406,0x0407,
- 0x2566,0x2567,0x2568,0x2569,0x256A,0x0490,0x256C,0x00A9,
- 0x044E,0x0430,0x0431,0x0446,0x0434,0x0435,0x0444,0x0433,
- 0x0445,0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,
- 0x043F,0x044F,0x0440,0x0441,0x0442,0x0443,0x0436,0x0432,
- 0x044C,0x044B,0x0437,0x0448,0x044D,0x0449,0x0447,0x044A,
- 0x042E,0x0410,0x0411,0x0426,0x0414,0x0415,0x0424,0x0413,
- 0x0425,0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,
- 0x041F,0x042F,0x0420,0x0421,0x0422,0x0423,0x0416,0x0412,
- 0x042C,0x042B,0x0417,0x0428,0x042D,0x0429,0x0427,0x042A } },
- { RTL_TEXTENCODING_ISCII_DEVANAGARI,
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0x0901,0x0902,0x0903,0x0905,0x0906,0x0907,0x0908,
- 0x0909,0x090A,0x090B,0x090E,0x090F,0x0910,0x090D,0x0912,
- 0x0913,0x0914,0x0911,0x0915,0x0916,0x0917,0x0918,0x0919,
- 0x091A,0x091B,0x091C,0x091D,0x091E,0x091F,0x0920,0x0921,
- 0x0922,0x0923,0x0924,0x0925,0x0926,0x0927,0x0928,0x0929,
- 0x092A,0x092B,0x092C,0x092D,0x092E,0x092F,0x095F,0x0930,
- 0x0931,0x0932,0x0933,0x0934,0x0935,0x0936,0x0937,0x0938,
- 0x0939,0xFFFF,0x093E,0x093F,0x0940,0x0941,0x0942,0x0943,
- 0x0946,0x0947,0x0948,0x0945,0x094A,0x094B,0x094C,0x0949,
- 0x094D,0x093C,0x0964,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0x0966,0x0967,0x0968,0x0969,0x096A,0x096B,0x096C,
- 0x096D,0x096E,0x096F,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF } },
- { RTL_TEXTENCODING_ADOBE_STANDARD,
- { 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x2019,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x2018,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0x00A1,0x00A2,0x00A3,0x2215,0x00A5,0x0192,0x00A7,
- 0x00A4,0x0027,0x201C,0x00AB,0x2039,0x203A,0xFB01,0xFB02,
- 0xFFFF,0x2013,0x2020,0x2021,0x00B7,0xFFFF,0x00B6,0x2022,
- 0x201A,0x201E,0x201D,0x00BB,0x2026,0x2030,0xFFFF,0x00BF,
- 0xFFFF,0x0060,0x00B4,0x02C6,0x02DC,0x00AF,0x02D8,0x02D9,
- 0x00A8,0xFFFF,0x02DA,0x00B8,0xFFFF,0x02DD,0x02DB,0x02C7,
- 0x2014,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0x00C6,0xFFFF,0x00AA,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0x0141,0x00D8,0x0152,0x00BA,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0x00E6,0xFFFF,0xFFFF,0xFFFF,0x0131,0xFFFF,0xFFFF,
- 0x0142,0x00F8,0x0153,0x00DF,0xFFFF,0xFFFF,0xFFFF,0xFFFF } },
- { RTL_TEXTENCODING_ADOBE_SYMBOL,
- { 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0x0020,0x0021,0x2200,0x0023,0x2203,0x0025,0x0026,0x220B,
- 0x0028,0x0029,0x2217,0x002B,0x002C,0x2212,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x2245,0x0391,0x0392,0x03A7,0x0394,0x0395,0x03A6,0x0393,
- 0x0397,0x0399,0x03D1,0x039A,0x039B,0x039C,0x039D,0x039F,
- 0x03A0,0x0398,0x03A1,0x03A3,0x03A4,0x03A5,0x03C2,0x03A9,
- 0x039E,0x03A8,0x0396,0x005B,0x2234,0x005D,0x22A5,0x005F,
- 0xF8E5,0x03B1,0x03B2,0x03C7,0x03B4,0x03B5,0x03C6,0x03B3,
- 0x03B7,0x03B9,0x03D5,0x03BA,0x03BB,0x03BC,0x03BD,0x03BF,
- 0x03C0,0x03B8,0x03C1,0x03C3,0x03C4,0x03C5,0x03D6,0x03C9,
- 0x03BE,0x03C8,0x03B6,0x007B,0x007C,0x007D,0x223C,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0x20AC,0x03D2,0x2032,0x2264,0x2215,0x221E,0x0192,0x2663,
- 0x2666,0x2665,0x2660,0x2194,0x2190,0x2191,0x2192,0x2193,
- 0x00B0,0x00B1,0x2033,0x2265,0x00D7,0x221D,0x2202,0x2022,
- 0x00F7,0x2260,0x2261,0x2248,0x2026,0x23AF,0x23D0,0x21B5,
- 0x2135,0x2111,0x211C,0x2118,0x2297,0x2295,0x2205,0x2229,
- 0x222A,0x2283,0x2287,0x2284,0x2282,0x2286,0x2208,0x2209,
- 0x2220,0x2207,0xF6DA,0xF6D9,0xF6DB,0x220F,0x221A,0x22C5,
- 0x00AC,0x2227,0x2228,0x21D4,0x21D0,0x21D1,0x21D2,0x21D3,
- 0x25CA,0x2329,0xF8E8,0xF8E9,0xF8EA,0x2211,0x239B,0x239C,
- 0x239D,0x23A1,0x23A2,0x23A3,0x23A7,0x23A8,0x23A9,0x23AA,
- 0xFFFF,0x232A,0x222B,0x2320,0x23AE,0x2321,0x239E,0x239F,
- 0x23A0,0x23A4,0x23A5,0x23A6,0x23AB,0x23AC,0x23AD,0xFFFF } },
- { RTL_TEXTENCODING_ADOBE_DINGBATS,
- { 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
-// 20
- 0x0020,0x2701,0x2702,0x2703,0x2704,0x260E,0x2706,0x2707,
- 0x2708,0x2709,0x261B,0x261E,0x270C,0x270D,0x270E,0x270F,
- 0x2710,0x2711,0x2712,0x2713,0x2714,0x2715,0x2716,0x2717,
- 0x2718,0x2719,0x271A,0x271B,0x271C,0x271D,0x271E,0x271F,
-// 40
- 0x2720,0x2721,0x2722,0x2723,0x2724,0x2725,0x2726,0x2727,
- 0x2605,0x2729,0x272A,0x272B,0x272C,0x272D,0x272E,0x272F,
- 0x2730,0x2731,0x2732,0x2733,0x2734,0x2735,0x2736,0x2737,
- 0x2738,0x2739,0x273A,0x273B,0x273C,0x273D,0x273E,0x273F,
-// 60
- 0x2740,0x2741,0x2742,0x2743,0x2744,0x2745,0x2746,0x2747,
- 0x2748,0x2749,0x274A,0x274B,0x27CF,0x274D,0x25A0,0x274F,
- 0x2750,0x2751,0x2752,0x25B2,0x25BC,0x25C6,0x2756,0x25D7,
- 0x2758,0x2759,0x275A,0x275B,0x275C,0x275D,0x275E,0xFFFF,
-// 80
- 0xF8D7,0xF8D8,0xF8D9,0xF8DA,0xF8DB,0xF8DC,0xF8DD,0xF8DE,
- 0xF8DF,0xF8E0,0xF8E1,0xF8E2,0xF8E3,0xF8E4,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
- 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
-// A0
- 0xFFFF,0x2761,0x2762,0x2763,0x2764,0x2765,0x2766,0x2767,
- 0x2663,0x2666,0x2665,0x2660,0x2460,0x2461,0x2462,0x2463,
- 0x2464,0x2465,0x2466,0x2467,0x2468,0x2469,0x2776,0x2777,
- 0x2778,0x2779,0x277A,0x277B,0x277C,0x277D,0x277E,0x277F,
-// C0
- 0x2780,0x2781,0x2782,0x2783,0x2784,0x2785,0x2786,0x2787,
- 0x2788,0x2789,0x278A,0x278B,0x278C,0x278D,0x278E,0x278F,
- 0x2790,0x2791,0x2792,0x2793,0x2794,0x2795,0x2796,0x2797,
- 0x2798,0x2799,0x279A,0x279B,0x279C,0x279D,0x279E,0x279F,
-// E0
- 0x27A0,0x27A1,0x27A2,0x27A3,0x27A4,0x27A5,0x27A6,0x27A7,
- 0x27A8,0x27A9,0x27AA,0x27AB,0x27AC,0x27AD,0x27AE,0x27AF,
- 0xFFFF,0x27B1,0x27B2,0x27B3,0x27B4,0x27B5,0x27B6,0x27B7,
- 0x27B8,0x27B9,0x27BA,0x27BB,0x27BC,0x27BD,0x27BE,0xFFFF } },
- { RTL_TEXTENCODING_PT154,
- { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
- 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
- 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
- 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
- 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
- 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
- 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
- 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
- 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
- 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
- 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
- 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
- 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
- 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
- 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
- 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
- 0x0496,0x0492,0x04EE,0x0493,0x201E,0x2026,0x04B6,0x04AE,
- 0x04B2,0x04AF,0x04A0,0x04E2,0x04A2,0x049A,0x04BA,0x04B8,
- 0x0497,0x2018,0x2019,0x201C,0x201D,0x2022,0x2013,0x2014,
- 0x04B3,0x04B7,0x04A1,0x04E3,0x04A3,0x049B,0x04BB,0x04B9,
- 0x00A0,0x040E,0x045E,0x0408,0x04E8,0x0498,0x04B0,0x00A7,
- 0x0401,0x00A9,0x04D8,0x00AB,0x00AC,0x04EF,0x00AE,0x049C,
- 0x00B0,0x04B1,0x0406,0x0456,0x0499,0x04E9,0x00B6,0x00B7,
- 0x0451,0x2116,0x04D9,0x00BB,0x0458,0x04AA,0x04AB,0x049D,
- 0x0410,0x0411,0x0412,0x0413,0x0414,0x0415,0x0416,0x0417,
- 0x0418,0x0419,0x041A,0x041B,0x041C,0x041D,0x041E,0x041F,
- 0x0420,0x0421,0x0422,0x0423,0x0424,0x0425,0x0426,0x0427,
- 0x0428,0x0429,0x042A,0x042B,0x042C,0x042D,0x042E,0x042F,
- 0x0430,0x0431,0x0432,0x0433,0x0434,0x0435,0x0436,0x0437,
- 0x0438,0x0439,0x043A,0x043B,0x043C,0x043D,0x043E,0x043F,
- 0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0446,0x0447,
- 0x0448,0x0449,0x044A,0x044B,0x044C,0x044D,0x044E,0x044F } } };
- for (std::size_t i = 0; i < SAL_N_ELEMENTS(data); ++i) {
- testSingleByteCharSet(data[i]);
- }
-}
-
-void Test::testComplex() {
- static ComplexCharSetTest const data[]
- = { { RTL_TEXTENCODING_ASCII_US,
- RTL_CONSTASCII_STRINGPARAM("\x01\"3De$~"),
- { 0x0001,0x0022,0x0033,0x0044,0x0065,0x0024,0x007E },
- 7,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_EUC_CN,
- RTL_CONSTASCII_STRINGPARAM("\x01\"3De$~\xA1\xB9\xF0\xC5"),
- { 0x0001,0x0022,0x0033,0x0044,0x0065,0x0024,0x007E,
- 0x300D,0x9E4B },
- 9,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_EUC_TW,
- RTL_CONSTASCII_STRINGPARAM(
- "\x01\"3De$~\xC5\xF0\x8E\xA4\xDC\xD9"),
- { 0x0001,0x0022,0x0033,0x0044,0x0065,0x0024,0x007E,
- 0x4ED9,0xD87E,0xDD68 },
- 10,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_GB_18030,
- RTL_CONSTASCII_STRINGPARAM("\x01\"3De$~"),
- { 0x0001,0x0022,0x0033,0x0044,0x0065,0x0024,0x007E },
- 7,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_GB_18030,
- RTL_CONSTASCII_STRINGPARAM("\x81\x40\xFE\xFE"),
- { 0x4E02,0xE4C5 },
- 2,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_GB_18030,
- RTL_CONSTASCII_STRINGPARAM(
- "\x81\x30\xB1\x33\x81\x30\xD3\x30\x81\x36\xA5\x31"),
- { 0x028A,0x0452,0x200F },
- 3,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_GB_18030,
- RTL_CONSTASCII_STRINGPARAM(
- "\xFE\x50\xFE\x51\xFE\x52\xFE\x53\xFE\x54\xFE\x55\xFE\x56"
- "\xFE\x57\xFE\x58\xFE\x59\xFE\x5A\xFE\x5B\xFE\x5C\xFE\x5D"
- "\xFE\x5E\xFE\x5F\xFE\x60\xFE\x61\xFE\x62\xFE\x63\xFE\x64"
- "\xFE\x65\xFE\x66\xFE\x67\xFE\x68\xFE\x69\xFE\x6A\xFE\x6B"
- "\xFE\x6C\xFE\x6D\xFE\x6E\xFE\x6F\xFE\x70\xFE\x71\xFE\x72"
- "\xFE\x73\xFE\x74\xFE\x75\xFE\x76\xFE\x77\xFE\x78\xFE\x79"
- "\xFE\x7A\xFE\x7B\xFE\x7C\xFE\x7D\xFE\x7E\xFE\x80\xFE\x81"
- "\xFE\x82\xFE\x83\xFE\x84\xFE\x85\xFE\x86\xFE\x87\xFE\x88"
- "\xFE\x89\xFE\x8A\xFE\x8B\xFE\x8C\xFE\x8D\xFE\x8E\xFE\x8F"
- "\xFE\x90\xFE\x91\xFE\x92\xFE\x93\xFE\x94\xFE\x95\xFE\x96"
- "\xFE\x97\xFE\x98\xFE\x99\xFE\x9A\xFE\x9B\xFE\x9C\xFE\x9D"
- "\xFE\x9E\xFE\x9F\xFE\xA0"),
- { 0x2E81,0xE816,0xE817,0xE818,0x2E84,0x3473,0x3447,0x2E88,
- 0x2E8B,0xE81E,0x359E,0x361A,0x360E,0x2E8C,0x2E97,0x396E,
- 0x3918,0xE826,0x39CF,0x39DF,0x3A73,0x39D0,0xE82B,0xE82C,
- 0x3B4E,0x3C6E,0x3CE0,0x2EA7,0xE831,0xE832,0x2EAA,0x4056,
- 0x415F,0x2EAE,0x4337,0x2EB3,0x2EB6,0x2EB7,0xE83B,0x43B1,
- 0x43AC,0x2EBB,0x43DD,0x44D6,0x4661,0x464C,0xE843,0x4723,
- 0x4729,0x477C,0x478D,0x2ECA,0x4947,0x497A,0x497D,0x4982,
- 0x4983,0x4985,0x4986,0x499F,0x499B,0x49B7,0x49B6,0xE854,
- 0xE855,0x4CA3,0x4C9F,0x4CA0,0x4CA1,0x4C77,0x4CA2,0x4D13,
- 0x4D14,0x4D15,0x4D16,0x4D17,0x4D18,0x4D19,0x4DAE,0xE864 },
- 80,
- true,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ISO_2022_JP,
- RTL_CONSTASCII_STRINGPARAM("\x01\"3De$\\~"),
- { 0x0001,0x0022,0x0033,0x0044,0x0065,0x0024,0x005C,0x007E },
- 8,
- false,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ISO_2022_JP,
- RTL_CONSTASCII_STRINGPARAM("\x1B(B\x01\"3De$\\~"),
- { 0x0001,0x0022,0x0033,0x0044,0x0065,0x0024,0x005C,0x007E },
- 8,
- false,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ISO_2022_JP,
- RTL_CONSTASCII_STRINGPARAM("\x1B(J\x01\"3De$\\~"),
- { 0x0001,0x0022,0x0033,0x0044,0x0065,0x0024,0x00A5,0x00AF },
- 8,
- false,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ISO_2022_JP,
- RTL_CONSTASCII_STRINGPARAM("\x1B$B\x26\x21\x27\x71\x1B(B"),
- { 0x0391,0x044F },
- 2,
- false,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ISO_2022_KR,
- RTL_CONSTASCII_STRINGPARAM("\x1B$)C\x01\"3De$\\~"),
- { 0x0001,0x0022,0x0033,0x0044,0x0065,0x0024,0x005C,0x007E },
- 8,
- false,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ISO_2022_KR,
- RTL_CONSTASCII_STRINGPARAM(
- "\x1B$)C\x0E\x25\x21\x0F\x0D\x0Ax\x0E\x48\x7E\x0F"),
- { 0x2170,0x000D,0x000A,0x0078,0xD79D },
- 5,
- false,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ISO_2022_CN,
- RTL_CONSTASCII_STRINGPARAM(
- "\x01\"3De$\\~\x1B$)G\x0E\x45\x70\x1B$*H\x1BN\x22\x22"
- "\x45\x70\x0F\x1B$)A\x0E\x26\x21\x0F"),
- { 0x0001,0x0022,0x0033,0x0044,0x0065,0x0024,0x005C,0x007E,
- 0x4ED9,0x531F,0x4ED9,0x0391 },
- 12,
- false,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ISO_2022_CN,
- RTL_CONSTASCII_STRINGPARAM(
- "\x01\"3De$\\~\x1B$)A\x0E\x26\x21\x1B$*H\x1BN\x22\x22"
- "\x26\x21\x0F\x0D\x0A\x1B$)A\x0E\x26\x21\x0F"),
- { 0x0001,0x0022,0x0033,0x0044,0x0065,0x0024,0x005C,0x007E,
- 0x0391,0x531F,0x0391,0x000D,0x000A,0x0391 },
- 14,
- false,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- // The following does not work as long as Big5-HKSCS maps to
- // Unicode PUA instead of Plane 2. Use the next two tests
- // instead:
-// { RTL_TEXTENCODING_BIG5_HKSCS,
-// RTL_CONSTASCII_STRINGPARAM(
-// "\x01\"3De$~\x88\x56\xF9\xFE\xFA\x5E\xA1\x40\xF9\xD5"),
-// { 0x0001,0x0022,0x0033,0x0044,0x0065,0x0024,0x007E,0x0100,
-// 0xFFED,0xD849,0xDD13,0x3000,0x9F98 },
-// 13,
-// true,
-// true,
-// true,
-// false,
-// RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_BIG5_HKSCS,
- RTL_CONSTASCII_STRINGPARAM(
- "\x01\"3De$~\x88\x56\xF9\xFE\xFA\x5E\xA1\x40\xF9\xD5"),
- { 0x0001,0x0022,0x0033,0x0044,0x0065,0x0024,0x007E,0x0100,
- 0xFFED,0xE01E,0x3000,0x9F98 },
- 12,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_BIG5_HKSCS,
- RTL_CONSTASCII_STRINGPARAM(
- "\x01\"3De$~\x88\x56\xF9\xFE\xFA\x5E\xA1\x40\xF9\xD5"),
- { 0x0001,0x0022,0x0033,0x0044,0x0065,0x0024,0x007E,0x0100,
- 0xFFED,0xD849,0xDD13,0x3000,0x9F98 },
- 13,
- true,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_BIG5_HKSCS,
- RTL_CONSTASCII_STRINGPARAM(
- "\xC6\xA1\xC6\xCF\xC6\xD3\xC6\xD5\xC6\xD7\xC6\xDE\xC6\xDF"
- "\xC6\xFE\xC7\x40\xC7\x7E\xC7\xA1\xC7\xFE"),
- { 0x2460,0xF6E0,0xF6E4,0xF6E6,0xF6E8,0xF6EF,0xF6F0,0x3058,
- 0x3059,0x30A4,0x30A5,0x041A },
- 12,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_BIG5_HKSCS,
- RTL_CONSTASCII_STRINGPARAM("\x81\x40\x84\xFE"),
- { 0xEEB8,0xF12B },
- 2,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_BIG5_HKSCS,
- RTL_CONSTASCII_STRINGPARAM(
- "\x81\x40\x8D\xFE\x8E\x40\xA0\xFE\xC6\xA1\xC8\xFE\xFA\x40"
- "\xFE\xFE"),
- { 0xEEB8,0xF6B0,0xE311,0xEEB7,0xF6B1,0xF848,0xE000,0xE310 },
- 8,
- true,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_BIG5_HKSCS,
- RTL_CONSTASCII_STRINGPARAM("\xAD\xC5\x94\x55"),
- { 0x5029,0x7250 },
- 2,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_BIG5_HKSCS,
- RTL_CONSTASCII_STRINGPARAM("\xFA\x5F\xA0\xE4"),
- { 0x5029,0x7250 },
- 2,
- true,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_BIG5_HKSCS,
- RTL_CONSTASCII_STRINGPARAM("\xA0\x40\xA0\x7E\xA0\xA1\xA0\xFE"),
- { 0xEE1B,0xEE59,0xEE5A,0xEEB7 },
- 4,
- true,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_BIG5,
- RTL_CONSTASCII_STRINGPARAM("\xA1\x45"),
- { 0x2027 },
- 1,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_BIG5,
- RTL_CONSTASCII_STRINGPARAM(
- "\xC6\xCF\xC6\xD3\xC6\xD5\xC6\xD7\xC6\xDE\xC6\xDF"),
- { 0x306B,0x306F,0x3071,0x3073,0x307A,0x307B },
- 6,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_BIG5,
- RTL_CONSTASCII_STRINGPARAM(
- "\xC7\xFD\xC7\xFE\xC8\x40\xC8\x7E\xC8\xA1\xC8\xFE"),
- { 0xF7AA,0xF7AB,0xF7AC,0xF7EA,0xF7EB,0xF848 },
- 6,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_BIG5,
- RTL_CONSTASCII_STRINGPARAM("\xA0\x40\xA0\x7E\xA0\xA1\xA0\xFE"),
- { 0xEE1B,0xEE59,0xEE5A,0xEEB7 },
- 4,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_MS_950,
- RTL_CONSTASCII_STRINGPARAM(
- "\xC6\xA1\xC6\xFE\xC7\x40\xC7\x7E\xC7\xA1\xC7\xFE\xC8\x40"
- "\xC8\x7E\xC8\xA1\xC8\xFE"),
- { 0xF6B1,0xF70E,0xF70F,0xF74D,0xF74E,0xF7AB,0xF7AC,0xF7EA,
- 0xF7EB,0xF848 },
- 10,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_MS_950,
- RTL_CONSTASCII_STRINGPARAM("\xA0\x40\xA0\x7E\xA0\xA1\xA0\xFE"),
- { 0xEE1B,0xEE59,0xEE5A,0xEEB7 },
- 4,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
-
- // Test Unicode beyond BMP:
-
- // FIXME The second m_bForward test (requiring a context) does not
- // work for UTF7:
-// { RTL_TEXTENCODING_UTF7,
-// RTL_CONSTASCII_STRINGPARAM("+2EndEw-"),
-// { 0xD849,0xDD13 },
-// 2,
-// true,
-// true,
-// true,
-// false,
-// RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_UTF8,
- RTL_CONSTASCII_STRINGPARAM("\xF0\xA2\x94\x93"),
- { 0xD849,0xDD13 },
- 2,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_GB_18030,
- RTL_CONSTASCII_STRINGPARAM("\x95\x39\xC5\x37"),
- { 0xD849,0xDD13 },
- 2,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_BIG5_HKSCS,
- RTL_CONSTASCII_STRINGPARAM("\xFA\x5E"),
- { 0xD849,0xDD13 },
- 2,
- true,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
-
- // Test GBK (aka CP936):
-
- { RTL_TEXTENCODING_GBK,
- RTL_CONSTASCII_STRINGPARAM("\xFD\x7C\xC1\xFA\xFD\x9B"),
- { 0x9F76,0x9F99,0x9FA5 },
- 3,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_MS_936,
- RTL_CONSTASCII_STRINGPARAM("\xFD\x7C\xC1\xFA\xFD\x9B"),
- { 0x9F76,0x9F99,0x9FA5 },
- 3,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_GBK,
- RTL_CONSTASCII_STRINGPARAM(
- "\xFE\x50\xFE\x54\xFE\x55\xFE\x56"
- "\xFE\x57\xFE\x58\xFE\x5A\xFE\x5B\xFE\x5C\xFE\x5D"
- "\xFE\x5E\xFE\x5F\xFE\x60\xFE\x62\xFE\x63\xFE\x64"
- "\xFE\x65\xFE\x68\xFE\x69\xFE\x6A\xFE\x6B"
- "\xFE\x6E\xFE\x6F\xFE\x70\xFE\x71\xFE\x72"
- "\xFE\x73\xFE\x74\xFE\x75\xFE\x77\xFE\x78\xFE\x79"
- "\xFE\x7A\xFE\x7B\xFE\x7C\xFE\x7D\xFE\x80\xFE\x81"
- "\xFE\x82\xFE\x83\xFE\x84\xFE\x85\xFE\x86\xFE\x87\xFE\x88"
- "\xFE\x89\xFE\x8A\xFE\x8B\xFE\x8C\xFE\x8D\xFE\x8E\xFE\x8F"
- "\xFE\x92\xFE\x93\xFE\x94\xFE\x95\xFE\x96"
- "\xFE\x97\xFE\x98\xFE\x99\xFE\x9A\xFE\x9B\xFE\x9C\xFE\x9D"
- "\xFE\x9E\xFE\x9F"),
- { 0x2E81,0x2E84,0x3473,0x3447,0x2E88,0x2E8B,0x359E,0x361A,
- 0x360E,0x2E8C,0x2E97,0x396E,0x3918,0x39CF,0x39DF,0x3A73,
- 0x39D0,0x3B4E,0x3C6E,0x3CE0,0x2EA7,0x2EAA,0x4056,0x415F,
- 0x2EAE,0x4337,0x2EB3,0x2EB6,0x2EB7,0x43B1,0x43AC,0x2EBB,
- 0x43DD,0x44D6,0x4661,0x464C,0x4723,0x4729,0x477C,0x478D,
- 0x2ECA,0x4947,0x497A,0x497D,0x4982,0x4983,0x4985,0x4986,
- 0x499F,0x499B,0x49B7,0x49B6,0x4CA3,0x4C9F,0x4CA0,0x4CA1,
- 0x4C77,0x4CA2,0x4D13,0x4D14,0x4D15,0x4D16,0x4D17,0x4D18,
- 0x4D19,0x4DAE },
- 66,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_EUC_JP,
- RTL_CONSTASCII_STRINGPARAM("?"),
- { 0xFF0D },
- 1,
- true,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_QUESTIONMARK },
-
- // Test of "JIS X 0208 row 13" (taken from CP932; added to
- // ISO-2022-JP and EUC-JP; 74 of the 83 characters introduce
- // mappings to new Unicode characters):
- { RTL_TEXTENCODING_MS_932,
- RTL_CONSTASCII_STRINGPARAM(
- "\x87\x40\x87\x41\x87\x42\x87\x43\x87\x44\x87\x45\x87\x46"
- "\x87\x47\x87\x48\x87\x49\x87\x4A\x87\x4B\x87\x4C\x87\x4D"
- "\x87\x4E\x87\x4F\x87\x50\x87\x51\x87\x52\x87\x53\x87\x54"
- "\x87\x55\x87\x56\x87\x57\x87\x58\x87\x59\x87\x5A\x87\x5B"
- "\x87\x5C\x87\x5D\x87\x5F\x87\x60\x87\x61\x87\x62\x87\x63"
- "\x87\x64\x87\x65\x87\x66\x87\x67\x87\x68\x87\x69\x87\x6A"
- "\x87\x6B\x87\x6C\x87\x6D\x87\x6E\x87\x6F\x87\x70\x87\x71"
- "\x87\x72\x87\x73\x87\x74\x87\x75\x87\x7E\x87\x80\x87\x81"
- "\x87\x82\x87\x83\x87\x84\x87\x85\x87\x86\x87\x87\x87\x88"
- "\x87\x89\x87\x8A\x87\x8B\x87\x8C\x87\x8D\x87\x8E\x87\x8F"
- "\x87\x90\x87\x91\x87\x92\x87\x93\x87\x94\x87\x95\x87\x96"
- "\x87\x97\x87\x98\x87\x99\x87\x9A\x87\x9B\x87\x9C"),
- { 0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467,0x2468,
- 0x2469,0x246A,0x246B,0x246C,0x246D,0x246E,0x246F,0x2470,0x2471,
- 0x2472,0x2473,0x2160,0x2161,0x2162,0x2163,0x2164,0x2165,0x2166,
- 0x2167,0x2168,0x2169,0x3349,0x3314,0x3322,0x334D,0x3318,0x3327,
- 0x3303,0x3336,0x3351,0x3357,0x330D,0x3326,0x3323,0x332B,0x334A,
- 0x333B,0x339C,0x339D,0x339E,0x338E,0x338F,0x33C4,0x33A1,0x337B,
- 0x301D,0x301F,0x2116,0x33CD,0x2121,0x32A4,0x32A5,0x32A6,0x32A7,
- 0x32A8,0x3231,0x3232,0x3239,0x337E,0x337D,0x337C,0x2252,0x2261,
- 0x222B,0x222E,0x2211,0x221A,0x22A5,0x2220,0x221F,0x22BF,0x2235,
- 0x2229,0x222A },
- 83,
- true,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_SHIFT_JIS,
- RTL_CONSTASCII_STRINGPARAM(
- "\x87\x40\x87\x41\x87\x42\x87\x43\x87\x44\x87\x45\x87\x46"
- "\x87\x47\x87\x48\x87\x49\x87\x4A\x87\x4B\x87\x4C\x87\x4D"
- "\x87\x4E\x87\x4F\x87\x50\x87\x51\x87\x52\x87\x53\x87\x54"
- "\x87\x55\x87\x56\x87\x57\x87\x58\x87\x59\x87\x5A\x87\x5B"
- "\x87\x5C\x87\x5D\x87\x5F\x87\x60\x87\x61\x87\x62\x87\x63"
- "\x87\x64\x87\x65\x87\x66\x87\x67\x87\x68\x87\x69\x87\x6A"
- "\x87\x6B\x87\x6C\x87\x6D\x87\x6E\x87\x6F\x87\x70\x87\x71"
- "\x87\x72\x87\x73\x87\x74\x87\x75\x87\x7E\x87\x80\x87\x81"
- "\x87\x82\x87\x83\x87\x84\x87\x85\x87\x86\x87\x87\x87\x88"
- "\x87\x89\x87\x8A\x87\x8B\x87\x8C\x87\x8D\x87\x8E\x87\x8F"
- "\x87\x90\x87\x91\x87\x92\x87\x93\x87\x94\x87\x95\x87\x96"
- "\x87\x97\x87\x98\x87\x99\x87\x9A\x87\x9B\x87\x9C"),
- { 0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467,0x2468,
- 0x2469,0x246A,0x246B,0x246C,0x246D,0x246E,0x246F,0x2470,0x2471,
- 0x2472,0x2473,0x2160,0x2161,0x2162,0x2163,0x2164,0x2165,0x2166,
- 0x2167,0x2168,0x2169,0x3349,0x3314,0x3322,0x334D,0x3318,0x3327,
- 0x3303,0x3336,0x3351,0x3357,0x330D,0x3326,0x3323,0x332B,0x334A,
- 0x333B,0x339C,0x339D,0x339E,0x338E,0x338F,0x33C4,0x33A1,0x337B,
- 0x301D,0x301F,0x2116,0x33CD,0x2121,0x32A4,0x32A5,0x32A6,0x32A7,
- 0x32A8,0x3231,0x3232,0x3239,0x337E,0x337D,0x337C,0x2252,0x2261,
- 0x222B,0x222E,0x2211,0x221A,0x22A5,0x2220,0x221F,0x22BF,0x2235,
- 0x2229,0x222A },
- 83,
- true,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ISO_2022_JP,
- RTL_CONSTASCII_STRINGPARAM(
- "\x1B$B\x2D\x21\x2D\x22\x2D\x23\x2D\x24\x2D\x25\x2D\x26"
- "\x2D\x27\x2D\x28\x2D\x29\x2D\x2A\x2D\x2B\x2D\x2C\x2D\x2D"
- "\x2D\x2E\x2D\x2F\x2D\x30\x2D\x31\x2D\x32\x2D\x33\x2D\x34"
- "\x2D\x35\x2D\x36\x2D\x37\x2D\x38\x2D\x39\x2D\x3A\x2D\x3B"
- "\x2D\x3C\x2D\x3D\x2D\x3E\x2D\x40\x2D\x41\x2D\x42\x2D\x43"
- "\x2D\x44\x2D\x45\x2D\x46\x2D\x47\x2D\x48\x2D\x49\x2D\x4A"
- "\x2D\x4B\x2D\x4C\x2D\x4D\x2D\x4E\x2D\x4F\x2D\x50\x2D\x51"
- "\x2D\x52\x2D\x53\x2D\x54\x2D\x55\x2D\x56\x2D\x5F\x2D\x60"
- "\x2D\x61\x2D\x62\x2D\x63\x2D\x64\x2D\x65\x2D\x66\x2D\x67"
- "\x2D\x68\x2D\x69\x2D\x6A\x2D\x6B\x2D\x6C\x2D\x6D\x2D\x6E"
- "\x2D\x6F\x2D\x70\x2D\x71\x2D\x72\x2D\x73\x2D\x74\x2D\x75"
- "\x2D\x76\x2D\x77\x2D\x78\x2D\x79\x2D\x7A\x2D\x7B\x2D\x7C"
- "\x1B(B"),
- { 0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467,0x2468,
- 0x2469,0x246A,0x246B,0x246C,0x246D,0x246E,0x246F,0x2470,0x2471,
- 0x2472,0x2473,0x2160,0x2161,0x2162,0x2163,0x2164,0x2165,0x2166,
- 0x2167,0x2168,0x2169,0x3349,0x3314,0x3322,0x334D,0x3318,0x3327,
- 0x3303,0x3336,0x3351,0x3357,0x330D,0x3326,0x3323,0x332B,0x334A,
- 0x333B,0x339C,0x339D,0x339E,0x338E,0x338F,0x33C4,0x33A1,0x337B,
- 0x301D,0x301F,0x2116,0x33CD,0x2121,0x32A4,0x32A5,0x32A6,0x32A7,
- 0x32A8,0x3231,0x3232,0x3239,0x337E,0x337D,0x337C,0x2252,0x2261,
- 0x222B,0x222E,0x2211,0x221A,0x22A5,0x2220,0x221F,0x22BF,0x2235,
- 0x2229,0x222A },
- 83,
- false,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ISO_2022_JP,
- RTL_CONSTASCII_STRINGPARAM(
- "\x1B$B\x2D\x21\x2D\x22\x2D\x23\x2D\x24\x2D\x25\x2D\x26"
- "\x2D\x27\x2D\x28\x2D\x29\x2D\x2A\x2D\x2B\x2D\x2C\x2D\x2D"
- "\x2D\x2E\x2D\x2F\x2D\x30\x2D\x31\x2D\x32\x2D\x33\x2D\x34"
- "\x2D\x35\x2D\x36\x2D\x37\x2D\x38\x2D\x39\x2D\x3A\x2D\x3B"
- "\x2D\x3C\x2D\x3D\x2D\x3E\x2D\x40\x2D\x41\x2D\x42\x2D\x43"
- "\x2D\x44\x2D\x45\x2D\x46\x2D\x47\x2D\x48\x2D\x49\x2D\x4A"
- "\x2D\x4B\x2D\x4C\x2D\x4D\x2D\x4E\x2D\x4F\x2D\x50\x2D\x51"
- "\x2D\x52\x2D\x53\x2D\x54\x2D\x55\x2D\x56\x2D\x5F\x2D\x60"
- "\x2D\x61\x2D\x62\x2D\x63\x2D\x64\x2D\x65\x2D\x66\x2D\x67"
- "\x2D\x68\x2D\x69\x2D\x6A\x2D\x6B\x2D\x6C\x2D\x6D\x2D\x6E"
- "\x2D\x6F\x2D\x73\x2D\x74\x2D\x78\x2D\x79\x1B(B"),
- { 0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467,0x2468,
- 0x2469,0x246A,0x246B,0x246C,0x246D,0x246E,0x246F,0x2470,0x2471,
- 0x2472,0x2473,0x2160,0x2161,0x2162,0x2163,0x2164,0x2165,0x2166,
- 0x2167,0x2168,0x2169,0x3349,0x3314,0x3322,0x334D,0x3318,0x3327,
- 0x3303,0x3336,0x3351,0x3357,0x330D,0x3326,0x3323,0x332B,0x334A,
- 0x333B,0x339C,0x339D,0x339E,0x338E,0x338F,0x33C4,0x33A1,0x337B,
- 0x301D,0x301F,0x2116,0x33CD,0x2121,0x32A4,0x32A5,0x32A6,0x32A7,
- 0x32A8,0x3231,0x3232,0x3239,0x337E,0x337D,0x337C,0x222E,0x2211,
- 0x221F,0x22BF },
- 74,
- false,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_EUC_JP,
- RTL_CONSTASCII_STRINGPARAM(
- "\xAD\xA1\xAD\xA2\xAD\xA3\xAD\xA4\xAD\xA5\xAD\xA6\xAD\xA7"
- "\xAD\xA8\xAD\xA9\xAD\xAA\xAD\xAB\xAD\xAC\xAD\xAD\xAD\xAE"
- "\xAD\xAF\xAD\xB0\xAD\xB1\xAD\xB2\xAD\xB3\xAD\xB4\xAD\xB5"
- "\xAD\xB6\xAD\xB7\xAD\xB8\xAD\xB9\xAD\xBA\xAD\xBB\xAD\xBC"
- "\xAD\xBD\xAD\xBE\xAD\xC0\xAD\xC1\xAD\xC2\xAD\xC3\xAD\xC4"
- "\xAD\xC5\xAD\xC6\xAD\xC7\xAD\xC8\xAD\xC9\xAD\xCA\xAD\xCB"
- "\xAD\xCC\xAD\xCD\xAD\xCE\xAD\xCF\xAD\xD0\xAD\xD1\xAD\xD2"
- "\xAD\xD3\xAD\xD4\xAD\xD5\xAD\xD6\xAD\xDF\xAD\xE0\xAD\xE1"
- "\xAD\xE2\xAD\xE3\xAD\xE4\xAD\xE5\xAD\xE6\xAD\xE7\xAD\xE8"
- "\xAD\xE9\xAD\xEA\xAD\xEB\xAD\xEC\xAD\xED\xAD\xEE\xAD\xEF"
- "\xAD\xF0\xAD\xF1\xAD\xF2\xAD\xF3\xAD\xF4\xAD\xF5\xAD\xF6"
- "\xAD\xF7\xAD\xF8\xAD\xF9\xAD\xFA\xAD\xFB\xAD\xFC"),
- { 0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467,0x2468,
- 0x2469,0x246A,0x246B,0x246C,0x246D,0x246E,0x246F,0x2470,0x2471,
- 0x2472,0x2473,0x2160,0x2161,0x2162,0x2163,0x2164,0x2165,0x2166,
- 0x2167,0x2168,0x2169,0x3349,0x3314,0x3322,0x334D,0x3318,0x3327,
- 0x3303,0x3336,0x3351,0x3357,0x330D,0x3326,0x3323,0x332B,0x334A,
- 0x333B,0x339C,0x339D,0x339E,0x338E,0x338F,0x33C4,0x33A1,0x337B,
- 0x301D,0x301F,0x2116,0x33CD,0x2121,0x32A4,0x32A5,0x32A6,0x32A7,
- 0x32A8,0x3231,0x3232,0x3239,0x337E,0x337D,0x337C,0x2252,0x2261,
- 0x222B,0x222E,0x2211,0x221A,0x22A5,0x2220,0x221F,0x22BF,0x2235,
- 0x2229,0x222A },
- 83,
- true,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_EUC_JP,
- RTL_CONSTASCII_STRINGPARAM(
- "\xAD\xA1\xAD\xA2\xAD\xA3\xAD\xA4\xAD\xA5\xAD\xA6\xAD\xA7"
- "\xAD\xA8\xAD\xA9\xAD\xAA\xAD\xAB\xAD\xAC\xAD\xAD\xAD\xAE"
- "\xAD\xAF\xAD\xB0\xAD\xB1\xAD\xB2\xAD\xB3\xAD\xB4\xAD\xB5"
- "\xAD\xB6\xAD\xB7\xAD\xB8\xAD\xB9\xAD\xBA\xAD\xBB\xAD\xBC"
- "\xAD\xBD\xAD\xBE\xAD\xC0\xAD\xC1\xAD\xC2\xAD\xC3\xAD\xC4"
- "\xAD\xC5\xAD\xC6\xAD\xC7\xAD\xC8\xAD\xC9\xAD\xCA\xAD\xCB"
- "\xAD\xCC\xAD\xCD\xAD\xCE\xAD\xCF\xAD\xD0\xAD\xD1\xAD\xD2"
- "\xAD\xD3\xAD\xD4\xAD\xD5\xAD\xD6\xAD\xDF\xAD\xE0\xAD\xE1"
- "\xAD\xE2\xAD\xE3\xAD\xE4\xAD\xE5\xAD\xE6\xAD\xE7\xAD\xE8"
- "\xAD\xE9\xAD\xEA\xAD\xEB\xAD\xEC\xAD\xED\xAD\xEE\xAD\xEF"
- "\xAD\xF3\xAD\xF4\xAD\xF8\xAD\xF9"),
- { 0x2460,0x2461,0x2462,0x2463,0x2464,0x2465,0x2466,0x2467,0x2468,
- 0x2469,0x246A,0x246B,0x246C,0x246D,0x246E,0x246F,0x2470,0x2471,
- 0x2472,0x2473,0x2160,0x2161,0x2162,0x2163,0x2164,0x2165,0x2166,
- 0x2167,0x2168,0x2169,0x3349,0x3314,0x3322,0x334D,0x3318,0x3327,
- 0x3303,0x3336,0x3351,0x3357,0x330D,0x3326,0x3323,0x332B,0x334A,
- 0x333B,0x339C,0x339D,0x339E,0x338E,0x338F,0x33C4,0x33A1,0x337B,
- 0x301D,0x301F,0x2116,0x33CD,0x2121,0x32A4,0x32A5,0x32A6,0x32A7,
- 0x32A8,0x3231,0x3232,0x3239,0x337E,0x337D,0x337C,0x222E,0x2211,
- 0x221F,0x22BF },
- 74,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
-
- { RTL_TEXTENCODING_EUC_JP,
- RTL_CONSTASCII_STRINGPARAM("\xB9\xF5"),
- { 0x9ED2 },
- 1,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
-
- // Test ISO-8859-x/MS-125x range 0x80--9F:
-
- { RTL_TEXTENCODING_ISO_8859_1,
- RTL_CONSTASCII_STRINGPARAM(
- "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E"
- "\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D"
- "\x9E\x9F"),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ISO_8859_2,
- RTL_CONSTASCII_STRINGPARAM(
- "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E"
- "\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D"
- "\x9E\x9F"),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ISO_8859_3,
- RTL_CONSTASCII_STRINGPARAM(
- "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E"
- "\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D"
- "\x9E\x9F"),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ISO_8859_4,
- RTL_CONSTASCII_STRINGPARAM(
- "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E"
- "\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D"
- "\x9E\x9F"),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ISO_8859_5,
- RTL_CONSTASCII_STRINGPARAM(
- "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E"
- "\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D"
- "\x9E\x9F"),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ISO_8859_6,
- RTL_CONSTASCII_STRINGPARAM(
- "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E"
- "\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D"
- "\x9E\x9F"),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ISO_8859_7,
- RTL_CONSTASCII_STRINGPARAM(
- "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E"
- "\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D"
- "\x9E\x9F"),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ISO_8859_8,
- RTL_CONSTASCII_STRINGPARAM(
- "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E"
- "\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D"
- "\x9E\x9F"),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ISO_8859_9,
- RTL_CONSTASCII_STRINGPARAM(
- "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E"
- "\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D"
- "\x9E\x9F"),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ISO_8859_14,
- RTL_CONSTASCII_STRINGPARAM(
- "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E"
- "\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D"
- "\x9E\x9F"),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ISO_8859_15,
- RTL_CONSTASCII_STRINGPARAM(
- "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E"
- "\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D"
- "\x9E\x9F"),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_MS_874,
- RTL_CONSTASCII_STRINGPARAM(""),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE },
- { RTL_TEXTENCODING_MS_1250,
- RTL_CONSTASCII_STRINGPARAM(""),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE },
- { RTL_TEXTENCODING_MS_1251,
- RTL_CONSTASCII_STRINGPARAM(""),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE },
- { RTL_TEXTENCODING_MS_1252,
- RTL_CONSTASCII_STRINGPARAM(""),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE },
- { RTL_TEXTENCODING_MS_1253,
- RTL_CONSTASCII_STRINGPARAM(""),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE },
- { RTL_TEXTENCODING_MS_1254,
- RTL_CONSTASCII_STRINGPARAM(""),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE },
- { RTL_TEXTENCODING_MS_1255,
- RTL_CONSTASCII_STRINGPARAM(""),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE },
- { RTL_TEXTENCODING_MS_1256,
- RTL_CONSTASCII_STRINGPARAM(""),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE },
- { RTL_TEXTENCODING_MS_1257,
- RTL_CONSTASCII_STRINGPARAM(""),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE },
- { RTL_TEXTENCODING_MS_1258,
- RTL_CONSTASCII_STRINGPARAM(""),
- { 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,
- 0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,
- 0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,
- 0x009B,0x009C,0x009D,0x009E,0x009F },
- 32,
- true,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE },
- { RTL_TEXTENCODING_MS_949,
- RTL_CONSTASCII_STRINGPARAM(
- "\xB0\xA1\xB0\xA2\x81\x41\x81\x42\xB0\xA3\x81\x43\x81\x44"
- "\xB0\xA4\xB0\xA5\xB0\xA6\xB0\xA7\x81\x45\x81\x46\x81\x47"
- "\x81\x48\x81\x49\xB0\xA8\xB0\xA9\xB0\xAA\xB0\xAB\xB0\xAC"
- "\xB0\xAD\xB0\xAE\xB0\xAF\x81\x4A\xB0\xB0\xB0\xB1\xB0\xB2"),
- { 0xAC00,0xAC01,0xAC02,0xAC03,0xAC04,0xAC05,0xAC06,0xAC07,0xAC08,
- 0xAC09,0xAC0A,0xAC0B,0xAC0C,0xAC0D,0xAC0E,0xAC0F,0xAC10,0xAC11,
- 0xAC12,0xAC13,0xAC14,0xAC15,0xAC16,0xAC17,0xAC18,0xAC19,0xAC1A,
- 0xAC1B },
- 28,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_MS_949,
- RTL_CONSTASCII_STRINGPARAM(
- "\xC9\xA1\xC9\xA2\xC9\xA3\xC9\xFC\xC9\xFD\xC9\xFE"
- "\xFE\xA1\xFE\xA2\xFE\xA3\xFE\xFC\xFE\xFD\xFE\xFE"),
- { 0xE000,0xE001,0xE002,0xE05B,0xE05C,0xE05D,
- 0xE05E,0xE05F,0xE060,0xE0B9,0xE0BA,0xE0BB },
- 12,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_EUC_KR,
- RTL_CONSTASCII_STRINGPARAM(
- "\xB0\xA1\xB0\xA2" "\xB0\xA3"
- "\xB0\xA4\xB0\xA5\xB0\xA6\xB0\xA7"
- "\xB0\xA8\xB0\xA9\xB0\xAA\xB0\xAB\xB0\xAC"
- "\xB0\xAD\xB0\xAE\xB0\xAF" "\xB0\xB0\xB0\xB1\xB0\xB2"),
- { 0xAC00,0xAC01, 0xAC04, 0xAC07,0xAC08,
- 0xAC09,0xAC0A, 0xAC10,0xAC11,
- 0xAC12,0xAC13,0xAC14,0xAC15,0xAC16,0xAC17, 0xAC19,0xAC1A,
- 0xAC1B },
- 18,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_EUC_KR,
- RTL_CONSTASCII_STRINGPARAM(
- "\xB0\xA1\xB0\xA2" "\xB0\xA3"
- "\xB0\xA4\xB0\xA5\xB0\xA6\xB0\xA7"
- "\xB0\xA8\xB0\xA9\xB0\xAA\xB0\xAB\xB0\xAC"
- "\xB0\xAD\xB0\xAE\xB0\xAF" "\xB0\xB0\xB0\xB1\xB0\xB2"),
- { 0xAC00,0xAC01,0xAC02,0xAC03,0xAC04,0xAC05,0xAC06,0xAC07,0xAC08,
- 0xAC09,0xAC0A,0xAC0B,0xAC0C,0xAC0D,0xAC0E,0xAC0F,0xAC10,0xAC11,
- 0xAC12,0xAC13,0xAC14,0xAC15,0xAC16,0xAC17,0xAC18,0xAC19,0xAC1A,
- 0xAC1B },
- 28,
- true,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE },
- { RTL_TEXTENCODING_EUC_KR,
- RTL_CONSTASCII_STRINGPARAM(
- "\xC9\xA1\xC9\xA2\xC9\xA3\xC9\xFC\xC9\xFD\xC9\xFE"
- "\xFE\xA1\xFE\xA2\xFE\xA3\xFE\xFC\xFE\xFD\xFE\xFE"),
- { 0xE000,0xE001,0xE002,0xE05B,0xE05C,0xE05D,
- 0xE05E,0xE05F,0xE060,0xE0B9,0xE0BA,0xE0BB },
- 12,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
-
- // Test UTF-8:
-
- { RTL_TEXTENCODING_UTF8,
- RTL_CONSTASCII_STRINGPARAM("\x00"),
- { 0x0000 },
- 1,
- false,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_UTF8,
- RTL_CONSTASCII_STRINGPARAM("\xEF\xBB\xBF"),
- { 0xFEFF },
- 1,
- false,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_UTF8,
- RTL_CONSTASCII_STRINGPARAM("\xEF\xBB\xBF\xEF\xBB\xBF"),
- { 0xFEFF,0xFEFF },
- 2,
- false,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_UTF8,
- RTL_CONSTASCII_STRINGPARAM("\xEF\xBB\xBF"),
- { 0 },
- 0,
- false,
- true,
- true,
- true,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_UTF8,
- RTL_CONSTASCII_STRINGPARAM("\xEF\xBB\xBF\xEF\xBB\xBF"),
- { 0xFEFF },
- 1,
- false,
- true,
- true,
- true,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_UTF8,
- RTL_CONSTASCII_STRINGPARAM("\x01\x02\x7E\x7F"),
- { 0x0001,0x0002,0x007E,0x007F },
- 4,
- false,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_UTF8,
- RTL_CONSTASCII_STRINGPARAM(
- "\xC0\x80\xE0\x80\x81\xF0\x80\x80\x82\xF8\x80\x80\x80\x83"
- "\xFC\x80\x80\x80\x80\x84"),
- { 0x0000,0x0001,0x0002,0x0003,0x0004 },
- 5,
- false,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_UTF8,
- RTL_CONSTASCII_STRINGPARAM("\xED\xA1\x89\xED\xB4\x93"),
- { 0xD849,0xDD13 },
- 2,
- false,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_UTF8,
- RTL_CONSTASCII_STRINGPARAM("\xED\xA1\x89\x41"),
- { 0xD849,0x0041 },
- 2,
- false,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
-
- // Test Java UTF-8:
-
- { RTL_TEXTENCODING_JAVA_UTF8,
- RTL_CONSTASCII_STRINGPARAM(
- "\xEF\xBB\xBF\xC0\x80\x01\x20\x41\x7F\xED\xA0\x80"
- "\xED\xB0\x80"),
- { 0xFEFF,0x0000,0x0001,0x0020,0x0041,0x007F,0xD800,0xDC00 },
- 8,
- false,
- true,
- true,
- true,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
-
- // Bug #112949#:
-
- { RTL_TEXTENCODING_SHIFT_JIS,
- RTL_CONSTASCII_STRINGPARAM("\x81\x63"),
- { 0x2026 },
- 1,
- false,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_SHIFT_JIS,
- RTL_CONSTASCII_STRINGPARAM("\xA0\xFD\xFE\xFF"),
- { 0x00A0, 0x00A9, 0x2122, 0x2026 },
- 4,
- false,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_SHIFT_JIS,
- RTL_CONSTASCII_STRINGPARAM(""),
- { 0x00A0, 0x00A9, 0x2122 },
- 3,
- false,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE },
- { RTL_TEXTENCODING_MS_932,
- RTL_CONSTASCII_STRINGPARAM("\x81\x63"),
- { 0x2026 },
- 1,
- false,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_MS_932,
- RTL_CONSTASCII_STRINGPARAM("\xA0\xFD\xFE\xFF"),
- { 0x00A0, 0x00A9, 0x2122, 0x2026 },
- 4,
- false,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_MS_932,
- RTL_CONSTASCII_STRINGPARAM(""),
- { 0x00A0, 0x00A9, 0x2122 },
- 3,
- false,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_IGNORE },
- { RTL_TEXTENCODING_APPLE_JAPANESE,
- RTL_CONSTASCII_STRINGPARAM("\xA0\xFD\xFE\x81\x63"),
- { 0x00A0, 0x00A9, 0x2122, 0x2026 },
- 4,
- false,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_APPLE_JAPANESE,
- RTL_CONSTASCII_STRINGPARAM("\xFF"),
- { 0x2026 },
- 1,
- false,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
-
- { RTL_TEXTENCODING_ADOBE_STANDARD,
- RTL_CONSTASCII_STRINGPARAM("\x20\x2D\xA4\xB4\xC5"),
- { 0x0020, 0x002D, 0x2215, 0x00B7, 0x00AF },
- 5,
- false,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ADOBE_STANDARD,
- RTL_CONSTASCII_STRINGPARAM("\x20\x2D\xA4\xB4\xC5"),
- { 0x00A0, 0x00AD, 0x2044, 0x2219, 0x02C9 },
- 5,
- false,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
-
- { RTL_TEXTENCODING_ADOBE_SYMBOL,
- RTL_CONSTASCII_STRINGPARAM("\x20\x44\x57\x6D\xA4"),
- { 0x0020, 0x0394, 0x03A9, 0x03BC, 0x2215 },
- 5,
- false,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_ADOBE_SYMBOL,
- RTL_CONSTASCII_STRINGPARAM("\x20\x44\x57\x6D\xA4"),
- { 0x00A0, 0x2206, 0x2126, 0x00B5, 0x2044 },
- 5,
- false,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
-
- // Bug #i62310#:
- { RTL_TEXTENCODING_SHIFT_JIS,
- RTL_CONSTASCII_STRINGPARAM(
- "\xF0\x40\xF0\x7E\xF0\x80\xF0\xFC\xF1\x40\xF9\xFC"),
- { 0xE000, 0xE03E, 0xE03F, 0xE0BB, 0xE0BC, 0xE757 },
- 6,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
-
- // Bug #i73103#:
- { RTL_TEXTENCODING_MS_1258,
- RTL_CONSTASCII_STRINGPARAM(
- "\xC0\x41\xDE\xE3\xD2\xD4\xEC\xFD\xF2"),
- { 0x00C0, 0x0041, 0x0303, 0x0103, 0x0309, 0x00D4, 0x0301, 0x01B0,
- 0x0323 },
- 9,
- true,
- true,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_MS_1258,
- RTL_CONSTASCII_STRINGPARAM(
- "\xC0\x41\xDE\xE3\xD2\xD4\xEC\xFD\xF2"),
- { 0x00C0, 0x00C3, 0x1EB3, 0x1ED0, 0x1EF1 },
- 5,
- false,
- false,
- true,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR }
- };
- for (std::size_t i = 0; i < SAL_N_ELEMENTS(data); ++i) {
- doComplexCharSetTest(data[i]);
- }
-}
-
-void Test::testComplexCut() {
- static ComplexCharSetTest const data[]
- = { { RTL_TEXTENCODING_EUC_JP,
- RTL_CONSTASCII_STRINGPARAM("\xA1"),
- { 0 },
- 0,
- true,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_EUC_JP,
- RTL_CONSTASCII_STRINGPARAM("\x8E"),
- { 0 },
- 0,
- true,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_EUC_JP,
- RTL_CONSTASCII_STRINGPARAM("\x8F"),
- { 0 },
- 0,
- true,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_EUC_JP,
- RTL_CONSTASCII_STRINGPARAM("\x8F\xA1"),
- { 0 },
- 0,
- true,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_EUC_CN,
- RTL_CONSTASCII_STRINGPARAM("\xA1"),
- { 0 },
- 0,
- true,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR } /* ,
- { RTL_TEXTENCODING_EUC_TW,
- RTL_CONSTASCII_STRINGPARAM("\xA1"),
- { 0 },
- 0,
- true,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_EUC_TW,
- RTL_CONSTASCII_STRINGPARAM("\x8E"),
- { 0 },
- 0,
- true,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_EUC_TW,
- RTL_CONSTASCII_STRINGPARAM("\x8E\xA1"),
- { 0 },
- 0,
- true,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR },
- { RTL_TEXTENCODING_EUC_TW,
- RTL_CONSTASCII_STRINGPARAM("\x8E\xA1\xA1"),
- { 0 },
- 0,
- true,
- true,
- false,
- false,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR } */ };
- for (std::size_t i = 0; i < SAL_N_ELEMENTS(data); ++i) {
- doComplexCharSetCutTest(data[i]);
- }
-}
-
-void Test::testSRCBUFFERTOSMALL() {
- rtl_TextToUnicodeConverter cv = rtl_createTextToUnicodeConverter(
- RTL_TEXTENCODING_EUC_JP);
- OSL_ASSERT(cv != NULL);
- rtl_TextToUnicodeContext cx = rtl_createTextToUnicodeContext(cv);
- OSL_ASSERT(cx != NULL);
- char src = '\xA1';
- sal_Unicode dst[10];
- sal_uInt32 info;
- sal_Size cvt;
- CPPUNIT_ASSERT_EQUAL(
- sal_Size(0),
- rtl_convertTextToUnicode(
- cv, cx, &src, 1, dst, sizeof dst / sizeof (sal_Unicode),
- (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
- RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
- RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR),
- &info, &cvt));
- CPPUNIT_ASSERT_EQUAL(RTL_TEXTTOUNICODE_INFO_SRCBUFFERTOSMALL, info);
- CPPUNIT_ASSERT(cvt <= 1);
- rtl_destroyTextToUnicodeContext(cv, cx);
- rtl_destroyTextToUnicodeConverter(cv);
-}
-
-void Test::testMime() {
- struct Data {
- char const * mime;
- rtl_TextEncoding encoding;
- bool reverse;
- };
- static Data const data[] = {
- { "GBK", RTL_TEXTENCODING_GBK, false },
- { "CP936", RTL_TEXTENCODING_GBK, false },
- { "MS936", RTL_TEXTENCODING_GBK, false },
- { "windows-936", RTL_TEXTENCODING_GBK, false },
-
- { "GB18030", RTL_TEXTENCODING_GB_18030, false },
-
- { "TIS-620", RTL_TEXTENCODING_TIS_620, true },
- { "ISO-8859-11", RTL_TEXTENCODING_TIS_620, false }, // not registered
-
- { "CP874", RTL_TEXTENCODING_MS_874, false }, // not registered
- { "MS874", RTL_TEXTENCODING_MS_874, false }, // not registered
- { "windows-874", RTL_TEXTENCODING_MS_874, true }, // not registered
-
- { "ISO_8859-8:1988", RTL_TEXTENCODING_ISO_8859_8, false },
- { "iso-ir-138", RTL_TEXTENCODING_ISO_8859_8, false },
- { "ISO_8859-8", RTL_TEXTENCODING_ISO_8859_8, false },
- { "ISO-8859-8", RTL_TEXTENCODING_ISO_8859_8, true },
- { "hebrew", RTL_TEXTENCODING_ISO_8859_8, false },
- { "csISOLatinHebrew", RTL_TEXTENCODING_ISO_8859_8, false },
-
- { "windows-1255", RTL_TEXTENCODING_MS_1255, true },
-
- { "IBM862", RTL_TEXTENCODING_IBM_862, true },
- { "cp862", RTL_TEXTENCODING_IBM_862, false },
- { "862", RTL_TEXTENCODING_IBM_862, false },
- { "csPC862LatinHebrew", RTL_TEXTENCODING_IBM_862, false },
-
- { "ISO_8859-6:1987", RTL_TEXTENCODING_ISO_8859_6, false },
- { "iso-ir-127", RTL_TEXTENCODING_ISO_8859_6, false },
- { "ISO_8859-6", RTL_TEXTENCODING_ISO_8859_6, false },
- { "ISO-8859-6", RTL_TEXTENCODING_ISO_8859_6, true },
- { "ECMA-114", RTL_TEXTENCODING_ISO_8859_6, false },
- { "ASMO-708", RTL_TEXTENCODING_ISO_8859_6, false },
- { "arabic", RTL_TEXTENCODING_ISO_8859_6, false },
- { "csISOLatinArabic", RTL_TEXTENCODING_ISO_8859_6, false },
-
- { "windows-1256", RTL_TEXTENCODING_MS_1256, true },
-
- { "IBM864", RTL_TEXTENCODING_IBM_864, true },
- { "cp864", RTL_TEXTENCODING_IBM_864, false },
- { "csIBM864", RTL_TEXTENCODING_IBM_864, false },
-
- { "KOI8-R", RTL_TEXTENCODING_KOI8_R, false },
- { "csKOI8R", RTL_TEXTENCODING_KOI8_R, false },
- { "koi8-r", RTL_TEXTENCODING_KOI8_R, true },
-
- { "KOI8-U", RTL_TEXTENCODING_KOI8_U, true },
-
- { "IBM860", RTL_TEXTENCODING_IBM_860, true },
- { "cp860", RTL_TEXTENCODING_IBM_860, false },
- { "860", RTL_TEXTENCODING_IBM_860, false },
- { "csIBM860", RTL_TEXTENCODING_IBM_860, false },
-
- { "IBM861", RTL_TEXTENCODING_IBM_861, true },
- { "cp861", RTL_TEXTENCODING_IBM_861, false },
- { "861", RTL_TEXTENCODING_IBM_861, false },
- { "cp-is", RTL_TEXTENCODING_IBM_861, false },
- { "csIBM861", RTL_TEXTENCODING_IBM_861, false },
-
- { "IBM863", RTL_TEXTENCODING_IBM_863, true },
- { "cp863", RTL_TEXTENCODING_IBM_863, false },
- { "863", RTL_TEXTENCODING_IBM_863, false },
- { "csIBM863", RTL_TEXTENCODING_IBM_863, false },
-
- { "IBM865", RTL_TEXTENCODING_IBM_865, true },
- { "cp865", RTL_TEXTENCODING_IBM_865, false },
- { "865", RTL_TEXTENCODING_IBM_865, false },
- { "csIBM865", RTL_TEXTENCODING_IBM_865, false },
-
- { "Latin-9", RTL_TEXTENCODING_ISO_8859_15, false },
-
- { "KS_C_5601-1987", RTL_TEXTENCODING_MS_949, false },
- { "iso-ir-149", RTL_TEXTENCODING_MS_949, false },
- { "KS_C_5601-1989", RTL_TEXTENCODING_MS_949, false },
- { "KSC_5601", RTL_TEXTENCODING_MS_949, false },
- { "korean", RTL_TEXTENCODING_MS_949, false },
- { "csKSC56011987", RTL_TEXTENCODING_MS_949, false },
- { 0, RTL_TEXTENCODING_MS_949, true },
-
- { "Adobe-Standard-Encoding", RTL_TEXTENCODING_ADOBE_STANDARD, false },
- { "csAdobeStandardEncoding", RTL_TEXTENCODING_ADOBE_STANDARD, false },
- { "Adobe-Symbol-Encoding", RTL_TEXTENCODING_ADOBE_SYMBOL, false },
- { "csHPPSMath", RTL_TEXTENCODING_ADOBE_SYMBOL, false },
-
- { "PTCP154", RTL_TEXTENCODING_PT154, true },
- { "csPTCP154", RTL_TEXTENCODING_PT154, false },
- { "PT154", RTL_TEXTENCODING_PT154, false },
- { "CP154", RTL_TEXTENCODING_PT154, false },
- { "Cyrillic-Asian", RTL_TEXTENCODING_PT154, false }
- };
- for (std::size_t i = 0; i < SAL_N_ELEMENTS(data); ++i) {
- if (data[i].mime == 0) {
- OSL_ASSERT(data[i].reverse);
- CPPUNIT_ASSERT_EQUAL(
- static_cast< char const * >(0),
- rtl_getMimeCharsetFromTextEncoding(data[i].encoding));
- } else {
- CPPUNIT_ASSERT_EQUAL(
- data[i].encoding,
- rtl_getTextEncodingFromMimeCharset(data[i].mime));
- if (data[i].reverse) {
- CPPUNIT_ASSERT_EQUAL(
- rtl::OString(data[i].mime),
- rtl::OString(
- rtl_getMimeCharsetFromTextEncoding(data[i].encoding)));
- }
- }
- }
-}
-
-void Test::testWindows() {
- struct Data {
- sal_uInt32 codePage;
- rtl_TextEncoding encoding;
- bool reverse;
- };
- static Data const data[] = {
- { 437, RTL_TEXTENCODING_IBM_437, true },
- { 708, RTL_TEXTENCODING_ISO_8859_6, false },
- { 737, RTL_TEXTENCODING_IBM_737, true },
- { 775, RTL_TEXTENCODING_IBM_775, true },
- { 850, RTL_TEXTENCODING_IBM_850, true },
- { 852, RTL_TEXTENCODING_IBM_852, true },
- { 855, RTL_TEXTENCODING_IBM_855, true },
- { 857, RTL_TEXTENCODING_IBM_857, true },
- { 860, RTL_TEXTENCODING_IBM_860, true },
- { 861, RTL_TEXTENCODING_IBM_861, true },
- { 862, RTL_TEXTENCODING_IBM_862, true },
- { 863, RTL_TEXTENCODING_IBM_863, true },
- { 864, RTL_TEXTENCODING_IBM_864, true },
- { 865, RTL_TEXTENCODING_IBM_865, true },
- { 866, RTL_TEXTENCODING_IBM_866, true },
- { 869, RTL_TEXTENCODING_IBM_869, true },
- { 874, RTL_TEXTENCODING_MS_874, true },
- { 932, RTL_TEXTENCODING_MS_932, true },
- { 936, RTL_TEXTENCODING_MS_936, true },
- { 949, RTL_TEXTENCODING_MS_949, true },
- { 950, RTL_TEXTENCODING_MS_950, true },
- { 1250, RTL_TEXTENCODING_MS_1250, true },
- { 1251, RTL_TEXTENCODING_MS_1251, true },
- { 1252, RTL_TEXTENCODING_MS_1252, true },
- { 1253, RTL_TEXTENCODING_MS_1253, true },
- { 1254, RTL_TEXTENCODING_MS_1254, true },
- { 1255, RTL_TEXTENCODING_MS_1255, true },
- { 1256, RTL_TEXTENCODING_MS_1256, true },
- { 1257, RTL_TEXTENCODING_MS_1257, true },
- { 1258, RTL_TEXTENCODING_MS_1258, true },
- { 1361, RTL_TEXTENCODING_MS_1361, true },
- { 10000, RTL_TEXTENCODING_APPLE_ROMAN, true },
- { 10001, RTL_TEXTENCODING_APPLE_JAPANESE, true },
- { 10002, RTL_TEXTENCODING_APPLE_CHINTRAD, true },
- { 10003, RTL_TEXTENCODING_APPLE_KOREAN, true },
- { 10004, RTL_TEXTENCODING_APPLE_ARABIC, true },
- { 10005, RTL_TEXTENCODING_APPLE_HEBREW, true },
- { 10006, RTL_TEXTENCODING_APPLE_GREEK, true },
- { 10007, RTL_TEXTENCODING_APPLE_CYRILLIC, true },
- { 10008, RTL_TEXTENCODING_APPLE_CHINSIMP, true },
- { 10010, RTL_TEXTENCODING_APPLE_ROMANIAN, true },
- { 10017, RTL_TEXTENCODING_APPLE_UKRAINIAN, true },
- { 10029, RTL_TEXTENCODING_APPLE_CENTEURO, true },
- { 10079, RTL_TEXTENCODING_APPLE_ICELAND, true },
- { 10081, RTL_TEXTENCODING_APPLE_TURKISH, true },
- { 10082, RTL_TEXTENCODING_APPLE_CROATIAN, true },
- { 20127, RTL_TEXTENCODING_ASCII_US, true },
- { 20866, RTL_TEXTENCODING_KOI8_R, true },
- { 21866, RTL_TEXTENCODING_KOI8_U, true },
- { 28591, RTL_TEXTENCODING_ISO_8859_1, true },
- { 28592, RTL_TEXTENCODING_ISO_8859_2, true },
- { 28593, RTL_TEXTENCODING_ISO_8859_3, true },
- { 28594, RTL_TEXTENCODING_ISO_8859_4, true },
- { 28595, RTL_TEXTENCODING_ISO_8859_5, true },
- { 28596, RTL_TEXTENCODING_ISO_8859_6, true },
- { 28597, RTL_TEXTENCODING_ISO_8859_7, true },
- { 28598, RTL_TEXTENCODING_ISO_8859_8, true },
- { 28599, RTL_TEXTENCODING_ISO_8859_9, true },
- { 28605, RTL_TEXTENCODING_ISO_8859_15, true },
- { 50220, RTL_TEXTENCODING_ISO_2022_JP, true },
- { 50225, RTL_TEXTENCODING_ISO_2022_KR, true },
- { 51932, RTL_TEXTENCODING_EUC_JP, true },
- { 51936, RTL_TEXTENCODING_EUC_CN, true },
- { 51949, RTL_TEXTENCODING_EUC_KR, true },
- { 65000, RTL_TEXTENCODING_UTF7, true },
- { 65001, RTL_TEXTENCODING_UTF8, true },
- { 1200, RTL_TEXTENCODING_DONTKNOW, false }, // UTF_16LE
- { 1201, RTL_TEXTENCODING_DONTKNOW, false }, // UTF_16LE
- { 0, RTL_TEXTENCODING_DONTKNOW, true },
- { 0, RTL_TEXTENCODING_UCS4, true },
- { 0, RTL_TEXTENCODING_UCS2, true },
- { 0, RTL_TEXTENCODING_ISCII_DEVANAGARI, true }
- };
- for (std::size_t i = 0; i < SAL_N_ELEMENTS(data); ++i) {
- OSL_ASSERT(data[i].codePage != 0 || data[i].reverse);
- if (data[i].codePage != 0) {
- CPPUNIT_ASSERT_EQUAL(
- data[i].encoding,
- rtl_getTextEncodingFromWindowsCodePage(data[i].codePage));
- }
- if (data[i].reverse) {
- CPPUNIT_ASSERT_EQUAL(
- data[i].codePage,
- rtl_getWindowsCodePageFromTextEncoding(data[i].encoding));
- }
- }
-}
-
-void Test::testInfo() {
- struct Data {
- rtl_TextEncoding encoding;
- sal_uInt32 flag;
- bool value;
- };
- static Data const data[] = {
- { RTL_TEXTENCODING_APPLE_CHINTRAD, RTL_TEXTENCODING_INFO_ASCII, false },
- { RTL_TEXTENCODING_APPLE_JAPANESE, RTL_TEXTENCODING_INFO_ASCII, false },
- { RTL_TEXTENCODING_APPLE_KOREAN, RTL_TEXTENCODING_INFO_ASCII, false },
- { RTL_TEXTENCODING_BIG5, RTL_TEXTENCODING_INFO_ASCII, false },
- { RTL_TEXTENCODING_BIG5_HKSCS, RTL_TEXTENCODING_INFO_ASCII, false },
- { RTL_TEXTENCODING_EUC_CN, RTL_TEXTENCODING_INFO_ASCII, true },
- { RTL_TEXTENCODING_EUC_JP, RTL_TEXTENCODING_INFO_ASCII, true },
- { RTL_TEXTENCODING_EUC_KR, RTL_TEXTENCODING_INFO_ASCII, true },
- { RTL_TEXTENCODING_EUC_TW, RTL_TEXTENCODING_INFO_ASCII, true },
- { RTL_TEXTENCODING_GBK, RTL_TEXTENCODING_INFO_ASCII, false },
- { RTL_TEXTENCODING_GB_18030, RTL_TEXTENCODING_INFO_ASCII, false },
- { RTL_TEXTENCODING_GB_18030, RTL_TEXTENCODING_INFO_UNICODE, true },
- { RTL_TEXTENCODING_ISO_2022_CN, RTL_TEXTENCODING_INFO_CONTEXT, true },
- { RTL_TEXTENCODING_ISO_2022_CN, RTL_TEXTENCODING_INFO_ASCII, false },
- { RTL_TEXTENCODING_ISO_2022_JP, RTL_TEXTENCODING_INFO_CONTEXT, true },
- { RTL_TEXTENCODING_ISO_2022_JP, RTL_TEXTENCODING_INFO_ASCII, false },
- { RTL_TEXTENCODING_ISO_2022_KR, RTL_TEXTENCODING_INFO_CONTEXT, true },
- { RTL_TEXTENCODING_ISO_2022_KR, RTL_TEXTENCODING_INFO_ASCII, false },
- { RTL_TEXTENCODING_MS_1361, RTL_TEXTENCODING_INFO_ASCII, false },
- { RTL_TEXTENCODING_MS_874, RTL_TEXTENCODING_INFO_ASCII, true },
- { RTL_TEXTENCODING_MS_932, RTL_TEXTENCODING_INFO_ASCII, false },
- { RTL_TEXTENCODING_MS_936, RTL_TEXTENCODING_INFO_ASCII, false },
- { RTL_TEXTENCODING_MS_949, RTL_TEXTENCODING_INFO_ASCII, false },
- { RTL_TEXTENCODING_MS_950, RTL_TEXTENCODING_INFO_ASCII, false },
- { RTL_TEXTENCODING_SHIFT_JIS, RTL_TEXTENCODING_INFO_ASCII, false },
- { RTL_TEXTENCODING_KOI8_R, RTL_TEXTENCODING_INFO_ASCII, true },
- { RTL_TEXTENCODING_KOI8_R, RTL_TEXTENCODING_INFO_MIME, true },
- { RTL_TEXTENCODING_KOI8_U, RTL_TEXTENCODING_INFO_ASCII, true },
- { RTL_TEXTENCODING_KOI8_U, RTL_TEXTENCODING_INFO_MIME, true },
- { RTL_TEXTENCODING_IBM_860, RTL_TEXTENCODING_INFO_MIME, true },
- { RTL_TEXTENCODING_IBM_861, RTL_TEXTENCODING_INFO_MIME, true },
- { RTL_TEXTENCODING_IBM_863, RTL_TEXTENCODING_INFO_MIME, true },
- { RTL_TEXTENCODING_IBM_865, RTL_TEXTENCODING_INFO_MIME, true },
- { RTL_TEXTENCODING_ISCII_DEVANAGARI, RTL_TEXTENCODING_INFO_ASCII, true },
- { RTL_TEXTENCODING_ISCII_DEVANAGARI, RTL_TEXTENCODING_INFO_MIME, false },
- { RTL_TEXTENCODING_ADOBE_STANDARD, RTL_TEXTENCODING_INFO_ASCII, false },
- { RTL_TEXTENCODING_ADOBE_STANDARD, RTL_TEXTENCODING_INFO_MIME, true },
- { RTL_TEXTENCODING_ADOBE_STANDARD, RTL_TEXTENCODING_INFO_SYMBOL, false },
- { RTL_TEXTENCODING_ADOBE_SYMBOL, RTL_TEXTENCODING_INFO_ASCII, false },
- { RTL_TEXTENCODING_ADOBE_SYMBOL, RTL_TEXTENCODING_INFO_MIME, true },
- { RTL_TEXTENCODING_ADOBE_SYMBOL, RTL_TEXTENCODING_INFO_SYMBOL, true },
- { RTL_TEXTENCODING_PT154, RTL_TEXTENCODING_INFO_ASCII, true },
- { RTL_TEXTENCODING_PT154, RTL_TEXTENCODING_INFO_MIME, true }
- };
- for (std::size_t i = 0; i < SAL_N_ELEMENTS(data); ++i) {
- rtl_TextEncodingInfo info;
- info.StructSize = sizeof info;
- CPPUNIT_ASSERT(rtl_getTextEncodingInfo(data[i].encoding, &info));
- CPPUNIT_ASSERT_EQUAL(data[i].value, ((info.Flags & data[i].flag) != 0));
- }
-}
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "rtl_textcvt");
-
-}
-
-NOADDITIONAL;
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/uri/makefile.mk b/sal/qa/rtl/uri/makefile.mk
deleted file mode 100644
index 5d3fc19dc..000000000
--- a/sal/qa/rtl/uri/makefile.mk
+++ /dev/null
@@ -1,75 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-
-PRJNAME=sal
-TARGET=qa_rtl_uritest
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
-
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-
-# --- BEGIN --------------------------------------------------------
-SHL1OBJS= \
- $(SLO)$/rtl_Uri.obj
-SHL1TARGET= rtl_uri_simple
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-DEF1NAME =$(SHL1TARGET)
-SHL1VERSIONMAP = $(PRJ)$/qa$/export.map
-
-# END --------------------------------------------------------------
-
-# --- BEGIN --------------------------------------------------------
-SHL2OBJS= \
- $(SLO)$/rtl_testuri.obj
-SHL2TARGET= rtl_Uri
-SHL2STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL2IMPLIB= i$(SHL2TARGET)
-DEF2NAME =$(SHL2TARGET)
-SHL2VERSIONMAP = $(PRJ)$/qa$/export.map
-
-# END --------------------------------------------------------------
-
-#------------------------------- All object files -------------------------------
-# do this here, so we get right dependencies
-# SLOFILES=$(SHL1OBJS)
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/uri/rtl_Uri.cxx b/sal/qa/rtl/uri/rtl_Uri.cxx
deleted file mode 100644
index 1f9f99613..000000000
--- a/sal/qa/rtl/uri/rtl_Uri.cxx
+++ /dev/null
@@ -1,300 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-#include <stdlib.h>
-#include <rtl/ustring.hxx>
-#include <rtl/strbuf.hxx>
-#include <rtl/uri.hxx>
-#include <osl/thread.h>
-#include <osl/file.hxx>
-
-#include <testshl/simpleheader.hxx>
-
-// -----------------------------------------------------------------------------
-
-namespace Stringtest
-{
- rtl::OString toHex(unsigned char _c)
- {
- rtl::OStringBuffer sStrBuf;
- static char cHex[] = "0123456789ABCDEF";
-
- int nhigh = int(_c) >> 4 & 0xf;
- int nlow = int(_c) & 0xf;
- sStrBuf.append( cHex[nhigh] );
- sStrBuf.append( cHex[nlow] );
- return sStrBuf.makeStringAndClear();
- }
-
- rtl::OString escapeString(rtl::OString const& _sStr)
- {
- rtl::OStringBuffer sStrBuf;
- sal_Int32 nLength = _sStr.getLength();
- for(int i=0;i<nLength;++i)
- {
- unsigned char c = (unsigned char)_sStr[i];
- if (c > 127)
- {
- sStrBuf.append("%");
- sStrBuf.append(toHex(c));
- }
- else
- {
- sStrBuf.append((char)c);
- }
- }
- return sStrBuf.makeStringAndClear();
- }
-
- // -----------------------------------------------------------------------------
-
- class Convert : public CppUnit::TestFixture
- {
- rtl::OUString m_aStr;
- public:
- /*
- rtl::OString toUTF8(rtl::OUString const& _suStr)
- {
- rtl::OString sStrAsUTF8 = rtl::OUStringToOString(_suStr, RTL_TEXTENCODING_UTF8);
- t_print("%s\n", escapeString(sStrAsUTF8).getStr());
- return sStrAsUTF8;
- }
- */
- rtl::OUString fromUTF8(rtl::OString const& _suStr)
- {
- rtl::OUString suStr = rtl::OStringToOUString(_suStr, RTL_TEXTENCODING_UTF8);
- return suStr;
- }
-
- rtl::OString convertToOString(rtl::OUString const& _suStr)
- {
- return rtl::OUStringToOString(_suStr, osl_getThreadTextEncoding()/*RTL_TEXTENCODING_ASCII_US*/);
- }
-
- void showContent(rtl::OUString const& _suStr)
- {
- rtl::OString sStr = convertToOString(_suStr);
- t_print("%s\n", sStr.getStr());
- }
-
- void toUTF8_mech(rtl::OUString const& _suStr, rtl_UriEncodeMechanism _eMechanism)
- {
- rtl::OUString suStr;
- suStr = rtl::Uri::encode(_suStr, rtl_UriCharClassNone, _eMechanism, RTL_TEXTENCODING_UTF8);
- showContent(suStr);
- suStr = rtl::Uri::encode(_suStr, rtl_UriCharClassUric, _eMechanism, RTL_TEXTENCODING_UTF8);
- showContent(suStr);
- suStr = rtl::Uri::encode(_suStr, rtl_UriCharClassUricNoSlash, _eMechanism, RTL_TEXTENCODING_UTF8);
- showContent(suStr);
- suStr = rtl::Uri::encode(_suStr, rtl_UriCharClassRelSegment, _eMechanism, RTL_TEXTENCODING_UTF8);
- showContent(suStr);
- suStr = rtl::Uri::encode(_suStr, rtl_UriCharClassRegName, _eMechanism, RTL_TEXTENCODING_UTF8);
- showContent(suStr);
- suStr = rtl::Uri::encode(_suStr, rtl_UriCharClassUserinfo, _eMechanism, RTL_TEXTENCODING_UTF8);
- showContent(suStr);
- suStr = rtl::Uri::encode(_suStr, rtl_UriCharClassPchar, _eMechanism, RTL_TEXTENCODING_UTF8);
- showContent(suStr);
- suStr = rtl::Uri::encode(_suStr, rtl_UriCharClassUnoParamValue, _eMechanism, RTL_TEXTENCODING_UTF8);
- showContent(suStr);
- }
-
- void toUTF8(rtl::OUString const& _suStr)
- {
- t_print("rtl_UriEncodeIgnoreEscapes \n");
- toUTF8_mech(_suStr, rtl_UriEncodeIgnoreEscapes);
- t_print("\n");
- t_print("# rtl_UriEncodeKeepEscapes\n");
- toUTF8_mech(_suStr, rtl_UriEncodeKeepEscapes);
- t_print("\n");
- t_print("# rtl_UriEncodeCheckEscapes\n");
- toUTF8_mech(_suStr, rtl_UriEncodeCheckEscapes);
- t_print("\n");
- }
-
- void test_FromUTF8_001()
- {
- // string --> ustring
- rtl::OString sStrUTF8("h%C3%A4llo");
- rtl::OUString suStrUTF8 = rtl::OStringToOUString(sStrUTF8, RTL_TEXTENCODING_ASCII_US);
-
- // UTF8 --> real ustring
- rtl::OUString suStr_UriDecodeToIuri = rtl::Uri::decode(suStrUTF8, rtl_UriDecodeToIuri, RTL_TEXTENCODING_UTF8);
- showContent(suStr_UriDecodeToIuri);
-
- // string --> ustring
- rtl::OString sStr("h\xE4llo");
- rtl::OUString suString = rtl::OStringToOUString(sStr, RTL_TEXTENCODING_ISO_8859_15);
-
- CPPUNIT_ASSERT_MESSAGE("Strings must be equal", suString.equals(suStr_UriDecodeToIuri) == sal_True);
-
- // ustring --> ustring (UTF8)
- rtl::OUString suStr2 = rtl::Uri::encode(suStr_UriDecodeToIuri, rtl_UriCharClassUnoParamValue, rtl_UriEncodeKeepEscapes, RTL_TEXTENCODING_UTF8);
- showContent(suStr2);
-
- CPPUNIT_ASSERT_MESSAGE("Strings must be equal", suStr2.equals(suStrUTF8) == sal_True);
- // suStr should be equal to suStr2
- }
-
- // "%C3%84qypten";
- // testshl2 ../../../unxlngi4.pro/lib/libConvert.so "-onlyerrors"
- // # Type: 'Directory' file name '%E6%89%8B%E6%9C%BA%E5%8F%B7%E7%A0%81'
- // # Type: 'Directory' file name '%E6%9C%AA%E5%91%BD%E5%90%8Dzhgb18030'
- // # Type: 'Regular file' file name '%E5%B7%A5%E4%BD%9C'
- // # Type: 'Regular file' file name '%E4%BA%8C%E6%89%8B%E6%88%BF%E4%B9%B0%E5%8D%96%E5%90%88%E5%90%8C%E8%8D%89%E7%A8%BF.doc'
- // ls
- rtl::OString getFileTypeName(osl::FileStatus const& _aStatus)
- {
- rtl::OString sType;
- if (_aStatus.isValid(osl_FileStatus_Mask_Type))
- {
- osl::FileStatus::Type aType = _aStatus.getFileType();
- if (aType == osl::FileStatus::Directory)
- {
- sType = "Directory";
- }
- else if (aType == osl::FileStatus::Regular)
- {
- sType = "Regular file";
- }
- else if (aType == osl::FileStatus::Volume)
- {
- sType = "Volume";
- }
- else if (aType == osl::FileStatus::Fifo)
- {
- sType = "Fifo";
- }
- else if (aType == osl::FileStatus::Socket)
- {
- sType = "Socket";
- }
- else if (aType == osl::FileStatus::Link)
- {
- sType = "Link";
- }
- else if (aType == osl::FileStatus::Special)
- {
- sType = "Special";
- }
- else if (aType == osl::FileStatus::Unknown)
- {
- sType = "Unknown";
- }
- else
- {
- sType = "Not handled yet";
- }
- }
- else
- {
- sType = "ERROR: osl_FileStatus_Mask_Type not set for FileStatus!";
- }
- return sType;
- }
-
-
- void test_UTF8_files()
- {
-#ifdef UNX
- rtl::OUString suDirURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file:///tmp/atestdir")));
-#else /* Windows */
- rtl::OUString suDirURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file:///c:/temp/atestdir")));
-#endif
- osl::Directory aDir(suDirURL);
- aDir.open();
- if (aDir.isOpen())
- {
- osl::DirectoryItem aItem;
- osl::FileStatus aStatus(osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_Attributes | osl_FileStatus_Mask_Type);
- while (aDir.getNextItem(aItem) == ::osl::FileBase::E_None)
- {
- if (osl::FileBase::E_None == aItem.getFileStatus(aStatus) &&
- aStatus.isValid(osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_Attributes))
- {
- rtl::OString sType = getFileTypeName(aStatus);
-
- rtl::OUString suFilename = aStatus.getFileName();
- // rtl::OUString suFullFileURL;
-
- rtl::OUString suStrUTF8 = rtl::Uri::encode(suFilename, rtl_UriCharClassUnoParamValue, rtl_UriEncodeKeepEscapes, RTL_TEXTENCODING_UTF8);
- rtl::OString sStrUTF8 = convertToOString(suStrUTF8);
- t_print("Type: '%s' file name '%s'\n", sType.getStr(), sStrUTF8.getStr());
- }
- }
- aDir.close();
- }
- else
- {
- rtl::OString sStr;
- sStr = rtl::OUStringToOString(suDirURL, osl_getThreadTextEncoding());
- t_print("can't open dir:'%s'\n", sStr.getStr());
- }
- }
-
- void test_FromUTF8()
- {
- rtl::OString sStr("h%C3%A4llo");
- rtl::OUString suStr = rtl::OStringToOUString(sStr, osl_getThreadTextEncoding());
-
-// rtl_UriEncodeIgnoreEscapes,
-// rtl_UriEncodeKeepEscapes,
-// rtl_UriEncodeCheckEscapes,
-// rtl::OUString suStr2 = rtl::Uri::encode(suStr, rtl_UriCharClassRegName, rtl_UriEncodeCheckEscapes, RTL_TEXTENCODING_UTF8);
- rtl::OUString suStr_UriDecodeNone = rtl::Uri::decode(suStr, rtl_UriDecodeNone, RTL_TEXTENCODING_UTF8);
- showContent(suStr_UriDecodeNone);
- toUTF8(suStr_UriDecodeNone);
-
- rtl::OUString suStr_UriDecodeToIuri = rtl::Uri::decode(suStr, rtl_UriDecodeToIuri, RTL_TEXTENCODING_UTF8);
- showContent(suStr_UriDecodeToIuri);
- toUTF8(suStr_UriDecodeToIuri);
-
- rtl::OUString suStr_UriDecodeWithCharset = rtl::Uri::decode(suStr, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8);
- showContent(suStr_UriDecodeWithCharset);
- toUTF8(suStr_UriDecodeWithCharset);
- }
-
- CPPUNIT_TEST_SUITE( Convert );
- CPPUNIT_TEST( test_FromUTF8_001 );
-// CPPUNIT_TEST( test_UTF8_files );
-// CPPUNIT_TEST( test_FromUTF8 );
- CPPUNIT_TEST_SUITE_END( );
- };
-
-}
-
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( Stringtest::Convert, "Stringtest" );
-
-// LLA: doku anpassen!!!
-
-NOADDITIONAL;
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/uri/rtl_testuri.cxx b/sal/qa/rtl/uri/rtl_testuri.cxx
deleted file mode 100644
index fe8ed6c41..000000000
--- a/sal/qa/rtl/uri/rtl_testuri.cxx
+++ /dev/null
@@ -1,548 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-#include "rtl/strbuf.hxx"
-#include "rtl/textenc.h"
-#include "rtl/uri.h"
-#include "rtl/uri.hxx"
-#include "rtl/ustrbuf.hxx"
-#include "rtl/ustring.h"
-#include "rtl/ustring.hxx"
-
-#include "testshl/simpleheader.hxx"
-
-#include <cstddef>
-#include <stdio.h>
-
-namespace {
-
-struct Test: public CppUnit::TestFixture {
- void test_Uri();
-
- CPPUNIT_TEST_SUITE(Test);
- CPPUNIT_TEST(test_Uri);
- CPPUNIT_TEST_SUITE_END();
-};
-
-void Test::test_Uri() {
- rtl_UriCharClass const eFirstCharClass = rtl_UriCharClassNone;
- rtl_UriCharClass const eLastCharClass = rtl_UriCharClassUnoParamValue;
-
- rtl::OUStringBuffer aBuffer;
- rtl::OUString aText1;
- rtl::OUString aText2;
-
- // Check that all characters map back to themselves when encoded/decoded:
-
- aText1 = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "\0x00\0x01\0x02\0x03\0x04\0x05\0x06\0x07"
- "\0x08\0x09\0x0A\0x0B\0x0C\0x0D\0x0E\0x0F"
- "\0x10\0x11\0x12\0x13\0x14\0x15\0x16\0x17"
- "\0x18\0x19\0x1A\0x1B\0x1C\0x1D\0x1E\0x1F"
- "\0x20\0x21\0x22\0x23\0x24\0x25\0x26\0x27"
- "\0x28\0x29\0x2A\0x2B\0x2C\0x2D\0x2E\0x2F"
- "\0x30\0x31\0x32\0x33\0x34\0x35\0x36\0x37"
- "\0x38\0x39\0x3A\0x3B\0x3C\0x3D\0x3E\0x3F"
- "\0x40\0x41\0x42\0x43\0x44\0x45\0x46\0x47"
- "\0x48\0x49\0x4A\0x4B\0x4C\0x4D\0x4E\0x4F"
- "\0x50\0x51\0x52\0x53\0x54\0x55\0x56\0x57"
- "\0x58\0x59\0x5A\0x5B\0x5C\0x5D\0x5E\0x5F"
- "\0x60\0x61\0x62\0x63\0x64\0x65\0x66\0x67"
- "\0x68\0x69\0x6A\0x6B\0x6C\0x6D\0x6E\0x6F"
- "\0x70\0x71\0x72\0x73\0x74\0x75\0x76\0x77"
- "\0x78\0x79\0x7A\0x7B\0x7C\0x7D\0x7E\0x7F"));
- aText2 = aText1;
- {for (rtl_UriCharClass eCharClass = eFirstCharClass;
- eCharClass <= eLastCharClass;
- eCharClass = static_cast< rtl_UriCharClass >(eCharClass + 1))
- {
- CPPUNIT_ASSERT_MESSAGE(
- "failure 1",
- (rtl::Uri::decode(
- rtl::Uri::encode(
- aText1, eCharClass, rtl_UriEncodeKeepEscapes,
- RTL_TEXTENCODING_ISO_8859_1),
- rtl_UriDecodeWithCharset, RTL_TEXTENCODING_ASCII_US)
- == aText2));
- CPPUNIT_ASSERT_MESSAGE(
- "failure 2",
- (rtl::Uri::decode(
- rtl::Uri::encode(
- aText1, eCharClass, rtl_UriEncodeCheckEscapes,
- RTL_TEXTENCODING_ISO_8859_1),
- rtl_UriDecodeWithCharset, RTL_TEXTENCODING_ASCII_US)
- == aText2));
- CPPUNIT_ASSERT_MESSAGE(
- "failure 3",
- (rtl::Uri::decode(
- rtl::Uri::encode(
- aText1, eCharClass, rtl_UriEncodeKeepEscapes,
- RTL_TEXTENCODING_ISO_8859_1),
- rtl_UriDecodeWithCharset, RTL_TEXTENCODING_ISO_8859_1)
- == aText2));
- CPPUNIT_ASSERT_MESSAGE(
- "failure 4",
- (rtl::Uri::decode(
- rtl::Uri::encode(
- aText1, eCharClass, rtl_UriEncodeCheckEscapes,
- RTL_TEXTENCODING_ISO_8859_1),
- rtl_UriDecodeWithCharset, RTL_TEXTENCODING_ISO_8859_1)
- == aText2));
- CPPUNIT_ASSERT_MESSAGE(
- "failure 5",
- (rtl::Uri::decode(
- rtl::Uri::encode(
- aText1, eCharClass, rtl_UriEncodeKeepEscapes,
- RTL_TEXTENCODING_ISO_8859_1),
- rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8)
- == aText2));
- CPPUNIT_ASSERT_MESSAGE(
- "failure 6",
- (rtl::Uri::decode(
- rtl::Uri::encode(
- aText1, eCharClass, rtl_UriEncodeCheckEscapes,
- RTL_TEXTENCODING_ISO_8859_1),
- rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8)
- == aText2));
- }}
-
- aText1 = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "\0x00\0x01\0x02\0x03\0x04\0x05\0x06\0x07"
- "\0x08\0x09\0x0A\0x0B\0x0C\0x0D\0x0E\0x0F"
- "\0x10\0x11\0x12\0x13\0x14\0x15\0x16\0x17"
- "\0x18\0x19\0x1A\0x1B\0x1C\0x1D\0x1E\0x1F"
- "\0x20\0x21\0x22\0x23\0x24\0x25\0x26\0x27"
- "\0x28\0x29\0x2A\0x2B\0x2C\0x2D\0x2E\0x2F"
- "\0x30\0x31\0x32\0x33\0x34\0x35\0x36\0x37"
- "\0x38\0x39\0x3A\0x3B\0x3C\0x3D\0x3E\0x3F"
- "\0x40\0x41\0x42\0x43\0x44\0x45\0x46\0x47"
- "\0x48\0x49\0x4A\0x4B\0x4C\0x4D\0x4E\0x4F"
- "\0x50\0x51\0x52\0x53\0x54\0x55\0x56\0x57"
- "\0x58\0x59\0x5A\0x5B\0x5C\0x5D\0x5E\0x5F"
- "\0x60\0x61\0x62\0x63\0x64\0x65\0x66\0x67"
- "\0x68\0x69\0x6A\0x6B\0x6C\0x6D\0x6E\0x6F"
- "\0x70\0x71\0x72\0x73\0x74\0x75\0x76\0x77"
- "\0x78\0x79\0x7A\0x7B\0x7C\0x7D\0x7E\0x7F"
- "\0x80\0x81\0x82\0x83\0x84\0x85\0x86\0x87"
- "\0x88\0x89\0x8A\0x8B\0x8C\0x8D\0x8E\0x8F"
- "\0x90\0x91\0x92\0x93\0x94\0x95\0x96\0x97"
- "\0x98\0x99\0x9A\0x9B\0x9C\0x9D\0x9E\0x9F"
- "\0xA0\0xA1\0xA2\0xA3\0xA4\0xA5\0xA6\0xA7"
- "\0xA8\0xA9\0xAA\0xAB\0xAC\0xAD\0xAE\0xAF"
- "\0xB0\0xB1\0xB2\0xB3\0xB4\0xB5\0xB6\0xB7"
- "\0xB8\0xB9\0xBA\0xBB\0xBC\0xBD\0xBE\0xBF"
- "\0xC0\0xC1\0xC2\0xC3\0xC4\0xC5\0xC6\0xC7"
- "\0xC8\0xC9\0xCA\0xCB\0xCC\0xCD\0xCE\0xCF"
- "\0xD0\0xD1\0xD2\0xD3\0xD4\0xD5\0xD6\0xD7"
- "\0xD8\0xD9\0xDA\0xDB\0xDC\0xDD\0xDE\0xDF"
- "\0xE0\0xE1\0xE2\0xE3\0xE4\0xE5\0xE6\0xE7"
- "\0xE8\0xE9\0xEA\0xEB\0xEC\0xED\0xEE\0xEF"
- "\0xF0\0xF1\0xF2\0xF3\0xF4\0xF5\0xF6\0xF7"
- "\0xF8\0xF9\0xFA\0xFB\0xFC\0xFD\0xFE\0xFF"));
- aText2 = aText1;
- {for (rtl_UriCharClass eCharClass = eFirstCharClass;
- eCharClass <= eLastCharClass;
- eCharClass = static_cast< rtl_UriCharClass >(eCharClass + 1))
- {
- CPPUNIT_ASSERT_MESSAGE(
- "failure 7",
- (rtl::Uri::decode(
- rtl::Uri::encode(
- aText1, eCharClass, rtl_UriEncodeKeepEscapes,
- RTL_TEXTENCODING_ISO_8859_1),
- rtl_UriDecodeWithCharset, RTL_TEXTENCODING_ISO_8859_1)
- == aText2));
- CPPUNIT_ASSERT_MESSAGE(
- "failure 8",
- (rtl::Uri::decode(
- rtl::Uri::encode(
- aText1, eCharClass, rtl_UriEncodeCheckEscapes,
- RTL_TEXTENCODING_ISO_8859_1),
- rtl_UriDecodeWithCharset, RTL_TEXTENCODING_ISO_8859_1)
- == aText2));
- CPPUNIT_ASSERT_MESSAGE(
- "failure 9",
- (rtl::Uri::decode(
- rtl::Uri::encode(
- aText1, eCharClass, rtl_UriEncodeKeepEscapes,
- RTL_TEXTENCODING_UTF8),
- rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8)
- == aText2));
- CPPUNIT_ASSERT_MESSAGE(
- "failure 10",
- (rtl::Uri::decode(
- rtl::Uri::encode(
- aText1, eCharClass, rtl_UriEncodeCheckEscapes,
- RTL_TEXTENCODING_UTF8),
- rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8)
- == aText2));
- }}
-
- // Check surrogate handling:
-
- aBuffer.append(static_cast< sal_Unicode >(0xD800)); // %ED%A0%80
- aBuffer.append(static_cast< sal_Unicode >(0xD800)); // %F0%90%8F%BF
- aBuffer.append(static_cast< sal_Unicode >(0xDFFF));
- aBuffer.append(static_cast< sal_Unicode >(0xDFFF)); // %ED%BF%BF
- aBuffer.append(static_cast< sal_Unicode >('A')); // A
- aText1 = aBuffer.makeStringAndClear();
- aText2 = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "%ED%A0%80" "%F0%90%8F%BF" "%ED%BF%BF" "A"));
- CPPUNIT_ASSERT_MESSAGE(
- "failure 11",
- (rtl::Uri::encode(
- aText1, rtl_UriCharClassUric, rtl_UriEncodeIgnoreEscapes,
- RTL_TEXTENCODING_UTF8)
- == aText2));
- CPPUNIT_ASSERT_MESSAGE(
- "failure 12",
- (rtl::Uri::encode(
- aText1, rtl_UriCharClassUric, rtl_UriEncodeKeepEscapes,
- RTL_TEXTENCODING_UTF8)
- == aText2));
- CPPUNIT_ASSERT_MESSAGE(
- "failure 13",
- (rtl::Uri::encode(
- aText1, rtl_UriCharClassUric, rtl_UriEncodeCheckEscapes,
- RTL_TEXTENCODING_UTF8)
- == aText2));
-
- aText1 = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "%ed%a0%80" "%f0%90%8f%bf" "%ed%bf%bf" "A"));
- aBuffer.appendAscii(RTL_CONSTASCII_STRINGPARAM("%ED%A0%80"));
- aBuffer.append(static_cast< sal_Unicode >(0xD800));
- aBuffer.append(static_cast< sal_Unicode >(0xDFFF));
- aBuffer.appendAscii(RTL_CONSTASCII_STRINGPARAM("%ED%BF%BF"));
- aBuffer.append(static_cast< sal_Unicode >('A'));
- aText2 = aBuffer.makeStringAndClear();
- CPPUNIT_ASSERT_MESSAGE(
- "failure 14",
- (rtl::Uri::decode(aText1, rtl_UriDecodeToIuri, RTL_TEXTENCODING_UTF8)
- == aText2));
- CPPUNIT_ASSERT_MESSAGE(
- "failure 15",
- (rtl::Uri::decode(
- aText1, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8)
- == aText2));
-
- // Check UTF-8 handling:
-
- aText1 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%E0%83%BF"));
- // \U+00FF encoded with three instead of two bytes
- aText2 = aText1;
- CPPUNIT_ASSERT_MESSAGE(
- "failure 16",
- (rtl::Uri::encode(
- aText1, rtl_UriCharClassUric, rtl_UriEncodeCheckEscapes,
- RTL_TEXTENCODING_UTF8)
- == aText2));
-
- aText1 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%EF%BF%BF"));
- // \U+FFFF is no legal character
- aText2 = aText1;
- CPPUNIT_ASSERT_MESSAGE(
- "failure 17",
- (rtl::Uri::encode(
- aText1, rtl_UriCharClassUric, rtl_UriEncodeCheckEscapes,
- RTL_TEXTENCODING_UTF8)
- == aText2));
-
- // Check IURI handling:
-
- aText1 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%30%C3%BF"));
- aBuffer.appendAscii(RTL_CONSTASCII_STRINGPARAM("%30"));
- aBuffer.append(static_cast< sal_Unicode >(0x00FF));
- aText2 = aBuffer.makeStringAndClear();
- CPPUNIT_ASSERT_MESSAGE(
- "failure 18",
- (rtl::Uri::decode(aText1, rtl_UriDecodeToIuri, RTL_TEXTENCODING_UTF8)
- == aText2));
-
- // Check modified rtl_UriCharClassUnoParamValue (removed '[' and ']'):
-
- aText1 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("[]%5B%5D"));
- aText2 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%5B%5D%5B%5D"));
- CPPUNIT_ASSERT_MESSAGE(
- "failure 19",
- (rtl::Uri::encode(
- aText1, rtl_UriCharClassUnoParamValue, rtl_UriEncodeCheckEscapes,
- RTL_TEXTENCODING_ASCII_US)
- == aText2));
-
- // Check Uri::convertRelToAbs:
-
- struct RelToAbsTest
- {
- char const * pBase;
- char const * pRel;
- char const * pAbs;
- };
- static RelToAbsTest const aRelToAbsTest[]
- = { // The following tests are taken from RFC 2396:
- { "http://a/b/c/d;p?q", "g:h", "g:h" },
- { "http://a/b/c/d;p?q", "g", "http://a/b/c/g" },
- { "http://a/b/c/d;p?q", "./g", "http://a/b/c/g" },
- { "http://a/b/c/d;p?q", "g/", "http://a/b/c/g/" },
- { "http://a/b/c/d;p?q", "/g", "http://a/g" },
- { "http://a/b/c/d;p?q", "//g", "http://g" },
- { "http://a/b/c/d;p?q", "?y", "http://a/b/c/?y" },
- { "http://a/b/c/d;p?q", "g?y", "http://a/b/c/g?y" },
- { "http://a/b/c/d;p?q", "#s", "http://a/b/c/d;p?q#s" },
- { "http://a/b/c/d;p?q", "g#s", "http://a/b/c/g#s" },
- { "http://a/b/c/d;p?q", "g?y#s", "http://a/b/c/g?y#s" },
- { "http://a/b/c/d;p?q", ";x", "http://a/b/c/;x" },
- { "http://a/b/c/d;p?q", "g;x", "http://a/b/c/g;x" },
- { "http://a/b/c/d;p?q", "g;x?y#s", "http://a/b/c/g;x?y#s" },
- { "http://a/b/c/d;p?q", ".", "http://a/b/c/" },
- { "http://a/b/c/d;p?q", "./", "http://a/b/c/" },
- { "http://a/b/c/d;p?q", "..", "http://a/b/" },
- { "http://a/b/c/d;p?q", "../", "http://a/b/" },
- { "http://a/b/c/d;p?q", "../g", "http://a/b/g" },
- { "http://a/b/c/d;p?q", "../..", "http://a/" },
- { "http://a/b/c/d;p?q", "../../", "http://a/" },
- { "http://a/b/c/d;p?q", "../../g", "http://a/g" },
- { "http://a/b/c/d;p?q", "", "http://a/b/c/d;p?q" },
- { "http://a/b/c/d;p?q", "../../../g", "http://a/../g" },
- { "http://a/b/c/d;p?q", "../../../../g", "http://a/../../g" },
- { "http://a/b/c/d;p?q", "/./g", "http://a/./g" },
- { "http://a/b/c/d;p?q", "/../g", "http://a/../g" },
- { "http://a/b/c/d;p?q", "g.", "http://a/b/c/g." },
- { "http://a/b/c/d;p?q", ".g", "http://a/b/c/.g" },
- { "http://a/b/c/d;p?q", "g..", "http://a/b/c/g.." },
- { "http://a/b/c/d;p?q", "..g", "http://a/b/c/..g" },
- { "http://a/b/c/d;p?q", "./../g", "http://a/b/g" },
- { "http://a/b/c/d;p?q", "./g/.", "http://a/b/c/g/" },
- { "http://a/b/c/d;p?q", "g/./h", "http://a/b/c/g/h" },
- { "http://a/b/c/d;p?q", "g/../h", "http://a/b/c/h" },
- { "http://a/b/c/d;p?q", "g;x=1/./y", "http://a/b/c/g;x=1/y" },
- { "http://a/b/c/d;p?q", "g;x=1/../y", "http://a/b/c/y" },
- { "http://a/b/c/d;p?q", "g?y/./x", "http://a/b/c/g?y/./x" },
- { "http://a/b/c/d;p?q", "g?y/../x", "http://a/b/c/g?y/../x" },
- { "http://a/b/c/d;p?q", "g#s/./x", "http://a/b/c/g#s/./x" },
- { "http://a/b/c/d;p?q", "g#s/../x", "http://a/b/c/g#s/../x" },
- { "http://a/b/c/d;p?q", "http:g", "http:g" },
- { "http!://a/b/c/d;p?q", "g:h", "g:h" },
- { "http!://a/b/c/d;p?q", "g", 0 },
- { "http:b/c/d;p?q", "g:h", "g:h" },
- { "http:b/c/d;p?q", "g", 0 },
- { "http://a/b/../", "../c", "http://a/b/../../c" },
- { "http://a/b/..", "../c", "http://a/c" },
- { "http://a/./b/", ".././.././../c", "http://a/./../../c" } };
- for (std::size_t i = 0; i < sizeof aRelToAbsTest / sizeof (RelToAbsTest); ++i)
- {
- rtl::OUString aAbs;
- bool bMalformed = false;
- try {
- aAbs = rtl::Uri::convertRelToAbs(
- rtl::OUString::createFromAscii(aRelToAbsTest[i].pBase),
- rtl::OUString::createFromAscii(aRelToAbsTest[i].pRel));
- } catch (const rtl::MalformedUriException &) {
- bMalformed = true;
- }
- if (bMalformed
- ? aRelToAbsTest[i].pAbs != 0
- : (aRelToAbsTest[i].pAbs == 0
- || !aAbs.equalsAscii(aRelToAbsTest[i].pAbs)))
- {
- printf(
- "FAILED convertRelToAbs(%s, %s) -> %s != %s\n",
- aRelToAbsTest[i].pBase, aRelToAbsTest[i].pRel,
- (bMalformed
- ? "<MALFORMED>"
- : rtl::OUStringToOString(
- aAbs, RTL_TEXTENCODING_UTF8).getStr()),
- (aRelToAbsTest[i].pAbs == 0
- ? "<MALFORMED>" : aRelToAbsTest[i].pAbs));
- CPPUNIT_ASSERT(false);
- }
- }
-
- // Check encode with unusual text encodings:
-
- {
- sal_Unicode const aText1U[] = { ' ', '!', 0x0401, 0x045F, 0 };
- aText1 = rtl::OUString(aText1U);
- aText2 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%20!%A1%FF"));
- CPPUNIT_ASSERT_MESSAGE(
- "failure 20",
- (rtl::Uri::encode(
- aText1, rtl_UriCharClassUric, rtl_UriEncodeIgnoreEscapes,
- RTL_TEXTENCODING_ISO_8859_5)
- == aText2));
- CPPUNIT_ASSERT_MESSAGE(
- "failure 20a",
- (rtl::Uri::decode(
- aText2, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_ISO_8859_5)
- == aText1));
- }
- {
- sal_Unicode const aText1U[] = { ' ', '!', 0x0401, 0x0700, 0x045F, 0 };
- aText1 = rtl::OUString(aText1U);
- sal_Unicode const aText2U[] = {
- '%', '2', '0', '!', '%', 'A', '1', 0x0700, '%', 'F', 'F', 0 };
- aText2 = rtl::OUString(aText2U);
- CPPUNIT_ASSERT_MESSAGE(
- "failure 21",
- (rtl::Uri::encode(
- aText1, rtl_UriCharClassUric, rtl_UriEncodeIgnoreEscapes,
- RTL_TEXTENCODING_ISO_8859_5)
- == aText2));
- CPPUNIT_ASSERT_MESSAGE(
- "failure 21a",
- (rtl::Uri::decode(
- aText2, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_ISO_8859_5)
- == aText1));
- }
- {
- sal_Unicode const aText1U[] = { ' ', '!', 0x028A, 0xD849, 0xDD13, 0 };
- aText1 = rtl::OUString(aText1U);
- aText2 = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("%20!%81%30%B1%33%95%39%C5%37"));
- CPPUNIT_ASSERT_MESSAGE(
- "failure 22",
- (rtl::Uri::encode(
- aText1, rtl_UriCharClassUric, rtl_UriEncodeIgnoreEscapes,
- RTL_TEXTENCODING_GB_18030)
- == aText2));
- CPPUNIT_ASSERT_MESSAGE(
- "failure 22a",
- (rtl::Uri::decode(
- aText2, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_GB_18030)
- == aText1));
- }
-
- // Check strict mode:
-
- {
- sal_Unicode const aText1U[] = { ' ', '!', 0x0401, 0x0700, 0x045F, 0 };
- aText1 = rtl::OUString(aText1U);
- aText2 = rtl::OUString();
- CPPUNIT_ASSERT_MESSAGE(
- "failure 23",
- (rtl::Uri::encode(
- aText1, rtl_UriCharClassUric, rtl_UriEncodeStrict,
- RTL_TEXTENCODING_ISO_8859_5)
- == aText2));
- }
- {
- aText1 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%20%C4%80%FF"));
- aText2 = rtl::OUString();
- CPPUNIT_ASSERT_MESSAGE(
- "failure 24",
- (rtl::Uri::decode(
- aText1, rtl_UriDecodeStrict, RTL_TEXTENCODING_UTF8)
- == aText2));
- }
- {
- aText1 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%81 "));
- aText2 = rtl::OUString();
- CPPUNIT_ASSERT_MESSAGE(
- "failure 25",
- (rtl::Uri::decode(
- aText1, rtl_UriDecodeStrict, RTL_TEXTENCODING_GB_18030)
- == aText2));
- }
- {
- aText1 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%81%20"));
- aText2 = rtl::OUString();
- CPPUNIT_ASSERT_MESSAGE(
- "failure 26",
- (rtl::Uri::decode(
- aText1, rtl_UriDecodeStrict, RTL_TEXTENCODING_GB_18030)
- == aText2));
- }
- {
- aText1 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%81%30%B1%33"));
- sal_Unicode const aText2U[] = { 0x028A, 0 };
- aText2 = rtl::OUString(aText2U);
- CPPUNIT_ASSERT_MESSAGE(
- "failure 27",
- (rtl::Uri::decode(
- aText1, rtl_UriDecodeStrict, RTL_TEXTENCODING_GB_18030)
- == aText2));
- }
- {
- aText1 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%810%B13"));
- sal_Unicode const aText2U[] = { 0x028A, 0 };
- aText2 = rtl::OUString(aText2U);
- CPPUNIT_ASSERT_MESSAGE(
- "failure 28",
- (rtl::Uri::decode(
- aText1, rtl_UriDecodeStrict, RTL_TEXTENCODING_GB_18030)
- == aText2));
- }
-
- // Check rtl_UriEncodeStrictKeepEscapes mode:
-
- {
- aText1 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%%ea%c3%aa"));
- aText2 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%25%EA%C3%AA"));
- CPPUNIT_ASSERT_MESSAGE(
- "failure 29",
- (rtl::Uri::encode(
- aText1, rtl_UriCharClassUric, rtl_UriEncodeStrictKeepEscapes,
- RTL_TEXTENCODING_UTF8)
- == aText2));
- }
- {
- sal_Unicode const aText1U[] = { 0x00EA, 0 };
- aText1 = rtl::OUString(aText1U);
- aText2 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%C3%AA"));
- CPPUNIT_ASSERT_MESSAGE(
- "failure 30",
- (rtl::Uri::encode(
- aText1, rtl_UriCharClassUric, rtl_UriEncodeStrictKeepEscapes,
- RTL_TEXTENCODING_UTF8)
- == aText2));
- }
- {
- sal_Unicode const aText1U[] = { ' ', '!', 0x0401, 0x0700, 0x045F, 0 };
- aText1 = rtl::OUString(aText1U);
- aText2 = rtl::OUString();
- CPPUNIT_ASSERT_MESSAGE(
- "failure 23",
- (rtl::Uri::encode(
- aText1, rtl_UriCharClassUric, rtl_UriEncodeStrictKeepEscapes,
- RTL_TEXTENCODING_ISO_8859_5)
- == aText2));
- }
-}
-
-}
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "rtl_testuri");
-NOADDITIONAL;
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/uuid/makefile.mk b/sal/qa/rtl/uuid/makefile.mk
deleted file mode 100644
index ff1dc961f..000000000
--- a/sal/qa/rtl/uuid/makefile.mk
+++ /dev/null
@@ -1,67 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-INCPRE+= $(PRJ)$/qa$/inc
-
-PRJNAME=sal
-TARGET=rtl_uuid
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
-
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-
-# BEGIN ----------------------------------------------------------------
-# auto generated Target:joblist by codegen.pl
-SHL1OBJS= \
- $(SLO)$/rtl_Uuid.obj
-
-SHL1TARGET= rtl_Uuid
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-# SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME =$(SHL1TARGET)
-# DEF1EXPORTFILE= export.exp
-SHL1VERSIONMAP= $(PRJ)$/qa$/export.map
-# END ------------------------------------------------------------------
-#------------------------------- All object files -------------------------------
-# do this here, so we get right dependencies
-SLOFILES=$(SHL1OBJS)
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
diff --git a/sal/qa/rtl/uuid/rtl_Uuid.cxx b/sal/qa/rtl/uuid/rtl_Uuid.cxx
deleted file mode 100644
index 26018ef88..000000000
--- a/sal/qa/rtl/uuid/rtl_Uuid.cxx
+++ /dev/null
@@ -1,231 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
- /*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-#include <math.h>
-#include <stdio.h>
-
-#include <testshl/simpleheader.hxx>
-#include <rtl/uuid.h>
-#include <rtl/ustring.h>
-#include <rtl/ustring.hxx>
-
-#ifdef UNX
-#include <unistd.h>
-#include <time.h>
-#endif
-
-using ::rtl::OUString;
-using ::rtl::OUStringToOString;
-using ::rtl::OString;
-/** print a UNI_CODE String. And also print some comments of the string.
-*/
-inline void printUString( const ::rtl::OUString & str, const sal_Char * msg = "" )
-{
- t_print("#%s #printUString_u# ", msg );
- rtl::OString aString;
- aString = ::rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US );
- t_print("%s\n", (char *)aString.getStr( ) );
-}
-
-/************************************************************************
- * For diagnostics( from sal/test/testuuid.cxx )
- ************************************************************************/
-
-void printUuid( sal_uInt8 *pNode )
-{
- for( sal_Int32 i1 = 0 ; i1 < 4 ; i1++ )
- {
- for( sal_Int32 i2 = 0 ; i2 < 4 ; i2++ )
- {
- printf( "%02x" , pNode[i1*4 +i2] );
- }
- if( i1 == 3 )
- break;
- printf( "-" );
- }
-
- printf( "\n# " );
-}
-
-namespace rtl_Uuid
-{
-class createUuid : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
-#define TEST_UUID 20
- void createUuid_001()
- {
- sal_uInt8 aNode[TEST_UUID][16];
- sal_Int32 i,i2;
- for( i = 0 ; i < TEST_UUID ; i ++ )
- {
- rtl_createUuid( aNode[i], 0, sal_False );
- }
- sal_Bool bRes = sal_True;
- for( i = 0 ; i < TEST_UUID ; i ++ )
- {
- for( i2 = i+1 ; i2 < TEST_UUID ; i2 ++ )
- {
- if ( rtl_compareUuid( aNode[i] , aNode[i2] ) == 0 )
- {
- bRes = sal_False;
- break;
- }
- }
- if ( bRes == sal_False )
- break;
- }
- CPPUNIT_ASSERT_MESSAGE("createUuid: every uuid must be different.", bRes == sal_True );
- }
- /*
- void createUuid_002()
- {
- sal_uInt8 pNode[16];
- sal_uInt8 aNode[TEST_UUID][16];
- sal_Int32 i,i2;
- for( i = 0 ; i < TEST_UUID ; i ++ )
- {
- rtl_createUuid( aNode[i], pNode, sal_True );
- }
- sal_Bool bRes = sal_True;
- for( i = 0 ; i < TEST_UUID ; i ++ )
- {
- //printUuid( aNode[i] );
- for( i2 = i+1 ; i2 < TEST_UUID ; i2 ++ )
- {
- if ( rtl_compareUuid( aNode[i] , aNode[i2] ) == 0 )
- {
- bRes = sal_False;
- break;
- }
- }
- if ( bRes == sal_False )
- break;
- }
- CPPUNIT_ASSERT_MESSAGE("createUuid: every uuid must be different.", bRes == sal_True );
- }*/
-
- CPPUNIT_TEST_SUITE(createUuid);
- CPPUNIT_TEST(createUuid_001);
- //CPPUNIT_TEST(createUuid_002);
- CPPUNIT_TEST_SUITE_END();
-}; // class createUuid
-
-namespace ThreadHelper
-{
- void thread_sleep(sal_Int32 _nSec)
- {
-#ifdef WNT //Windows
- Sleep(_nSec * 10 );
-#endif
-#if ( defined UNX )
- sleep( _nSec );
-#endif
- }
-}
-
-class createNamedUuid : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
- void createNamedUuid_001()
- {
- sal_uInt8 NameSpace_DNS[16] = RTL_UUID_NAMESPACE_DNS;
- sal_uInt8 NameSpace_URL[16] = RTL_UUID_NAMESPACE_URL;
- sal_uInt8 pPriorCalculatedUUID[16] = {
- 0x52,0xc9,0x30,0xa5,
- 0xd1,0x61,0x3b,0x16,
- 0x98,0xc5,0xf8,0xd1,
- 0x10,0x10,0x6d,0x4d };
-
- sal_uInt8 pNamedUUID[16], pNamedUUID2[16];
-
- // Same name does generate the same uuid
- rtl_String *pName = 0;
- rtl_string_newFromStr( &pName , "this is a bla.blubs.DNS-Name" );
- rtl_createNamedUuid( pNamedUUID , NameSpace_DNS , pName );
- rtl_createNamedUuid( pNamedUUID2 , NameSpace_DNS , pName );
- CPPUNIT_ASSERT_MESSAGE( "Same name should generate the same uuid", ! memcmp( pNamedUUID , pNamedUUID2 , 16 ) && rtl_compareUuid( pNamedUUID , pNamedUUID2 ) == 0 );
- CPPUNIT_ASSERT_MESSAGE( "Same name should generate the same uuid", ! memcmp( pNamedUUID , pPriorCalculatedUUID , 16 ) );
-
- // Different names does not generate the same uuid
- rtl_string_newFromStr( &pName , "this is a bla.blubs.DNS-Namf" );
- rtl_createNamedUuid( pNamedUUID2 , NameSpace_DNS , pName );
- CPPUNIT_ASSERT_MESSAGE("Different names does not generate the same uuid.", memcmp( pNamedUUID , pNamedUUID2 , 16 ) );
-
- // the same name with different namespace uuid produces different uuids
- rtl_createNamedUuid( pNamedUUID , NameSpace_URL , pName );
- CPPUNIT_ASSERT_MESSAGE( " same name with different namespace uuid produces different uuids", memcmp( pNamedUUID , pNamedUUID2 , 16 ) && rtl_compareUuid( pNamedUUID , pNamedUUID2 ) != 0);
-
- //test compareUuid
- if ( rtl_compareUuid( pNamedUUID , pNamedUUID2 ) > 0 )
- { CPPUNIT_ASSERT_MESSAGE( " compare uuids", rtl_compareUuid( pNamedUUID2 , pNamedUUID ) < 0);
- }
- else
- CPPUNIT_ASSERT_MESSAGE( " compare uuids", rtl_compareUuid( pNamedUUID2 , pNamedUUID ) > 0);
-
- rtl_string_release( pName );
- }
-
- CPPUNIT_TEST_SUITE(createNamedUuid);
- CPPUNIT_TEST(createNamedUuid_001);
- CPPUNIT_TEST_SUITE_END();
-}; // class createNamedUuid
-
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Uuid::createUuid, "rtl_Uuid");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Uuid::createNamedUuid, "rtl_Uuid");
-} // namespace rtl_Uuid
-
-// -----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-NOADDITIONAL;
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */