summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
Diffstat (limited to 'sal')
-rw-r--r--sal/cppunittester/makefile.mk7
-rw-r--r--sal/inc/osl/thread.h12
-rw-r--r--sal/inc/osl/thread.hxx3
-rw-r--r--sal/inc/rtl/malformeduriexception.hxx4
-rw-r--r--sal/inc/rtl/math.h8
-rw-r--r--sal/inc/sal/cppunit.h45
-rw-r--r--sal/inc/sal/types.h2
-rw-r--r--sal/osl/all/makefile.mk6
-rw-r--r--sal/osl/all/printtrace.cxx65
-rw-r--r--sal/osl/inc/printtrace.h46
-rw-r--r--sal/osl/os2/diagnose.c26
-rw-r--r--sal/osl/os2/system.h3
-rw-r--r--sal/osl/os2/thread.c4
-rw-r--r--sal/osl/unx/diagnose.c33
-rw-r--r--sal/osl/unx/nlsupport.c4
-rw-r--r--sal/osl/unx/pipe.c2
-rw-r--r--sal/osl/unx/process_impl.cxx4
-rw-r--r--sal/osl/unx/thread.c16
-rwxr-xr-x[-rw-r--r--]sal/osl/w32/diagnose.c36
-rwxr-xr-x[-rw-r--r--]sal/osl/w32/thread.c25
-rw-r--r--sal/prj/build.lst3
-rw-r--r--sal/qa/OStringBuffer/makefile.mk2
-rw-r--r--sal/qa/OStringBuffer/rtl_OStringBuffer.cxx30
-rw-r--r--sal/qa/OStringBuffer/rtl_String_Const.h6
-rw-r--r--sal/qa/osl/pipe/makefile.mk2
-rw-r--r--sal/qa/osl/pipe/osl_Pipe.cxx87
-rw-r--r--sal/qa/osl/profile/makefile.mk1
-rw-r--r--sal/qa/osl/setthreadname/makefile.mk57
-rwxr-xr-xsal/qa/osl/setthreadname/test-setthreadname.cxx87
-rw-r--r--sal/qa/osl/setthreadname/version.map34
-rwxr-xr-xsal/qa/rtl/crc32/makefile.mk2
-rw-r--r--sal/qa/rtl/doublelock/makefile.mk2
-rw-r--r--sal/qa/rtl/locale/makefile.mk2
-rw-r--r--sal/qa/rtl/math/export.exp1
-rw-r--r--sal/qa/rtl/math/makefile.mk83
-rw-r--r--sal/qa/rtl/math/rtl_math.cxx628
-rw-r--r--sal/qa/rtl/math/rtl_old_testint64.cxx124
-rw-r--r--sal/qa/rtl/math/test-rtl-math.cxx76
-rw-r--r--sal/qa/rtl/math/test_rtl_math.cxx677
-rw-r--r--sal/qa/rtl_strings/makefile.mk1
-rw-r--r--sal/rtl/source/math.cxx2
-rw-r--r--sal/systools/win32/uwinapi/ResolveUnicows.cpp5
-rwxr-xr-xsal/util/sal.map1
43 files changed, 596 insertions, 1668 deletions
diff --git a/sal/cppunittester/makefile.mk b/sal/cppunittester/makefile.mk
index 938b63d90ae9..61fe7868c9f3 100644
--- a/sal/cppunittester/makefile.mk
+++ b/sal/cppunittester/makefile.mk
@@ -33,6 +33,13 @@ ENABLE_EXCEPTIONS = TRUE
.INCLUDE: settings.mk
+#building with stlport, but cppunit was not built with stlport
+.IF "$(USE_SYSTEM_STL)"!="YES"
+.IF "$(SYSTEM_CPPUNIT)"=="YES"
+CFLAGSCXX+=-DADAPT_EXT_STL
+.ENDIF
+.ENDIF
+
CFLAGSCXX += $(CPPUNIT_CFLAGS)
OBJFILES = $(APP1OBJS)
diff --git a/sal/inc/osl/thread.h b/sal/inc/osl/thread.h
index 1b160f09eef9..14b4cbfd8b7e 100644
--- a/sal/inc/osl/thread.h
+++ b/sal/inc/osl/thread.h
@@ -160,6 +160,18 @@ sal_Bool SAL_CALL osl_scheduleThread(oslThread Thread);
*/
void SAL_CALL osl_yieldThread(void);
+/** Attempts to set the name of the current thread.
+
+ The name of a thread is usually evaluated for debugging purposes. Not all
+ platforms support this. On Linux, a set thread name can be observed with
+ "ps -L". On Windows with the Microsoft compiler, a thread name set while a
+ debugger is attached can be observed within the debugger.
+
+ @param name the name of the thread; must not be null; on Linux, only the
+ first 16 characters are used
+*/
+void SAL_CALL osl_setThreadName(char const * name);
+
/* Callback when data stored in a thread key is no longer needed */
typedef void (SAL_CALL *oslThreadKeyCallbackFunction)(void *);
diff --git a/sal/inc/osl/thread.hxx b/sal/inc/osl/thread.hxx
index 923c68ecd41d..2bcc82fd07eb 100644
--- a/sal/inc/osl/thread.hxx
+++ b/sal/inc/osl/thread.hxx
@@ -151,6 +151,9 @@ public:
osl_yieldThread();
}
+ static inline void setName(char const * name) throw () {
+ osl_setThreadName(name);
+ }
virtual sal_Bool SAL_CALL schedule()
{
diff --git a/sal/inc/rtl/malformeduriexception.hxx b/sal/inc/rtl/malformeduriexception.hxx
index e67e3187e5a0..a119e44f601d 100644
--- a/sal/inc/rtl/malformeduriexception.hxx
+++ b/sal/inc/rtl/malformeduriexception.hxx
@@ -54,8 +54,8 @@ public:
inline SAL_EXCEPTION_DLLPRIVATE ~MalformedUriException() {}
inline SAL_EXCEPTION_DLLPRIVATE MalformedUriException operator =(
- MalformedUriException const & other)
- { m_aMessage = other.m_aMessage; return *this; }
+ MalformedUriException const & rOther)
+ { m_aMessage = rOther.m_aMessage; return *this; }
/** Get the message.
diff --git a/sal/inc/rtl/math.h b/sal/inc/rtl/math.h
index dc51d9900ff8..26a1029095b1 100644
--- a/sal/inc/rtl/math.h
+++ b/sal/inc/rtl/math.h
@@ -320,7 +320,9 @@ void SAL_CALL rtl_math_doubleToUString(rtl_uString ** pResult,
@param pParsedEnd
If non-null, returns one past the position of the last character parsed
away. Thus if [pBegin..pEnd) only contains the numerical string to be
- parsed, *pParsedEnd == pEnd on return.
+ parsed, *pParsedEnd == pEnd on return. If no numerical (sub-)string is
+ found, *pParsedEnd == pBegin on return, even if there was leading
+ whitespace.
*/
double SAL_CALL rtl_math_stringToDouble(
sal_Char const * pBegin, sal_Char const * pEnd, sal_Char cDecSeparator,
@@ -358,7 +360,9 @@ double SAL_CALL rtl_math_stringToDouble(
@param pParsedEnd
If non-null, returns one past the position of the last character parsed
away. Thus if [pBegin..pEnd) only contains the numerical string to be
- parsed, *pParsedEnd == pEnd on return.
+ parsed, *pParsedEnd == pEnd on return. If no numerical (sub-)string is
+ found, *pParsedEnd == pBegin on return, even if there was leading
+ whitespace.
*/
double SAL_CALL rtl_math_uStringToDouble(
sal_Unicode const * pBegin, sal_Unicode const * pEnd,
diff --git a/sal/inc/sal/cppunit.h b/sal/inc/sal/cppunit.h
new file mode 100644
index 000000000000..cd6645b51aee
--- /dev/null
+++ b/sal/inc/sal/cppunit.h
@@ -0,0 +1,45 @@
+/* -*- 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.
+ *
+ ************************************************************************/
+
+#ifndef _SAL_CPPUNIT_H_
+#define _SAL_CPPUNIT_H_
+
+#include <sal/types.h>
+
+#include "preextstl.h"
+#include <cppunit/TestAssert.h>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+#undef CPPUNIT_PLUGIN_EXPORT
+#define CPPUNIT_PLUGIN_EXPORT extern "C" SAL_DLLPUBLIC_EXPORT
+#include "postextstl.h"
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/inc/sal/types.h b/sal/inc/sal/types.h
index fdaaab18ba1e..d33e545dbac7 100644
--- a/sal/inc/sal/types.h
+++ b/sal/inc/sal/types.h
@@ -297,7 +297,7 @@ typedef void * sal_Handle;
These macros are used for inline declarations of exception classes, as in
rtl/malformeduriexception.hxx.
*/
-#if defined __GNUC__
+#if defined(__GNUC__) && ! defined(__MINGW32__)
#define SAL_EXCEPTION_DLLPUBLIC_EXPORT SAL_DLLPUBLIC_EXPORT
#define SAL_EXCEPTION_DLLPRIVATE SAL_DLLPRIVATE
#else
diff --git a/sal/osl/all/makefile.mk b/sal/osl/all/makefile.mk
index 84edd954dc48..2d1b7ec822f8 100644
--- a/sal/osl/all/makefile.mk
+++ b/sal/osl/all/makefile.mk
@@ -55,13 +55,15 @@ SLOFILES= \
$(SLO)$/utility.obj\
$(SLO)$/filepath.obj\
$(SLO)$/debugbase.obj\
- $(SLO)$/loadmodulerelative.obj
+ $(SLO)$/loadmodulerelative.obj \
+ $(SLO)/printtrace.obj
OBJFILES= \
$(OBJ)$/utility.obj\
$(OBJ)$/filepath.obj\
$(OBJ)$/debugbase.obj\
- $(OBJ)$/loadmodulerelative.obj
+ $(OBJ)$/loadmodulerelative.obj \
+ $(OBJ)/printtrace.obj
# --- Targets ------------------------------------------------------
diff --git a/sal/osl/all/printtrace.cxx b/sal/osl/all/printtrace.cxx
new file mode 100644
index 000000000000..5d79d9b1de5a
--- /dev/null
+++ b/sal/osl/all/printtrace.cxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+*
+* 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 "precompiled_sal.hxx"
+
+#include "sal/config.h"
+
+#include <cstdarg>
+#include <cstdio>
+#include <cstring>
+
+#include <stdio.h> // snprintf, vsnprintf
+
+#include "osl/diagnose.h"
+#include "osl/thread.hxx"
+#include "rtl/string.h"
+#include "sal/types.h"
+
+#include "printtrace.h"
+
+void printTrace(unsigned long pid, char const * format, std::va_list arguments)
+{
+ char buf[1024];
+ int n1 = snprintf(
+ buf, sizeof buf, "Trace %lu/%" SAL_PRIuUINT32 ": \"", pid,
+ osl::Thread::getCurrentIdentifier());
+ OSL_ASSERT(
+ n1 >= 0 &&
+ (static_cast< unsigned int >(n1) <
+ sizeof buf - RTL_CONSTASCII_LENGTH("\"...\n")));
+ int n2 = sizeof buf - n1 - RTL_CONSTASCII_LENGTH("\"...\n");
+ int n3 = vsnprintf(buf + n1, n2, format, arguments);
+ if (n3 < 0) {
+ std::strcpy(buf + n1, "\"???\n");
+ } else if (n3 < n2) {
+ std::strcpy(buf + n1 + n3, "\"\n");
+ } else {
+ std::strcpy(buf + n1 + n2 - 1, "\"...\n");
+ }
+ std::fputs(buf, stderr);
+}
diff --git a/sal/osl/inc/printtrace.h b/sal/osl/inc/printtrace.h
new file mode 100644
index 000000000000..9e1d514b0d08
--- /dev/null
+++ b/sal/osl/inc/printtrace.h
@@ -0,0 +1,46 @@
+/*************************************************************************
+*
+* 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.
+*
+************************************************************************/
+
+#ifndef INCLUDED_SAL_OSL_INC_PRINTTRACE_H
+#define INCLUDED_SAL_OSL_INC_PRINTTRACE_H
+
+#include "sal/config.h"
+
+#include <stdarg.h>
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+/* called internally by osl_trace */
+void printTrace(unsigned long pid, char const * format, va_list arguments);
+
+#if defined __cplusplus
+}
+#endif
+
+#endif
diff --git a/sal/osl/os2/diagnose.c b/sal/osl/os2/diagnose.c
index 538f8d3fb95a..999c304ae77e 100644
--- a/sal/osl/os2/diagnose.c
+++ b/sal/osl/os2/diagnose.c
@@ -36,6 +36,8 @@
#include <osl/diagnose.h>
#include <osl/thread.h>
+#include "printtrace.h"
+
BYTE oslTraceEnv[] = "OSL_TRACE_TO_FILE";
typedef pfunc_osl_printDebugMessage oslDebugMessageFunc;
@@ -54,29 +56,11 @@ void SAL_CALL osl_breakDebug()
/************************************************************************/
/* osl_trace */
/************************************************************************/
-/* comment this define to stop output thread identifier*/
-#define OSL_TRACE_THREAD 1
-void SAL_CALL osl_trace (
- const sal_Char* lpszFormat, ...)
-{
+void osl_trace(char const * pszFormat, ...) {
va_list args;
-
-#if defined(OSL_PROFILING)
- fprintf(stderr, "Time: %06lu : ", osl_getGlobalTimer() );
-#else
-#if defined(OSL_TRACE_THREAD)
- fprintf(stderr,"Thread: %6d :",osl_getThreadIdentifier(NULL));
-#else
- fprintf(stderr, "Trace Message: ");
-#endif
-#endif
-
- va_start(args, lpszFormat);
- vfprintf(stderr, lpszFormat, args);
+ va_start(args, pszFormat);
+ printTrace(0, pszFormat, args); /* TODO: pid */
va_end(args);
-
- fprintf(stderr,"\n");
- fflush(stderr);
}
/*----------------------------------------------------------------------------*/
diff --git a/sal/osl/os2/system.h b/sal/osl/os2/system.h
index 0782384a127f..fbff1e900df4 100644
--- a/sal/osl/os2/system.h
+++ b/sal/osl/os2/system.h
@@ -298,8 +298,7 @@ char *macxp_tempnam( const char *tmpdir, const char *prefix );
#if !defined(_WIN32) && !defined(OS2) && \
!defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD) && \
!defined(AIX) && \
- !defined(SOLARIS) && !defined(MAC) && \
- !defined(MACOSX)
+ !defined(SOLARIS) && !defined(MACOSX)
# error "Target plattform not specified !"
#endif
diff --git a/sal/osl/os2/thread.c b/sal/osl/os2/thread.c
index d4b01a98ad78..df66d354addc 100644
--- a/sal/osl/os2/thread.c
+++ b/sal/osl/os2/thread.c
@@ -550,6 +550,10 @@ void SAL_CALL osl_yieldThread()
DosSleep(0);
}
+void osl_setThreadName(char const * name) {
+ (void) name;
+}
+
typedef struct _TLS
{
PULONG pulPtr;
diff --git a/sal/osl/unx/diagnose.c b/sal/osl/unx/diagnose.c
index 83f4e90da733..36c9c0d5fec1 100644
--- a/sal/osl/unx/diagnose.c
+++ b/sal/osl/unx/diagnose.c
@@ -29,7 +29,6 @@
#include "osl/diagnose.h"
#include "system.h"
-
#ifndef HAVE_DLFCN_H
#if defined(LINUX) || defined(SOLARIS)
@@ -59,6 +58,8 @@
#define INCLUDED_STDDEF_H
#endif
+#include "printtrace.h"
+
/************************************************************************/
/* Internal data structures and functions */
/************************************************************************/
@@ -302,33 +303,11 @@ pfunc_osl_printDetailedDebugMessage SAL_CALL osl_setDetailedDebugMessageFunc (
/************************************************************************/
/* osl_trace */
/************************************************************************/
-/* comment this define to stop output thread identifier*/
-#define OSL_TRACE_THREAD 1
-void SAL_CALL osl_trace (
- const sal_Char* lpszFormat, ...)
-{
+void osl_trace(char const * pszFormat, ...) {
va_list args;
-
-#if defined(OSL_PROFILING)
- fprintf(stderr, "Time: %06lu : ", osl_getGlobalTimer() );
-#else
-#if defined(OSL_TRACE_THREAD)
- fprintf(
- stderr, "Thread: %6lu :",
- SAL_INT_CAST(unsigned long, osl_getThreadIdentifier(NULL)));
-#else
- fprintf(stderr, "Trace Message: ");
-#endif
-#endif
-
- va_start(args, lpszFormat);
- vfprintf(stderr, lpszFormat, args);
+ va_start(args, pszFormat);
+ printTrace((unsigned long) getpid(), pszFormat, args);
va_end(args);
-
- fprintf(stderr,"\n");
- fflush(stderr);
}
-/************************************************************************/
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
diff --git a/sal/osl/unx/nlsupport.c b/sal/osl/unx/nlsupport.c
index 543e499a00a1..481caaf399b4 100644
--- a/sal/osl/unx/nlsupport.c
+++ b/sal/osl/unx/nlsupport.c
@@ -879,9 +879,9 @@ void _imp_getProcessLocale( rtl_Locale ** ppLocale )
if ( NULL == locale )
{
- locale = (char *)malloc( 20 );
+ locale = (char *)malloc( 128 );
if ( locale )
- macosx_getLocale( locale, 20 );
+ macosx_getLocale( locale, 128 );
else
fprintf( stderr, "nlsupport.c: locale allocation returned NULL!\n" );
}
diff --git a/sal/osl/unx/pipe.c b/sal/osl/unx/pipe.c
index b2f01dd27374..e8ab52431744 100644
--- a/sal/osl/unx/pipe.c
+++ b/sal/osl/unx/pipe.c
@@ -482,7 +482,7 @@ sal_Int32 SAL_CALL osl_receivePipe(oslPipe pPipe,
(sal_Char*)pBuffer,
BytesToRead, 0);
- if ( nRet <= 0 )
+ if ( nRet < 0 )
{
OSL_TRACE("osl_receivePipe failed : %i '%s'",nRet,strerror(errno));
}
diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx
index 941a87776519..ac043339b899 100644
--- a/sal/osl/unx/process_impl.cxx
+++ b/sal/osl/unx/process_impl.cxx
@@ -408,10 +408,10 @@ oslProcessError SAL_CALL osl_clearEnvironment(rtl_uString* pustrEnvVar)
result = osl_Process_E_None;
else
rtl_string_release(pBuffer);
-#elif defined(MACOSX)
+#elif (defined(MACOSX) || defined(NETBSD) || defined(FREEBSD))
//MacOSX baseline is 10.4, which has an old-school void return
//for unsetenv.
- //See: http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/10.4/man3/unsetenv.3.html?useVersion=10.4
+ //See: http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/10.4/man3/unsetenv.3.html?useVersion=10.4
unsetenv(rtl_string_getStr(pstr_env_var));
result = osl_Process_E_None;
#else
diff --git a/sal/osl/unx/thread.c b/sal/osl/unx/thread.c
index 689b78dc748a..cf3d13e4b244 100644
--- a/sal/osl/unx/thread.c
+++ b/sal/osl/unx/thread.c
@@ -37,6 +37,10 @@
#include <rtl/textenc.h>
#include <sal/macros.h>
+#if defined LINUX
+#include <sys/prctl.h>
+#endif
+
/****************************************************************************
* @@@ TODO @@@
*
@@ -590,6 +594,18 @@ void SAL_CALL osl_yieldThread()
sched_yield();
}
+void SAL_CALL osl_setThreadName(char const * name) {
+#if defined LINUX
+ if (prctl(PR_SET_NAME, (unsigned long) name, 0, 0, 0) != 0) {
+ OSL_TRACE(
+ "%s prctl(PR_SET_NAME) failed with errno %d", OSL_LOG_PREFIX,
+ errno);
+ }
+#else
+ (void) name;
+#endif
+}
+
/*****************************************************************************/
/* osl_getThreadIdentifier @@@ see TODO @@@ */
/*****************************************************************************/
diff --git a/sal/osl/w32/diagnose.c b/sal/osl/w32/diagnose.c
index e9caaf2b504e..e25c60e8c886 100644..100755
--- a/sal/osl/w32/diagnose.c
+++ b/sal/osl/w32/diagnose.c
@@ -33,6 +33,8 @@
#include <osl/diagnose.h>
#include <osl/thread.h>
+#include "printtrace.h"
+
#define NO_DEBUG_CRT
static pfunc_osl_printDebugMessage _pPrintDebugMessage = NULL;
@@ -62,45 +64,21 @@ void SAL_CALL osl_breakDebug(void)
DebugBreak();
}
-
-
-/* Uncomment this define to get profiling time output */
-/* #define OSL_PROFILING */
-/* comment this define to stop output thread identifier*/
-#define OSL_TRACE_THREAD 1
-void SAL_CALL osl_trace(const sal_Char* lpszFormat, ...)
-{
+void osl_trace(char const * pszFormat, ...) {
va_list args;
-
- va_start(args, lpszFormat);
-
-#if defined(OSL_PROFILING)
- fprintf(stderr, "time : %06lu : ", osl_getGlobalTimer() );
-#else
-#if defined(OSL_TRACE_THREAD)
- fprintf(stderr,"Thread: %6d :",osl_getThreadIdentifier(NULL));
-#else
- fprintf(stderr,"Trace Message : ");
-#endif
-#endif
-
+ va_start(args, pszFormat);
if ( IsDebuggerPresent() )
{
sal_Char szMessage[512];
- int written = _vsnprintf( szMessage, sizeof(szMessage) - 2, lpszFormat, args );
+ int written = _vsnprintf(
+ szMessage, sizeof(szMessage) - 2, pszFormat, args );
if ( written == -1 )
written = sizeof(szMessage) - 2;
szMessage[ written++ ] = '\n';
szMessage[ written ] = 0;
OutputDebugString( szMessage );
}
-
- vfprintf(stderr,lpszFormat, args);
-
- fprintf(stderr,"\n");
-
- fflush(stderr);
-
+ printTrace((unsigned long) _getpid(), pszFormat, args);
va_end(args);
}
diff --git a/sal/osl/w32/thread.c b/sal/osl/w32/thread.c
index 92ac312d5a4e..02a67050083d 100644..100755
--- a/sal/osl/w32/thread.c
+++ b/sal/osl/w32/thread.c
@@ -395,6 +395,31 @@ void SAL_CALL osl_yieldThread(void)
Sleep(0);
}
+void SAL_CALL osl_setThreadName(char const * name) {
+#ifdef _MSC_VER
+ /* See <http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx>: */
+#pragma pack(push, 8)
+ struct {
+ DWORD dwType;
+ LPCSTR szName;
+ DWORD dwThreadID;
+ DWORD dwFlags;
+ } info;
+#pragma pack(pop)
+ info.dwType = 0x1000;
+ info.szName = name;
+ info.dwThreadID = (DWORD) -1;
+ info.dwFlags = 0;
+ __try {
+ RaiseException(
+ 0x406D1388, 0, sizeof info / sizeof (ULONG_PTR),
+ (ULONG_PTR *) &info);
+ } __except (EXCEPTION_EXECUTE_HANDLER) {}
+#else
+ (void) name;
+#endif
+}
+
typedef struct _TLS
{
DWORD dwIndex;
diff --git a/sal/prj/build.lst b/sal/prj/build.lst
index ddbc44673a49..dcbe44853026 100644
--- a/sal/prj/build.lst
+++ b/sal/prj/build.lst
@@ -17,12 +17,15 @@ sa sal\cppunittester nmake - all sa_cppunittester sa_cpprt.u sa_util NULL
sa sal\qa\ByteSequence nmake - all sa_qa_ByteSequence sa_cppunittester sa_util NULL
sa sal\qa\OStringBuffer nmake - all sa_qa_OStringBuffer sa_cppunittester sa_util NULL
sa sal\qa\osl\mutex nmake - all sa_qa_osl_mutex sa_cppunittester sa_util NULL
+sa sal\qa\osl\pipe nmake - all sa_qa_osl_pipe sa_cppunittester sa_util NULL
sa sal\qa\osl\profile nmake - all sa_qa_osl_profile sa_cppunittester sa_util NULL
sa sal\qa\osl\file nmake - u sa_qa_osl_file sa_cppunittester sa_util NULL
sa sal\qa\osl\module nmake - u sa_qa_osl_module sa_cppunittester sa_util NULL
sa sal\qa\osl\condition nmake - all sa_qa_osl_condition sa_cppunittester sa_util NULL
sa sal\qa\osl\security nmake - all sa_qa_osl_security sa_cppunittester sa_util NULL
sa sal\qa\osl\process nmake - all sa_qa_osl_process sa_cppunittester sa_util NULL
+sa sal\qa\osl\setthreadname nmake - all sa_qa_osl_setthreadname sa_cppunittester sa_util NULL
+sa sal\qa\rtl\math nmake - all sa_qa_rtl_math sa_cppunittester sa_util NULL
sa sal\qa\rtl\strings nmake - all sa_qa_rt_strings sa_cppunittester sa_util NULL
sa sal\qa\rtl\oustringbuffer nmake - all sa_qa_rt_oustringbuffer sa_cppunittester sa_util NULL
sa sal\qa\rtl\alloc nmake - all sa_qa_rt_alloc sa_cppunittester sa_util NULL
diff --git a/sal/qa/OStringBuffer/makefile.mk b/sal/qa/OStringBuffer/makefile.mk
index 297221bdc4d9..2b29878ec20a 100644
--- a/sal/qa/OStringBuffer/makefile.mk
+++ b/sal/qa/OStringBuffer/makefile.mk
@@ -29,8 +29,6 @@ PRJ=..$/..
PRJNAME=sal
TARGET=qa_ostringbuffer
-# this is removed at the moment because we need some enhancements
-# TESTDIR=TRUE
ENABLE_EXCEPTIONS=TRUE
diff --git a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
index fb49c34af41a..b01862f1bb86 100644
--- a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
+++ b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
@@ -14435,11 +14435,7 @@ namespace rtl_OStringBuffer
{
::rtl::OStringBuffer aStrBuf( *arrOUS[0] );
OString expVal( kTestStr116 );
-#if defined(UNX) || defined(OS2)
- sal_Int64 input = 9223372036854775807LL;
-#else
- sal_Int64 input = 9223372036854775807;
-#endif
+ sal_Int64 input = SAL_CONST_INT64(9223372036854775807);
aStrBuf.append( input );
CPPUNIT_ASSERT_MESSAGE
@@ -14519,11 +14515,7 @@ namespace rtl_OStringBuffer
{
::rtl::OStringBuffer aStrBuf( *arrOUS[1] );
OString expVal( kTestStr118 );
-#if defined(UNX) || defined(OS2)
- sal_Int64 input = 9223372036854775807LL;
-#else
- sal_Int64 input = 9223372036854775807;
-#endif
+ sal_Int64 input = SAL_CONST_INT64(9223372036854775807);
aStrBuf.append( input );
CPPUNIT_ASSERT_MESSAGE
@@ -14602,11 +14594,7 @@ namespace rtl_OStringBuffer
{
::rtl::OStringBuffer aStrBuf( *arrOUS[2] );
OString expVal( kTestStr118 );
-#if defined(UNX) || defined(OS2)
- sal_Int64 input = 9223372036854775807LL;
-#else
- sal_Int64 input = 9223372036854775807;
-#endif
+ sal_Int64 input = SAL_CONST_INT64(9223372036854775807);
aStrBuf.append( input );
CPPUNIT_ASSERT_MESSAGE
@@ -14685,11 +14673,7 @@ namespace rtl_OStringBuffer
{
::rtl::OStringBuffer aStrBuf( *arrOUS[3] );
OString expVal( kTestStr118 );
-#if defined(UNX) || defined(OS2)
- sal_Int64 input = 9223372036854775807LL;
-#else
- sal_Int64 input = 9223372036854775807;
-#endif
+ sal_Int64 input = SAL_CONST_INT64(9223372036854775807);
aStrBuf.append( input );
CPPUNIT_ASSERT_MESSAGE
@@ -14768,11 +14752,7 @@ namespace rtl_OStringBuffer
{
::rtl::OStringBuffer aStrBuf( *arrOUS[4] );
OString expVal( kTestStr120 );
-#if defined(UNX) || defined(OS2)
- sal_Int64 input = 9223372036854775807LL;
-#else
- sal_Int64 input = 9223372036854775807;
-#endif
+ sal_Int64 input = SAL_CONST_INT64(9223372036854775807);
aStrBuf.append( input );
CPPUNIT_ASSERT_MESSAGE
diff --git a/sal/qa/OStringBuffer/rtl_String_Const.h b/sal/qa/OStringBuffer/rtl_String_Const.h
index 7b9ad1c83f07..7841e4fd164c 100644
--- a/sal/qa/OStringBuffer/rtl_String_Const.h
+++ b/sal/qa/OStringBuffer/rtl_String_Const.h
@@ -317,11 +317,7 @@ static const sal_Int16 kSInt16Max = SHRT_MAX;
static const sal_Int32 kUInt16Max = USHRT_MAX;
static const sal_Int32 kSInt32Max = INT_MAX;
static const sal_Int64 kUInt32Max = UINT_MAX;
-#if defined(UNX) || defined(OS2)
-static const sal_Int64 kSInt64Max = 9223372036854775807LL;
-#else
-static const sal_Int64 kSInt64Max = 9223372036854775807;
-#endif
+static const sal_Int64 kSInt64Max = SAL_CONST_INT64(9223372036854775807);
//------------------------------------------------------------------------
diff --git a/sal/qa/osl/pipe/makefile.mk b/sal/qa/osl/pipe/makefile.mk
index fc6728abfe3b..8e91738d0669 100644
--- a/sal/qa/osl/pipe/makefile.mk
+++ b/sal/qa/osl/pipe/makefile.mk
@@ -51,7 +51,7 @@ SHL1OBJS= \
$(SLO)$/osl_Pipe.obj
SHL1TARGET= osl_Pipe
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
+SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTLIB)
SHL1IMPLIB= i$(SHL1TARGET)
# SHL1DEF= $(MISC)$/$(SHL1TARGET).def
diff --git a/sal/qa/osl/pipe/osl_Pipe.cxx b/sal/qa/osl/pipe/osl_Pipe.cxx
index 6edf247e5061..055c1440ecee 100644
--- a/sal/qa/osl/pipe/osl_Pipe.cxx
+++ b/sal/qa/osl/pipe/osl_Pipe.cxx
@@ -37,6 +37,7 @@
#include "cppunit/TestFixture.h"
#include "cppunit/extensions/HelperMacros.h"
#include "cppunit/plugin/TestPlugIn.h"
+#include "test/uniquepipename.hxx"
#include <sal/types.h>
#include <rtl/ustring.hxx>
@@ -184,8 +185,8 @@ namespace osl_Pipe
void ctors_name_option( )
{
/// create a named pipe.
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
- ::osl::Pipe aAssignPipe( aTestPipeName, osl_Pipe_OPEN );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
+ ::osl::Pipe aAssignPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN );
bRes = aPipe.is( ) && aAssignPipe.is( );
@@ -197,7 +198,7 @@ namespace osl_Pipe
{
/// create a security pipe.
const ::osl::Security rSecurity;
- ::osl::Pipe aSecurityPipe( aTestPipeName, osl_Pipe_CREATE, rSecurity );
+ ::osl::Pipe aSecurityPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSecurity );
bRes = aSecurityPipe.is( );
@@ -208,7 +209,7 @@ namespace osl_Pipe
void ctors_copy( )
{
/// create a pipe.
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
/// create a pipe using copy constructor.
::osl::Pipe aCopyPipe( aPipe );
@@ -231,7 +232,7 @@ namespace osl_Pipe
void ctors_no_acquire( )
{
/// create a pipe.
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
/// constructs a pipe reference without acquiring the handle.
::osl::Pipe aNoAcquirePipe( aPipe.getHandle( ), SAL_NO_ACQUIRE );
@@ -247,7 +248,7 @@ namespace osl_Pipe
void ctors_acquire( )
{
/// create a base pipe.
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
/// constructs two pipes without acquiring the handle on the base pipe.
::osl::Pipe aAcquirePipe( aPipe.getHandle( ) );
::osl::Pipe aAcquirePipe1( NULL );
@@ -285,14 +286,14 @@ namespace osl_Pipe
void is_002( )
{
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test is(), a normal pipe creation.", sal_True == aPipe.is( ) );
}
void is_003( )
{
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe.clear( );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test is(), an invalid case.", sal_False == aPipe.is( ) );
@@ -335,8 +336,8 @@ namespace osl_Pipe
{
const Security rSec;
::osl::Pipe aPipe;
- bRes = aPipe.create( aTestPipeName, osl_Pipe_CREATE, rSec );
- bRes1 = aPipe.create( aTestPipeName, osl_Pipe_CREATE, rSec );
+ bRes = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSec );
+ bRes1 = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSec );
aPipe.clear( );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test creation.",
@@ -347,8 +348,8 @@ namespace osl_Pipe
{
const Security rSec;
::osl::Pipe aPipe, aPipe1;
- bRes = aPipe.create( aTestPipeName, osl_Pipe_CREATE, rSec );
- bRes1 = aPipe1.create( aTestPipeName, osl_Pipe_OPEN, rSec );
+ bRes = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSec );
+ bRes1 = aPipe1.create( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN, rSec );
aPipe.clear( );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test creation and open.",
@@ -358,8 +359,8 @@ namespace osl_Pipe
void create_named_001( )
{
::osl::Pipe aPipe;
- bRes = aPipe.create( aTestPipeName, osl_Pipe_CREATE );
- bRes1 = aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ bRes = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
+ bRes1 = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe.clear( );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test creation.",
@@ -369,8 +370,8 @@ namespace osl_Pipe
void create_named_002( )
{
::osl::Pipe aPipe, aPipe1;
- bRes = aPipe.create( aTestPipeName, osl_Pipe_CREATE );
- bRes1 = aPipe1.create( aTestPipeName, osl_Pipe_OPEN );
+ bRes = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
+ bRes1 = aPipe1.create( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN );
aPipe.clear( );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test creation and open.",
@@ -380,7 +381,7 @@ namespace osl_Pipe
void create_named_003( )
{
::osl::Pipe aPipe;
- bRes = aPipe.create( aTestPipeName );
+ bRes = aPipe.create( test::uniquePipeName(aTestPipeName) );
aPipe.clear( );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test default option is open.",
@@ -408,7 +409,7 @@ namespace osl_Pipe
void clear_001( )
{
::osl::Pipe aPipe;
- aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe.clear( );
bRes = aPipe.is( );
@@ -434,7 +435,7 @@ namespace osl_Pipe
void assign_ref( )
{
::osl::Pipe aPipe, aPipe1;
- aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe1 = aPipe;
bRes = aPipe1.is( );
bRes1 = aPipe == aPipe1;
@@ -448,7 +449,7 @@ namespace osl_Pipe
void assign_handle( )
{
::osl::Pipe aPipe, aPipe1;
- aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe1 = aPipe.getHandle( );
bRes = aPipe1.is( );
bRes1 = aPipe == aPipe1;
@@ -498,7 +499,7 @@ namespace osl_Pipe
void isEqual_001( )
{
::osl::Pipe aPipe;
- aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
bRes = aPipe == aPipe;
aPipe.close( );
@@ -509,10 +510,10 @@ namespace osl_Pipe
void isEqual_002( )
{
::osl::Pipe aPipe, aPipe1, aPipe2;
- aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe1 = aPipe;
- aPipe2.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe2.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
bRes = aPipe == aPipe1;
bRes1 = aPipe == aPipe2;
@@ -541,7 +542,7 @@ namespace osl_Pipe
void close_001( )
{
- ::osl::Pipe aPipe( aTestPipe1, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipe1), osl_Pipe_CREATE );
aPipe.close( );
bRes = aPipe.is( );
@@ -554,7 +555,7 @@ namespace osl_Pipe
void close_002( )
{
- ::osl::StreamPipe aPipe( aTestPipe1, osl_Pipe_CREATE );
+ ::osl::StreamPipe aPipe( test::uniquePipeName(aTestPipe1), osl_Pipe_CREATE );
aPipe.close( );
int nRet = aPipe.send( m_pTestString1.getStr(), 3 );
@@ -622,7 +623,7 @@ namespace osl_Pipe
void getError_001( )
{
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_OPEN );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN );
oslPipeError nError = aPipe.getError( );
printPipeError( aPipe );
aPipe.clear( );
@@ -633,8 +634,8 @@ namespace osl_Pipe
void getError_002( )
{
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
- ::osl::Pipe aPipe1( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
+ ::osl::Pipe aPipe1( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
oslPipeError nError = aPipe.getError( );
printPipeError( aPipe );
aPipe.clear( );
@@ -661,7 +662,7 @@ namespace osl_Pipe
void getHandle_001( )
{
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_OPEN );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN );
bRes = aPipe == aPipe.getHandle( );
aPipe.clear( );
@@ -671,7 +672,7 @@ namespace osl_Pipe
void getHandle_002( )
{
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
::osl::Pipe aPipe1( aPipe.getHandle( ) );
bRes = aPipe == aPipe1;
aPipe.clear( );
@@ -724,7 +725,7 @@ namespace osl_StreamPipe
void ctors_none( )
{
// create a pipe.
- ::osl::StreamPipe aStreamPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::StreamPipe aStreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
// create an unattached pipe.
::osl::StreamPipe aStreamPipe1;
bRes = aStreamPipe1.is( );
@@ -742,7 +743,7 @@ namespace osl_StreamPipe
void ctors_handle( )
{
// create a pipe.
- ::osl::StreamPipe aStreamPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::StreamPipe aStreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
// create a pipe with last handle.
::osl::StreamPipe aStreamPipe1( aStreamPipe.getHandle( ) );
bRes = aStreamPipe1.is( ) && aStreamPipe == aStreamPipe1;
@@ -756,7 +757,7 @@ namespace osl_StreamPipe
void ctors_copy( )
{
// create a pipe.
- ::osl::StreamPipe aStreamPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::StreamPipe aStreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
// create an unattached pipe.
::osl::StreamPipe aStreamPipe1( aStreamPipe );
bRes = aStreamPipe1.is( ) && aStreamPipe == aStreamPipe1;
@@ -770,9 +771,9 @@ namespace osl_StreamPipe
void ctors_name_option( )
{
// create a pipe.
- ::osl::StreamPipe aStreamPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::StreamPipe aStreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
// create an unattached pipe.
- ::osl::StreamPipe aStreamPipe1( aTestPipeName, osl_Pipe_OPEN );
+ ::osl::StreamPipe aStreamPipe1( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN );
bRes = aStreamPipe1.is( ) && aStreamPipe.is( );
aStreamPipe.clear( );
aStreamPipe1.clear( );
@@ -785,7 +786,7 @@ namespace osl_StreamPipe
{
/// create a security pipe.
const ::osl::Security rSecurity;
- ::osl::StreamPipe aSecurityPipe( aTestPipeName, osl_Pipe_CREATE, rSecurity );
+ ::osl::StreamPipe aSecurityPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSecurity );
bRes = aSecurityPipe.is( );
aSecurityPipe.clear( );
@@ -807,7 +808,7 @@ namespace osl_StreamPipe
void ctors_no_acquire( )
{
// create a pipe.
- ::osl::StreamPipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::StreamPipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
// constructs a pipe reference without acquiring the handle.
::osl::StreamPipe aNoAcquirePipe( aPipe.getHandle( ), SAL_NO_ACQUIRE );
@@ -844,7 +845,7 @@ namespace osl_StreamPipe
void assign_ref( )
{
::osl::StreamPipe aPipe, aPipe1;
- aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe1 = aPipe;
bRes = aPipe1.is( );
bRes1 = aPipe == aPipe1;
@@ -857,7 +858,7 @@ namespace osl_StreamPipe
void assign_handle( )
{
- ::osl::StreamPipe * pPipe = new ::osl::StreamPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::StreamPipe * pPipe = new ::osl::StreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
::osl::StreamPipe * pAssignPipe = new ::osl::StreamPipe;
*pAssignPipe = pPipe->getHandle( );
@@ -912,7 +913,7 @@ namespace osl_StreamPipe
sal_Int32 nChars = 0;
printf("open pipe\n");
- ::osl::StreamPipe aSenderPipe( aTestPipeName, osl_Pipe_OPEN ); // aTestPipeName is a string = "TestPipe"
+ ::osl::StreamPipe aSenderPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN ); // test::uniquePipeName(aTestPipeName) is a string = "TestPipe"
if ( aSenderPipe.is() == sal_False )
{
printf("pipe open failed! \n");
@@ -945,13 +946,13 @@ namespace osl_StreamPipe
{
public:
sal_Char buf[256];
- //::osl::StreamPipe aListenPipe; //( aTestPipeName, osl_Pipe_CREATE );
+ //::osl::StreamPipe aListenPipe; //( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
::osl::Pipe aListenPipe;
::osl::StreamPipe aConnectionPipe;
Pipe_DataSource_Thread( )
{
printf("create pipe\n");
- aListenPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aListenPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
}
~Pipe_DataSource_Thread( )
{
@@ -962,7 +963,7 @@ namespace osl_StreamPipe
{
//create pipe.
sal_Int32 nChars;
- //::osl::StreamPipe aListenPipe( aTestPipeName, osl_Pipe_CREATE );
+ //::osl::StreamPipe aListenPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
printf("listen\n");
if ( aListenPipe.is() == sal_False )
{
diff --git a/sal/qa/osl/profile/makefile.mk b/sal/qa/osl/profile/makefile.mk
index 8379783e19f6..6f7d3e8d34cf 100644
--- a/sal/qa/osl/profile/makefile.mk
+++ b/sal/qa/osl/profile/makefile.mk
@@ -33,7 +33,6 @@ PRJ=..$/..$/..
PRJNAME=sal
TARGET=qa_osl_profile
-# TESTDIR=TRUE
ENABLE_EXCEPTIONS=TRUE
diff --git a/sal/qa/osl/setthreadname/makefile.mk b/sal/qa/osl/setthreadname/makefile.mk
new file mode 100644
index 000000000000..f2d9da15c468
--- /dev/null
+++ b/sal/qa/osl/setthreadname/makefile.mk
@@ -0,0 +1,57 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 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.
+#
+#***********************************************************************/
+
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+.ELSE
+
+PRJ = ..$/..$/..
+PRJNAME = sal
+TARGET = qa_osl_setthreadname
+
+ENABLE_EXCEPTIONS = TRUE
+
+.INCLUDE: settings.mk
+
+CFLAGSCXX += $(CPPUNIT_CFLAGS)
+
+DLLPRE =
+
+SHL1IMPLIB = i$(SHL1TARGET)
+SHL1OBJS = $(SLO)/test-setthreadname.obj
+SHL1RPATH = NONE
+SHL1STDLIBS = $(CPPUNITLIB) $(SALLIB)
+SHL1TARGET = test-setthreadname
+SHL1VERSIONMAP = version.map
+DEF1NAME = $(SHL1TARGET)
+
+SLOFILES = $(SHL1OBJS)
+
+.INCLUDE: target.mk
+.INCLUDE: _cppunit.mk
+
+.END
diff --git a/sal/qa/osl/setthreadname/test-setthreadname.cxx b/sal/qa/osl/setthreadname/test-setthreadname.cxx
new file mode 100755
index 000000000000..0f0f618395a8
--- /dev/null
+++ b/sal/qa/osl/setthreadname/test-setthreadname.cxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 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 "precompiled_sal.hxx"
+#include "sal/config.h"
+
+#include <cstdlib>
+#include <iostream>
+#include <limits>
+
+#include "boost/noncopyable.hpp"
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
+#include "cppunit/plugin/TestPlugIn.h"
+#include "osl/thread.hxx"
+
+namespace {
+
+class TestThread: public osl::Thread, private boost::noncopyable {
+private:
+ virtual void SAL_CALL run();
+};
+
+void TestThread::run() {
+#if defined WNT
+ if (std::getenv("URE_TEST_SETTHREADNAME") != 0) {
+ // On Windows, setting thread names appears to only take effect when the
+ // process is being debugged, so attach a debugger now:
+ std::cout << "set: ";
+ std::cin.ignore(std::numeric_limits< int >::max(), '\n');
+ }
+#endif
+ setName("TestThread");
+ if (std::getenv("URE_TEST_SETTHREADNAME") != 0) {
+ // On Linux, the thread name can now be observed with "ps -L"; on
+ // Windows with the Microsoft compiler, the thread name can now be
+ // observed in a debugger.
+ std::cout << "stop: ";
+ std::cin.ignore(std::numeric_limits< int >::max(), '\n');
+ }
+}
+
+class Test: public CppUnit::TestFixture {
+private:
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(test);
+ CPPUNIT_TEST_SUITE_END();
+
+ void test();
+};
+
+void Test::test() {
+ TestThread t;
+ t.create();
+ t.join();
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sal/qa/osl/setthreadname/version.map b/sal/qa/osl/setthreadname/version.map
new file mode 100644
index 000000000000..ef2ab497cb5e
--- /dev/null
+++ b/sal/qa/osl/setthreadname/version.map
@@ -0,0 +1,34 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 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.
+#
+#***********************************************************************/
+
+UDK_3_0_0 {
+ global:
+ cppunitTestPlugIn;
+
+ local:
+ *;
+};
diff --git a/sal/qa/rtl/crc32/makefile.mk b/sal/qa/rtl/crc32/makefile.mk
index b8b33a5cfa46..149e82eb81b7 100755
--- a/sal/qa/rtl/crc32/makefile.mk
+++ b/sal/qa/rtl/crc32/makefile.mk
@@ -28,8 +28,6 @@ PRJ=..$/..$/..
PRJNAME=sal
TARGET=qa_rtl_crc32
-# this is removed at the moment because we need some enhancements
-# TESTDIR=TRUE
ENABLE_EXCEPTIONS=TRUE
diff --git a/sal/qa/rtl/doublelock/makefile.mk b/sal/qa/rtl/doublelock/makefile.mk
index 50f65839a6ec..02283c9c1da0 100644
--- a/sal/qa/rtl/doublelock/makefile.mk
+++ b/sal/qa/rtl/doublelock/makefile.mk
@@ -28,8 +28,6 @@ PRJ=..$/..$/..
PRJNAME=sal
TARGET=qa_rtl_doublelock
-# this is removed at the moment because we need some enhancements
-# TESTDIR=TRUE
ENABLE_EXCEPTIONS=TRUE
diff --git a/sal/qa/rtl/locale/makefile.mk b/sal/qa/rtl/locale/makefile.mk
index 2256a7057eb2..32e1471eecdf 100644
--- a/sal/qa/rtl/locale/makefile.mk
+++ b/sal/qa/rtl/locale/makefile.mk
@@ -28,8 +28,6 @@ PRJ=..$/..$/..
PRJNAME=sal
TARGET=qa_rtl_locale
-# this is removed at the moment because we need some enhancements
-# TESTDIR=TRUE
ENABLE_EXCEPTIONS=TRUE
diff --git a/sal/qa/rtl/math/export.exp b/sal/qa/rtl/math/export.exp
deleted file mode 100644
index a13529da5876..000000000000
--- a/sal/qa/rtl/math/export.exp
+++ /dev/null
@@ -1 +0,0 @@
-registerAllTestFunction
diff --git a/sal/qa/rtl/math/makefile.mk b/sal/qa/rtl/math/makefile.mk
index a978849fd627..ffe8d6444846 100644
--- a/sal/qa/rtl/math/makefile.mk
+++ b/sal/qa/rtl/math/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# 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
@@ -23,74 +23,33 @@
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
#
-#*************************************************************************
-PRJ=..$/..$/..
-INCPRE+= $(PRJ)$/qa$/inc
-
-PRJNAME=sal
-TARGET=rtl_math
-# this is removed at the moment because we need some enhancements
-# TESTDIR=TRUE
+#***********************************************************************/
-ENABLE_EXCEPTIONS=TRUE
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+.ELSE
-# --- Settings -----------------------------------------------------
+PRJ = ../../..
+PRJNAME = sal
+TARGET = qa_rtl_profile
-.INCLUDE : settings.mk
+ENABLE_EXCEPTIONS = TRUE
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
+.INCLUDE: settings.mk
CFLAGSCXX += $(CPPUNIT_CFLAGS)
-#----------------------------------- OStringBuffer -----------------------------------
-
-SHL1OBJS= \
- $(SLO)$/test_rtl_math.obj
-
-SHL1TARGET= rtl_math
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-# SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME =$(SHL1TARGET)
-# DEF1EXPORTFILE= export.exp
-SHL1VERSIONMAP = $(PRJ)$/qa$/export.map
-
-# --- BEGIN --------------------------------------------------------
-SHL2OBJS= \
- $(SLO)$/rtl_math.obj
-SHL2TARGET= rtl_math2
-SHL2STDLIBS= $(SALLIB) $(CPPUNITLIB)
-
-SHL2IMPLIB= i$(SHL2TARGET)
-DEF2NAME= $(SHL2TARGET)
-SHL2VERSIONMAP = $(PRJ)$/qa$/export.map
+SHL1IMPLIB = i$(SHL1TARGET)
+SHL1OBJS = $(SLO)/test-rtl-math.obj
+SHL1RPATH = NONE
+SHL1STDLIBS = $(CPPUNITLIB) $(SALLIB)
+SHL1TARGET = test-rtl-math
+SHL1VERSIONMAP = $(PRJ)/qa/export.map
+DEF1NAME = $(SHL1TARGET)
+SLOFILES = $(SHL1OBJS)
-
-# # --- BEGIN --------------------------------------------------------
-# LLA: this is an old test, which seems not to work
-# sal_setInt64()
-# sal_getInt64()
-# does not exist.
-#
-# SHL3OBJS= \
-# $(SLO)$/rtl_old_testint64.obj
-# SHL3TARGET= rtl_old_testint64
-# SHL3STDLIBS= $(SALLIB) $(CPPUNITLIB)
-#
-# SHL3IMPLIB= i$(SHL3TARGET)
-# DEF3NAME= $(SHL3TARGET)
-# SHL3VERSIONMAP = $(PRJ)$/qa$/export.map
-#
-
-#------------------------------- All object files -------------------------------
-# do this here, so we get right dependencies
-# SLOFILES=$(SHL1OBJS)
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
+.INCLUDE: target.mk
.INCLUDE : $(PRJ)$/qa$/cppunit_local.mk
+
+.END \ No newline at end of file
diff --git a/sal/qa/rtl/math/rtl_math.cxx b/sal/qa/rtl/math/rtl_math.cxx
deleted file mode 100644
index 3391dbe2784e..000000000000
--- a/sal/qa/rtl/math/rtl_math.cxx
+++ /dev/null
@@ -1,628 +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 <testshl/simpleheader.hxx>
-#include <rtl/math.h>
-#include <rtl/string.hxx>
-
-#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_NAMED_REGISTRATION(rtl_math::test, "rtl_math");
-} // 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.
-NOADDITIONAL;
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/math/rtl_old_testint64.cxx b/sal/qa/rtl/math/rtl_old_testint64.cxx
deleted file mode 100644
index 2e17c241a4de..000000000000
--- a/sal/qa/rtl/math/rtl_old_testint64.cxx
+++ /dev/null
@@ -1,124 +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
-
-// fndef _OSL_DIAGNOSE_H_
-// nclude <osl/diagnose.h>
-// #endif
-
-#include <sal/types.h>
-
-#define TEST_ENSURE(c, m) CPPUNIT_ASSERT_MESSAGE((m), (c))
-
-// #if OSL_DEBUG_LEVEL > 0
-// #define TEST_ENSURE(c, m) OSL_ENSURE(c, m)
-// #else
-// #define TEST_ENSURE(c, m) OSL_VERIFY(c)
-// #endif
-
-#include <testshl/simpleheader.hxx>
-
-// -----------------------------------------------------------------------------
-namespace rtl_math
-{
- class int64 : public CppUnit::TestFixture
- {
- public:
- void test_int64();
-
- CPPUNIT_TEST_SUITE( int64 );
- CPPUNIT_TEST( test_int64 );
- CPPUNIT_TEST_SUITE_END( );
- };
-
-void int64::test_int64()
-{
-#ifndef SAL_INT64_IS_STRUCT
-#ifdef UNX
- sal_Int64 i1 = -3223372036854775807LL;
- sal_uInt64 u1 = 5223372036854775807ULL;
-#else
- sal_Int64 i1 = -3223372036854775807;
- sal_uInt64 u1 = 5223372036854775807;
-#endif
- sal_Int64 i2 = 0;
- sal_uInt64 u2 = 0;
-#else
- sal_Int64 i1;
- sal_setInt64(&i1, 3965190145L, -750499787L);
-
- sal_Int64 i2 = { 0, 0 };
-
- sal_uInt64 u1;
- sal_setUInt64(&u1, 1651507199UL, 1216161073UL);
-
- sal_uInt64 u2 = {0, 0 };
-
-#endif
- sal_uInt32 low = 0;
- sal_Int32 high = 0;
-
- sal_getInt64(i1, &low, &high);
- sal_setInt64(&i2, low, high);
-
- sal_uInt32 ulow = 0;
- sal_uInt32 uhigh = 0;
-
- sal_getUInt64(u1, &ulow, &uhigh);
- sal_setUInt64(&u2, ulow, uhigh);
-
-#ifndef SAL_INT64_IS_STRUCT
- TEST_ENSURE( i1 == i2, "test_int64 error 1");
-
- TEST_ENSURE( u1 == u2, "test_int64 error 2");
-#else
- TEST_ENSURE( (i1.Part1 == i2.Part1) && (i1.Part2 == i2.Part2),
- "test_int64 error 1");
-
- TEST_ENSURE( (u1.Part1 == u2.Part1) && (u1.Part2 == u2.Part2),
- "test_int64 error 2");
-#endif
- return;
-}
-
-} // namespace rtl_math
-
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( rtl_math::int64, "rtl_math" );
-
-// -----------------------------------------------------------------------------
-NOADDITIONAL;
-
-
-/* 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
new file mode 100644
index 000000000000..8e9875444280
--- /dev/null
+++ b/sal/qa/rtl/math/test-rtl-math.cxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+*
+* 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 "precompiled_sal.hxx"
+#include "sal/config.h"
+
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
+#include "cppunit/plugin/TestPlugIn.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 e81e4a12fcb4..000000000000
--- a/sal/qa/rtl/math/test_rtl_math.cxx
+++ /dev/null
@@ -1,677 +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/math.h"
-#include "rtl/math.hxx"
-#include "rtl/strbuf.hxx"
-#include "rtl/string.h"
-#include "rtl/string.hxx"
-#include "rtl/textenc.h"
-#include <testshl/tresstatewrapper.hxx>
-#include "rtl/ustring.hxx"
-#include "sal/types.h"
-#include <sal/macros.h>
-
-#include <stdlib.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 >
-bool testNumberToString(hTestResult pTestResult,
- TestNumberToString const & rTest)
-{
- typename NumberT::Number fValue = static_cast< typename NumberT::Number >(rTest.fValue);
- if (fValue != rTest.fValue)
- return true;
-
- // 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));
-
- // LLA: rtl::OStringBuffer aBuf;
- // LLA: StringT::appendBuffer(aBuf, aResult1);
- // LLA: t_print("aResult1: %s ", aBuf.getStr());
- // LLA:
- // LLA: rtl::OStringBuffer aBuf2;
- // LLA: StringT::appendBuffer(aBuf2, aResult2);
- // LLA: t_print("aResult2: %s\n", aBuf2.getStr());
-
- bool bSuccess = aResult1 == aResult2;
-
- 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 (!bSuccess)
- {
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(" != "));
- StringT::appendBuffer(aBuffer, aResult2);
- }
- // call to the real test checker
- // pTestResult->pFuncs->state_(pTestResult, bSuccess, "test_rtl_math",
- // aBuffer.getStr(), false);
- c_rtl_tres_state(pTestResult, bSuccess, aBuffer.getStr(), "testNumberToString");
- return bSuccess;
-}
-
-template< typename StringT, typename NumberT >
-bool testNumberToString(hTestResult pTestResult,
- TestNumberToString const * pTests, size_t nCount)
-{
- bool bSuccess = true;
- for (size_t i = 0; i < nCount; ++i)
- bSuccess &= testNumberToString< StringT, NumberT >(pTestResult,
- pTests[i]);
- return bSuccess;
-}
-
-struct TestStringToNumberToString
-{
- char const * pValue;
- rtl_math_StringFormat eFormat;
- sal_Int32 nDecPlaces;
- char cDecSeparator;
- bool bEraseTrailingDecZeros;
- char const * pResult;
-};
-
-template< typename StringT >
-bool testStringToNumberToString(hTestResult pTestResult,
- 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));
- bool bSuccess = aResult1 == aResult2;
- 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 (!bSuccess)
- {
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(" != "));
- StringT::appendBuffer(aBuffer, aResult2);
- }
- // call to the real test checker
- // pTestResult->pFuncs->state_(pTestResult, bSuccess, "test_rtl_math",
- // aBuffer.getStr(), false);
- c_rtl_tres_state(pTestResult, bSuccess, aBuffer.getStr(), "testStringToNumberToString");
-
- return bSuccess;
-}
-
-template< typename StringT >
-bool testStringToNumberToString(hTestResult pTestResult,
- TestStringToNumberToString const * pTests,
- size_t nCount)
-{
- bool bSuccess = true;
- for (size_t i = 0; i < nCount; ++i)
- bSuccess &= testStringToNumberToString< StringT >(pTestResult,
- pTests[i]);
- return bSuccess;
-}
-
-}
-
-extern "C" sal_Bool SAL_CALL test_rtl_math(hTestResult pTestResult)
-{
- bool bReturn = true;
-
- {
- 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);
- bReturn &= testNumberToString< StringTraits, DoubleTraits >(
- pTestResult, aTest, nCount);
-// bReturn &= testNumberToString< UStringTraits, FloatTraits >(
-// pTestResult, aTest, nCount);
- bReturn &= testNumberToString< UStringTraits, DoubleTraits >(
- pTestResult, aTest, nCount);
- }
-
- {
- 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);
- bReturn &= testStringToNumberToString< StringTraits >(
- pTestResult, aTest, nCount);
- bReturn &= testStringToNumberToString< UStringTraits >(
- pTestResult, aTest, nCount);
- }
-
- return bReturn;
-}
-
-// -----------------------------------------------------------------------------
-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, "");
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl_strings/makefile.mk b/sal/qa/rtl_strings/makefile.mk
index ceb465aa169d..b319fbf6845b 100644
--- a/sal/qa/rtl_strings/makefile.mk
+++ b/sal/qa/rtl_strings/makefile.mk
@@ -28,7 +28,6 @@ PRJ=..$/..
PRJNAME=sal
TARGET=qa_rtl_strings
-# TESTDIR=TRUE
ENABLE_EXCEPTIONS=TRUE
diff --git a/sal/rtl/source/math.cxx b/sal/rtl/source/math.cxx
index 8f949b3bf3d8..1aee95642936 100644
--- a/sal/rtl/source/math.cxx
+++ b/sal/rtl/source/math.cxx
@@ -924,7 +924,7 @@ inline double stringToDouble(CharT const * pBegin, CharT const * pEnd,
if (pStatus != 0)
*pStatus = eStatus;
if (pParsedEnd != 0)
- *pParsedEnd = p;
+ *pParsedEnd = p == p0 ? pBegin : p;
return fVal;
}
diff --git a/sal/systools/win32/uwinapi/ResolveUnicows.cpp b/sal/systools/win32/uwinapi/ResolveUnicows.cpp
index 5684cd5f8683..d38e75063ccf 100644
--- a/sal/systools/win32/uwinapi/ResolveUnicows.cpp
+++ b/sal/systools/win32/uwinapi/ResolveUnicows.cpp
@@ -2,6 +2,7 @@
#ifdef __MINGW32__
#define _GDI32_
#include "macros.h"
+#include <w32api.h>
#include <multimon.h>
extern "C" {
extern HMODULE hModuleUnicowsDLL;
@@ -462,7 +463,11 @@ DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, UpdateResourceW, (HANDLE,LPCWSTR,L
DEFINE_UNICOWS_THUNK( version, DWORD, WINAPI, VerFindFileW, (DWORD,LPWSTR,LPWSTR,LPWSTR,LPWSTR,PUINT,LPWSTR,PUINT) )
DEFINE_UNICOWS_THUNK( version, DWORD, WINAPI, VerInstallFileW, (DWORD,LPWSTR,LPWSTR,LPWSTR,LPWSTR,LPWSTR,LPWSTR,PUINT) )
DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, VerLanguageNameW, (DWORD,LPWSTR,DWORD) )
+#if ( __W32API_MAJOR_VERSION > 3 ) || ( __W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION > 13 )
+DEFINE_UNICOWS_THUNK( version, BOOL, WINAPI, VerQueryValueW, (const LPVOID,LPCWSTR,LPVOID*,PUINT) )
+#else
DEFINE_UNICOWS_THUNK( version, BOOL, WINAPI, VerQueryValueW, (const LPVOID,LPWSTR,LPVOID*,PUINT) )
+#endif
DEFINE_UNICOWS_THUNK( user32, SHORT, WINAPI, VkKeyScanExW, (WCHAR,HKL) )
DEFINE_UNICOWS_THUNK( user32, SHORT, WINAPI, VkKeyScanW, (WCHAR) )
DEFINE_UNICOWS_THUNK( user32, DWORD, WINAPI, SetupDecompressOrCopyFileW, (PCWSTR,PCWSTR,PUINT) )
diff --git a/sal/util/sal.map b/sal/util/sal.map
index 8b1c079ec899..73ae4431100e 100755
--- a/sal/util/sal.map
+++ b/sal/util/sal.map
@@ -602,6 +602,7 @@ UDK_3.11 { # OOo 3.4
global:
osl_setEnvironment;
osl_clearEnvironment;
+ osl_setThreadName;
} UDK_3.10;
PRIVATE_1.0 {