diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-07-10 14:03:42 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-07-10 14:03:42 +0200 |
commit | a7e564b4836154b84d67814486123eab6cb639c2 (patch) | |
tree | dd2acabfabf9b8fa8052e9406c5d51ec14a9b9da /extensions | |
parent | 87b38cb17d0443b890befe17043698841175d285 (diff) |
#i103452#: replace PRODUCT by !DBG_UTIL; replace assert by OSL_ASSERT where possible
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/test/sax/testsax.cxx | 13 | ||||
-rw-r--r-- | extensions/test/sax/testwriter.cxx | 7 | ||||
-rw-r--r-- | extensions/test/stm/datatest.cxx | 28 | ||||
-rw-r--r-- | extensions/test/stm/marktest.cxx | 12 | ||||
-rw-r--r-- | extensions/test/stm/pipetest.cxx | 6 | ||||
-rw-r--r-- | extensions/workben/pythonautotest.cxx | 76 | ||||
-rw-r--r-- | extensions/workben/pythontest.cxx | 6 | ||||
-rw-r--r-- | extensions/workben/testcomponent.cxx | 11 |
8 files changed, 62 insertions, 97 deletions
diff --git a/extensions/test/sax/testsax.cxx b/extensions/test/sax/testsax.cxx index 9aa0ee22f794..80ebe1dd9f13 100644 --- a/extensions/test/sax/testsax.cxx +++ b/extensions/test/sax/testsax.cxx @@ -43,11 +43,6 @@ #include <tools/string.hxx> #include <vos/conditn.hxx> -#if OSL_DEBUG_LEVEL == 0 -#define NDEBUG -#endif -#include <assert.h> - #include <smart/com/sun/star/io/XOutputStream.hxx> #include <smart/com/sun/star/xml/sax/SAXParseException.hxx> #include <smart/com/sun/star/xml/sax/XParser.hxx> @@ -309,12 +304,12 @@ Sequence< UString > OSaxParserTest::getWarnings(void) THRO XInputStreamRef createStreamFromSequence( const Sequence<BYTE> seqBytes , XMultiServiceFactoryRef &xSMgr ) { XInterfaceRef xOutStreamService = xSMgr->createInstance( L"com.sun.star.io.Pipe" ); - assert( xOutStreamService.is() ); + OSL_ASSERT( xOutStreamService.is() ); XOutputStreamRef rOutStream( xOutStreamService , USR_QUERY ); - assert( rOutStream.is() ); + OSL_ASSERT( rOutStream.is() ); XInputStreamRef rInStream( xOutStreamService , USR_QUERY ); - assert( rInStream.is() ); + OSL_ASSERT( rInStream.is() ); rOutStream->writeBytes( seqBytes ); rOutStream->flush(); @@ -442,7 +437,7 @@ public: // ExtendedDocumentHandler } virtual void endElement(const UString& aName) THROWS( (SAXException,UsrSystemException) ) { - assert( m_iLevel ); + OSL_ASSERT( m_iLevel ); m_iLevel --; if( m_bPrint ) { int i; diff --git a/extensions/test/sax/testwriter.cxx b/extensions/test/sax/testwriter.cxx index e27601c92d34..b4ab9d3f73ea 100644 --- a/extensions/test/sax/testwriter.cxx +++ b/extensions/test/sax/testwriter.cxx @@ -50,11 +50,6 @@ #include <usr/weak.hxx> #include <tools/string.hxx> -#if OSL_DEBUG_LEVEL == 0 -#define NDEBUG -#endif -#include <assert.h> - #include <usr/factoryhlp.hxx> #include <usr/reflserv.hxx> // for EXTERN_SERVICE_CALLTYPE @@ -401,7 +396,7 @@ void AttributeListImpl::clear() vector<struct TagAttribute> dummy; m_pImpl->vecAttribute.swap( dummy ); - assert( ! getLength() ); + OSL_ASSERT( ! getLength() ); } diff --git a/extensions/test/stm/datatest.cxx b/extensions/test/stm/datatest.cxx index 5edc414e7f2c..be302d877432 100644 --- a/extensions/test/stm/datatest.cxx +++ b/extensions/test/stm/datatest.cxx @@ -52,10 +52,6 @@ #include <vos/mutex.hxx> #include <vos/thread.hxx> -#if OSL_DEBUG_LEVEL == 0 -#define NDEBUG -#endif -#include <assert.h> #include <string.h> #include "testfactreg.hxx" @@ -206,13 +202,13 @@ INT32 ODataStreamTest::test( const UString& TestName, x->queryInterface( XActiveDataSource::getSmartUik() , rSource ); } - assert( rPipeInput.is() ); - assert( rPipeOutput.is() ); + OSL_ASSERT( rPipeInput.is() ); + OSL_ASSERT( rPipeOutput.is() ); rSink->setInputStream( rPipeInput ); rSource->setOutputStream( rPipeOutput ); - assert( rSink->getInputStream().is() ); - assert( rSource->getOutputStream().is() ); + OSL_ASSERT( rSink->getInputStream().is() ); + OSL_ASSERT( rSource->getOutputStream().is() ); if( 1 == hTestHandle ) { testSimple( rInput , rOutput ); @@ -767,10 +763,10 @@ INT32 OObjectStreamTest::test( const UString& TestName, XOutputStreamRef markableOutput( x , USR_QUERY ); XActiveDataSourceRef markableSource( x , USR_QUERY ); - assert( markableInput.is() ); - assert( markableOutput.is() ); - assert( markableSink.is() ); - assert( markableSource.is() ); + OSL_ASSERT( markableInput.is() ); + OSL_ASSERT( markableOutput.is() ); + OSL_ASSERT( markableSink.is() ); + OSL_ASSERT( markableSource.is() ); markableSink->setInputStream( rPipeInput ); markableSource->setOutputStream( rPipeOutput ); @@ -786,14 +782,14 @@ INT32 OObjectStreamTest::test( const UString& TestName, x->queryInterface( XActiveDataSource::getSmartUik() , rSource ); } - assert( rPipeInput.is() ); - assert( rPipeOutput.is() ); + OSL_ASSERT( rPipeInput.is() ); + OSL_ASSERT( rPipeOutput.is() ); rSink->setInputStream( markableInput ); rSource->setOutputStream( markableOutput ); - assert( rSink->getInputStream().is() ); - assert( rSource->getOutputStream().is() ); + OSL_ASSERT( rSink->getInputStream().is() ); + OSL_ASSERT( rSource->getOutputStream().is() ); if( 1 + DATASTREAM_TEST_MAX_HANDLE == hTestHandle ) { testObject( rOutput , rInput); diff --git a/extensions/test/stm/marktest.cxx b/extensions/test/stm/marktest.cxx index 8bba9bbebc86..2cc19c2ae265 100644 --- a/extensions/test/stm/marktest.cxx +++ b/extensions/test/stm/marktest.cxx @@ -48,10 +48,6 @@ #include <vos/mutex.hxx> #include <vos/thread.hxx> -#if OSL_DEBUG_LEVEL == 0 -#define NDEBUG -#endif -#include <assert.h> #include <string.h> #include "testfactreg.hxx" @@ -166,8 +162,8 @@ INT32 OMarkableOutputStreamTest::test( const UString& TestName, XOutputStreamRef rOutput( TestObject , USR_QUERY ); - assert( rPipeInput.is() ); - assert( rOutput.is() ); + OSL_ASSERT( rPipeInput.is() ); + OSL_ASSERT( rOutput.is() ); if( 1 == hTestHandle ) { // checks usual streaming testSimple( rOutput , rPipeInput ); @@ -533,8 +529,8 @@ INT32 OMarkableInputStreamTest::test( const UString& TestName, XInputStreamRef rInput( TestObject , USR_QUERY ); - assert( rPipeOutput.is() ); - assert( rInput.is() ); + OSL_ASSERT( rPipeOutput.is() ); + OSL_ASSERT( rInput.is() ); if( 1 == hTestHandle ) { // checks usual streaming testSimple( rPipeOutput , rInput ); diff --git a/extensions/test/stm/pipetest.cxx b/extensions/test/stm/pipetest.cxx index 4f4337ceff45..233979230708 100644 --- a/extensions/test/stm/pipetest.cxx +++ b/extensions/test/stm/pipetest.cxx @@ -45,10 +45,6 @@ #include <vos/mutex.hxx> #include <vos/thread.hxx> -#if OSL_DEBUG_LEVEL == 0 -#define NDEBUG -#endif -#include <assert.h> #include <string.h> #include "testfactreg.hxx" @@ -404,7 +400,7 @@ void OPipeTest::testMultithreading( const XInterfaceRef &r ) XInputStreamRef input( x , USR_QUERY ); XOutputStreamRef output( x , USR_QUERY ); - assert( output.is() ); + OSL_ASSERT( output.is() ); while( TRUE ) { // basic read/write Sequence<BYTE> seqWrite( 500 ); diff --git a/extensions/workben/pythonautotest.cxx b/extensions/workben/pythonautotest.cxx index ad38869c4c38..9cb61f00b3e8 100644 --- a/extensions/workben/pythonautotest.cxx +++ b/extensions/workben/pythonautotest.cxx @@ -44,10 +44,6 @@ #include <usr/weak.hxx> #include <tools/string.hxx> #include <vos/conditn.hxx> -#if OSL_DEBUG_LEVEL == 0 -#define NDEBUG -#endif -#include <assert.h> using namespace rtl; using namespace vos; @@ -302,7 +298,7 @@ void TestListener::cmdLine() void TestListener::detach() { - assert( m_pDebuggingRef ); + OSL_ASSERT( m_pDebuggingRef ); m_pDebuggingRef = 0; } @@ -322,15 +318,15 @@ void checkInvokation( const XInvokationRef &xInvoke ) UsrAny anyList; // check exporting an object as an invokation - assert( xInvoke->hasProperty( L"list" ) ); + OSL_ASSERT( xInvoke->hasProperty( L"list" ) ); anyList = xInvoke->getValue( L"list" ); - assert( anyList.getReflection() == XInvokation_getReflection() ); + OSL_ASSERT( anyList.getReflection() == XInvokation_getReflection() ); XInvokationRef *pRef = ( XInvokationRef * ) anyList.get(); - assert( (*pRef).is() ); + OSL_ASSERT( (*pRef).is() ); - assert( (*pRef)->hasMethod( L"append" ) ); - assert( (*pRef)->hasMethod( L"count" ) ); + OSL_ASSERT( (*pRef)->hasMethod( L"append" ) ); + OSL_ASSERT( (*pRef)->hasMethod( L"count" ) ); Sequence<UsrAny> seq(1); UsrAny any( (INT32) 1); @@ -342,7 +338,7 @@ void checkInvokation( const XInvokationRef &xInvoke ) any = (*pRef)->invoke( L"append" , seq , Sequence<INT16>(), Sequence<UsrAny>() ); any = (*pRef)->invoke( L"count" , seq , Sequence<INT16>(), Sequence<UsrAny>() ); - assert( nOldSize + 1 == any.getINT32() ); + OSL_ASSERT( nOldSize + 1 == any.getINT32() ); } // just for testing ! @@ -448,30 +444,30 @@ int __LOADONCALLAPI main (int argc, char **argv) *****/ // get/set an int ! { - assert( xInvoke->hasProperty( L"nIntTest" ) ); + OSL_ASSERT( xInvoke->hasProperty( L"nIntTest" ) ); UsrAny any = xInvoke->getValue( L"nIntTest" ); - assert( any.getReflection()->getTypeClass() == TypeClass_LONG ); - assert( any.getINT32() == 5 ); + OSL_ASSERT( any.getReflection()->getTypeClass() == TypeClass_LONG ); + OSL_ASSERT( any.getINT32() == 5 ); // simple test: set an int ! xInvoke->setValue( L"nIntTest" , UsrAny( (INT32) 10 ) ); any = xInvoke->getValue( L"nIntTest" ); - assert( any.getReflection()->getTypeClass() == TypeClass_LONG ); - assert( any.getINT32() == 10 ); + OSL_ASSERT( any.getReflection()->getTypeClass() == TypeClass_LONG ); + OSL_ASSERT( any.getINT32() == 10 ); } // call a python method ! { xEngine->run( L"def foo():\n" L" return 'this is foo'\n" , XInterfaceRef() , Sequence<UsrAny> () ); - assert( xInvoke->hasMethod( L"foo" ) ); + OSL_ASSERT( xInvoke->hasMethod( L"foo" ) ); UsrAny any = xInvoke->invoke( L"foo" , Sequence<UsrAny>(), Sequence<INT16>() , Sequence<UsrAny> () ); - assert( any.getString() == L"this is foo" ); + OSL_ASSERT( any.getString() == L"this is foo" ); } @@ -480,7 +476,7 @@ int __LOADONCALLAPI main (int argc, char **argv) try { xInvoke->invoke( L"foo" , Sequence<UsrAny>(1) , Sequence<INT16>(), Sequence<UsrAny> () ); // wrong number of arguments - assert( 0 ); + OSL_ASSERT( 0 ); } catch ( IllegalArgumentException& e ) { } @@ -501,21 +497,21 @@ int __LOADONCALLAPI main (int argc, char **argv) *******/ { XIntrospectionAccessRef xIntrospection = xInvoke->getIntrospection(); - assert( xIntrospection.is() ); + OSL_ASSERT( xIntrospection.is() ); // no further test, simply call them xIntrospection->getMethods(0); xIntrospection->getProperties(0); - assert( xIntrospection->getSuppliedMethodConcepts() == 0 ); - assert( xIntrospection->getSuppliedPropertyConcepts() == 0 ); + OSL_ASSERT( xIntrospection->getSuppliedMethodConcepts() == 0 ); + OSL_ASSERT( xIntrospection->getSuppliedPropertyConcepts() == 0 ); Property prop = xIntrospection->getProperty( L"nIntTest" ,0 ); - assert( prop.Name == L"nIntTest" ); - assert( prop.Type->getTypeClass() == TypeClass_LONG ); + OSL_ASSERT( prop.Name == L"nIntTest" ); + OSL_ASSERT( prop.Type->getTypeClass() == TypeClass_LONG ); XIdlMethodRef method = xIntrospection->getMethod( L"foo" , 0 ); - assert( method->getName() == L"foo" ); + OSL_ASSERT( method->getName() == L"foo" ); } @@ -567,8 +563,8 @@ int __LOADONCALLAPI main (int argc, char **argv) xEngine->run( L"import testmodul\n" L"x = testmodul.testmethod()\n" , XInterfaceRef() , Sequence<UsrAny>() ); UsrAny any = xInvoke->getValue( L"x" ); - assert( any.getReflection()->getTypeClass() == TypeClass_LONG ); - assert( any.getINT32() == 42 ); + OSL_ASSERT( any.getReflection()->getTypeClass() == TypeClass_LONG ); + OSL_ASSERT( any.getINT32() == 42 ); } // check other imports @@ -577,11 +573,11 @@ int __LOADONCALLAPI main (int argc, char **argv) xEngine->run( L"import math\n" L"dMathTest = math.exp(0)\n" , XInterfaceRef() , Sequence<UsrAny> () ); - assert( xInvoke->hasProperty( L"dMathTest" ) ); + OSL_ASSERT( xInvoke->hasProperty( L"dMathTest" ) ); UsrAny any = xInvoke->getValue( L"dMathTest" ); - assert( any.getReflection()->getTypeClass() == TypeClass_DOUBLE ); - assert( any.getDouble() == 1. ); + OSL_ASSERT( any.getReflection()->getTypeClass() == TypeClass_DOUBLE ); + OSL_ASSERT( any.getDouble() == 1. ); } // Test connection to root object ! @@ -592,36 +588,36 @@ int __LOADONCALLAPI main (int argc, char **argv) L"z = y.value\n" , XInterfaceRef() , Sequence<UsrAny> () ); UsrAny any = xInvoke->getValue( L"x" ); - assert( any.getReflection()->getTypeClass() == TypeClass_LONG ); - assert( any.getINT32() == 15 ); + OSL_ASSERT( any.getReflection()->getTypeClass() == TypeClass_LONG ); + OSL_ASSERT( any.getINT32() == 15 ); any = xInvoke->getValue( L"z" ); - assert( any.getReflection()->getTypeClass() == TypeClass_LONG ); - assert( any.getINT32() == 15 ); + OSL_ASSERT( any.getReflection()->getTypeClass() == TypeClass_LONG ); + OSL_ASSERT( any.getINT32() == 15 ); } // Test exactName interface { UsrAny any = xInvoke->getValue( L"__builtins__" ); - assert( any.getReflection()->getTypeClass() == TypeClass_INTERFACE ); + OSL_ASSERT( any.getReflection()->getTypeClass() == TypeClass_INTERFACE ); XInvokationRef rInv( *((XInterfaceRef *) any.get() ), USR_QUERY ); - assert( rInv.is() ); + OSL_ASSERT( rInv.is() ); XExactNameRef rName( *((XInterfaceRef*) any.get() ), USR_QUERY ); - assert( rName.is() ); + OSL_ASSERT( rName.is() ); UString str = rName->getExactName( L"SYNTAXERROR" ); - assert( str.len() ); + OSL_ASSERT( str.len() ); } // Test exactName interface of the engine itself { XExactNameRef rName( xInvoke , USR_QUERY ); - assert( rName.is() ); + OSL_ASSERT( rName.is() ); UString str = rName->getExactName( L"STARDIV" ); - assert( str.len() ); + OSL_ASSERT( str.len() ); } diff --git a/extensions/workben/pythontest.cxx b/extensions/workben/pythontest.cxx index 5e2efff66f26..796884dff8aa 100644 --- a/extensions/workben/pythontest.cxx +++ b/extensions/workben/pythontest.cxx @@ -45,10 +45,6 @@ #include <usr/weak.hxx> #include <tools/string.hxx> #include <vos/conditn.hxx> -#if OSL_DEBUG_LEVEL == 0 -#define NDEBUG -#endif -#include <assert.h> using namespace rtl; using namespace vos; @@ -453,7 +449,7 @@ void CmdDebugger::dumpVarToStream( const char *pc , const UsrAny &aValue, FILE * void CmdDebugger::detach() { - assert( m_pDebuggingRef ); + OSL_ASSERT( m_pDebuggingRef ); m_bIsRunning = FALSE; m_pDebuggingRef = 0; diff --git a/extensions/workben/testcomponent.cxx b/extensions/workben/testcomponent.cxx index 869f5331752e..08d8af4831b8 100644 --- a/extensions/workben/testcomponent.cxx +++ b/extensions/workben/testcomponent.cxx @@ -52,11 +52,6 @@ #include <tools/string.hxx> #include <vos/conditn.hxx> -#if OSL_DEBUG_LEVEL == 0 -#define NDEBUG -#endif -#include <assert.h> - #include <smart/com/sun/star/test/XSimpleTest.hxx> using namespace rtl; @@ -84,7 +79,7 @@ int __LOADONCALLAPI main (int argc, char **argv) // create service manager // XMultiServiceFactoryRef xSMgr = getProcessServiceManager(); XMultiServiceFactoryRef xSMgr = createRegistryServiceManager(); - assert( xSMgr.is() ); + OSL_ASSERT( xSMgr.is() ); registerUsrServices( xSMgr ); setProcessServiceManager( xSMgr ); @@ -98,9 +93,9 @@ int __LOADONCALLAPI main (int argc, char **argv) x->queryInterface( XImplementationRegistration::getSmartUik() , xReg ); /* x = xSMgr->createInstance( L"stardiv.uno.repos.SimpleRegistry" ); - assert( x.is() ); + OSL_ASSERT( x.is() ); x->queryInterface( XSimpleRegistry::getSmartUik() , xSimpleReg ); - assert( xSimpleReg.is() ); + OSL_ASSERT( xSimpleReg.is() ); xSimpleReg->open( L"testcomp.rdb" , FALSE , TRUE ); */ } catch( Exception& e ) { |