From 08b157baba2138ad1d85fa1b2ae0da243a317081 Mon Sep 17 00:00:00 2001 From: "scc%netscape.com" Date: Sat, 25 Mar 2000 00:56:47 +0000 Subject: [PATCH] getting the unit tests and profiling tests to run on all platforms --- .../StringFactoringTests/nsStdStringWrapper.h | 2 +- .../StringFactoringTests/profile_main.cpp | 8 +-- xpcom/tests/StringFactoringTests/test_main.cc | 67 ++----------------- 3 files changed, 7 insertions(+), 70 deletions(-) diff --git a/xpcom/tests/StringFactoringTests/nsStdStringWrapper.h b/xpcom/tests/StringFactoringTests/nsStdStringWrapper.h index 158c1da56411..0dc2389eadaf 100644 --- a/xpcom/tests/StringFactoringTests/nsStdStringWrapper.h +++ b/xpcom/tests/StringFactoringTests/nsStdStringWrapper.h @@ -202,7 +202,7 @@ basic_nsStdStringWrapper::Assign( const basic_nsARea { typedef basic_nsStdStringWrapper this_t; - if ( rhs.Implementation() == Implementation() ) + if ( SameImplementation(*this, rhs) ) mRawString = NS_STATIC_CAST(this_t, rhs).mRawString; else { diff --git a/xpcom/tests/StringFactoringTests/profile_main.cpp b/xpcom/tests/StringFactoringTests/profile_main.cpp index c77700cfff70..59f482382354 100644 --- a/xpcom/tests/StringFactoringTests/profile_main.cpp +++ b/xpcom/tests/StringFactoringTests/profile_main.cpp @@ -2,7 +2,7 @@ #include "nscore.h" #include "prlong.h" -#include +#include #include #include @@ -20,11 +20,7 @@ typedef nsStdCString nsCString; static const int kTestSucceeded = 0; static const int kTestFailed = 1; -#if 0 -#define N 1000 -#else -#define N 100000 -#endif +static const size_t N = 100000; template diff --git a/xpcom/tests/StringFactoringTests/test_main.cc b/xpcom/tests/StringFactoringTests/test_main.cc index a7eb0fcf29a8..5038afcc48eb 100644 --- a/xpcom/tests/StringFactoringTests/test_main.cc +++ b/xpcom/tests/StringFactoringTests/test_main.cc @@ -1,5 +1,4 @@ -#include -using namespace std; +#include #include "nsString.h" #include "nsSharedString.h" @@ -7,7 +6,7 @@ using namespace std; // #define NS_USE_WCHAR_T - +#if 0 static ostream& print_string( const nsAReadableString& s ) @@ -20,6 +19,7 @@ print_string( const nsAReadableString& s ) transform(s.BeginReading(), s.EndReading(), ostream_iterator(cout), PRUnichar_to_char()); return cout; } +#endif template @@ -88,65 +88,6 @@ test_multifragment_iterators( const basic_nsAReadableString& aString ) return tests_failed; } -#if 0 -template -int -test_deprecated_GetBufferGetUnicode( const basic_nsAReadableString& aReadable ) - { - int tests_failed = 0; - - if ( aReadable.GetBuffer() || aReadable.GetUnicode() ) - { - cout << "FAILED |test_deprecated_GetBufferGetUnicode()|: non-zero result." << endl; - ++tests_failed; - } - - return tests_failed; - } - -NS_SPECIALIZE_TEMPLATE -int -test_deprecated_GetBufferGetUnicode( const basic_nsAReadableString& aReadable ) - { - int tests_failed = 0; - - if ( !aReadable.GetBuffer() ) - { - cout << "FAILED |test_deprecated_GetBufferGetUnicode()|: |GetBuffer()| returned 0." << endl; - ++tests_failed; - } - - if ( aReadable.GetUnicode() ) - { - cout << "FAILED |test_deprecated_GetBufferGetUnicode()|: |GetUnicode()| returned a non-zero result." << endl; - ++tests_failed; - } - - return tests_failed; - } - -NS_SPECIALIZE_TEMPLATE -int -test_deprecated_GetBufferGetUnicode( const basic_nsAReadableString& aReadable ) - { - int tests_failed = 0; - - if ( aReadable.GetBuffer() ) - { - cout << "FAILED |test_deprecated_GetBufferGetUnicode()|: |GetBuffer()| returned a non-zero result." << endl; - ++tests_failed; - } - - if ( !aReadable.GetUnicode() ) - { - cout << "FAILED |test_deprecated_GetBufferGetUnicode()|: |GetUnicode()| returned 0." << endl; - ++tests_failed; - } - - return tests_failed; - } -#endif - template int test_readable_hello( const basic_nsAReadableString& aReadable ) @@ -352,7 +293,7 @@ main() nsSharedString* s15 = new_nsSharedString( s7 + s8 + s9 ); tests_failed += test_readable_hello(*s15); - cout << "Here's a string: \""; print_string(*s15) << "\"" << endl; + // cout << "Here's a string: \""; print_string(*s15) << "\"" << endl; nsCString s10("He"); nsLiteralCString s11("l");