[Libreoffice-commits] .: sal/qa

Caolán McNamara caolan at kemper.freedesktop.org
Fri Mar 18 02:55:27 PDT 2011


 sal/qa/rtl/cipher/rtl_cipher.cxx            |   72 ----------------------------
 sal/qa/rtl/doublelock/rtl_doublelocking.cxx |   19 +------
 sal/qa/rtl/locale/rtl_locale.cxx            |   25 +++------
 3 files changed, 13 insertions(+), 103 deletions(-)

New commits:
commit bcd466b023774d2f334329a7a7b178e11b79896c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 18 09:44:21 2011 +0000

    quieten these tests

diff --git a/sal/qa/rtl/cipher/rtl_cipher.cxx b/sal/qa/rtl/cipher/rtl_cipher.cxx
index 6d5007c..ac05f2b 100644
--- a/sal/qa/rtl/cipher/rtl_cipher.cxx
+++ b/sal/qa/rtl/cipher/rtl_cipher.cxx
@@ -211,9 +211,6 @@ public:
             memset(pArgBuffer, 0, nArgLen);
             pArgBuffer[0] = _nArgValue;
 
-            printf("  init Key: %s\n", createHex(pKeyBuffer, nKeyLen).getStr());
-            printf("  init Arg: %s\n", createHex(pArgBuffer, nArgLen).getStr());
-
             rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
             CPPUNIT_ASSERT_MESSAGE("wrong init", aError == rtl_Cipher_E_None);
 
@@ -229,37 +226,12 @@ public:
             /* rtlCipherError */ aError = rtl_cipher_encode(aCipher, pPlainTextBuffer, nPlainTextLen, pCipherBuffer, nCipherLen);
             CPPUNIT_ASSERT_MESSAGE("wrong encode", aError == rtl_Cipher_E_None);
 
-            printf("       Key: %s\n", createHex(pKeyBuffer, nKeyLen).getStr());
-            printf("       Arg: %s\n", createHex(pArgBuffer, nArgLen).getStr());
-            printf("     Plain: %s\n", createHex(pPlainTextBuffer, nPlainTextLen).getStr());
-            printf(           "Cipher Buf: %s\n", createHex(pCipherBuffer, nCipherLen).getStr());
-
             sal_uInt32     nPlainText2Len = 16;
             sal_uInt8     *pPlainText2Buffer = new sal_uInt8[ nPlainText2Len ];
             memset(pPlainText2Buffer, 0, nPlainText2Len);
 
             /* rtlCipherError */ aError = rtl_cipher_decode(aCipher, pCipherBuffer, nCipherLen, pPlainText2Buffer, nPlainText2Len);
             CPPUNIT_ASSERT_MESSAGE("decode should not work", aError != rtl_Cipher_E_None);
-
-            // rtl::OString sPlainText2Str((char*)pPlainText2Buffer, nPlainText2Len);
-            // printf(" Plain: %s\n", createHex(pPlainText2Buffer, nPlainText2Len).getStr());
-            // printf(" ascii: %s\n", sPlainText2Str.getStr());
-            //
-            // // printf("   Buf: %s\n", createHex(pCipherBuffer, nCipherLen).getStr());
-            //
-            // sal_Int32 nCompare = memcmp(pPlainTextBuffer, pPlainText2Buffer, 16);
-            //
-            // CPPUNIT_ASSERT_MESSAGE("compare between plain and decoded plain failed", nCompare == 0);
-            //
-            // delete [] pPlainText2Buffer;
-            //
-            // delete [] pCipherBuffer;
-            // delete [] pPlainTextBuffer;
-            //
-            // delete [] pArgBuffer;
-            // delete [] pKeyBuffer;
-            //
-            // rtl_cipher_destroy(aCipher);
         }
 
     void test_encode_and_decode(sal_uInt8 _nKeyValue, sal_uInt8 _nArgValue, rtl::OString const& _sPlainTextStr)
@@ -277,9 +249,6 @@ public:
             memset(pArgBuffer, 0, nArgLen);
             pArgBuffer[0] = _nArgValue;
 
-            printf("  init Key: %s\n", createHex(pKeyBuffer, nKeyLen).getStr());
-            printf("  init Arg: %s\n", createHex(pArgBuffer, nArgLen).getStr());
-
             rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionBoth, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
             CPPUNIT_ASSERT_MESSAGE("wrong init", aError == rtl_Cipher_E_None);
 
@@ -295,11 +264,6 @@ public:
             /* rtlCipherError */ aError = rtl_cipher_encode(aCipher, pPlainTextBuffer, nPlainTextLen, pCipherBuffer, nCipherLen);
             CPPUNIT_ASSERT_MESSAGE("wrong encode", aError == rtl_Cipher_E_None);
 
-            printf("       Key: %s\n", createHex(pKeyBuffer, nKeyLen).getStr());
-            printf("       Arg: %s\n", createHex(pArgBuffer, nArgLen).getStr());
-            printf("     Plain: %s\n", createHex(pPlainTextBuffer, nPlainTextLen).getStr());
-            printf(           "Cipher Buf: %s\n", createHex(pCipherBuffer, nCipherLen).getStr());
-
             sal_uInt32     nPlainText2Len = 16;
             sal_uInt8     *pPlainText2Buffer = new sal_uInt8[ nPlainText2Len ];
             memset(pPlainText2Buffer, 0, nPlainText2Len);
@@ -308,10 +272,6 @@ public:
             CPPUNIT_ASSERT_MESSAGE("wrong decode", aError == rtl_Cipher_E_None);
 
             rtl::OString sPlainText2Str((char*)pPlainText2Buffer, nPlainText2Len);
-            printf("     Plain: %s\n", createHex(pPlainText2Buffer, nPlainText2Len).getStr());
-            printf("  as ascii: %s\n", sPlainText2Str.getStr());
-
-            // printf("   Buf: %s\n", createHex(pCipherBuffer, nCipherLen).getStr());
 
             sal_Int32 nCompare = memcmp(pPlainTextBuffer, pPlainText2Buffer, 16);
 
@@ -460,9 +420,6 @@ public:
             memset(pArgBuffer, 0, nArgLen);
             pArgBuffer[0] = _nArgValue;
 
-            printf("init Key: %s\n", createHex(pKeyBuffer, nKeyLen).getStr());
-            printf("init Arg: %s\n", createHex(pArgBuffer, nArgLen).getStr());
-
             rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
             CPPUNIT_ASSERT_MESSAGE("wrong init", aError == rtl_Cipher_E_None);
 
@@ -478,11 +435,6 @@ public:
             /* rtlCipherError */ aError = rtl_cipher_encode(aCipher, pDataBuffer, nDataLen, pBuffer, nLen);
             CPPUNIT_ASSERT_MESSAGE("wrong encode", aError == rtl_Cipher_E_None);
 
-            printf(" Key: %s\n", createHex(pKeyBuffer, nKeyLen).getStr());
-            printf(" Arg: %s\n", createHex(pArgBuffer, nArgLen).getStr());
-            printf("Data: %s\n", createHex(pDataBuffer, nDataLen).getStr());
-            printf(" Buf: %s\n", createHex(pBuffer, nLen).getStr());
-
             delete [] pBuffer;
             delete [] pDataBuffer;
 
@@ -563,15 +515,9 @@ public:
             sal_uInt8     *pArgBuffer = new sal_uInt8[ nArgLen ];
             memset(pArgBuffer, 0, nArgLen);
 
-            printf("Key: %s\n", createHex(pKeyBuffer, nKeyLen).getStr());
-            printf("Arg: %s\n", createHex(pArgBuffer, nArgLen).getStr());
-
             rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
             CPPUNIT_ASSERT_MESSAGE("wrong init", aError == rtl_Cipher_E_None);
 
-            printf("Key: %s\n", createHex(pKeyBuffer, nKeyLen).getStr());
-            printf("Arg: %s\n", createHex(pArgBuffer, nArgLen).getStr());
-
             delete [] pArgBuffer;
             delete [] pKeyBuffer;
 
@@ -592,15 +538,9 @@ public:
             sal_uInt8     *pArgBuffer = new sal_uInt8[ nArgLen ];
             memset(pArgBuffer, 0, nArgLen);
 
-            printf("Key: %s\n", createHex(pKeyBuffer, nKeyLen).getStr());
-            printf("Arg: %s\n", createHex(pArgBuffer, nArgLen).getStr());
-
             rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
             CPPUNIT_ASSERT_MESSAGE("wrong init", aError == rtl_Cipher_E_None);
 
-            printf("Key: %s\n", createHex(pKeyBuffer, nKeyLen).getStr());
-            printf("Arg: %s\n", createHex(pArgBuffer, nArgLen).getStr());
-
             delete [] pArgBuffer;
             delete [] pKeyBuffer;
 
@@ -620,15 +560,9 @@ public:
             memset(pArgBuffer, 0, nArgLen);
             pArgBuffer[0] = 1;
 
-            printf("Key: %s\n", createHex(pKeyBuffer, nKeyLen).getStr());
-            printf("Arg: %s\n", createHex(pArgBuffer, nArgLen).getStr());
-
             rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
             CPPUNIT_ASSERT_MESSAGE("wrong init", aError == rtl_Cipher_E_None);
 
-            printf("Key: %s\n", createHex(pKeyBuffer, nKeyLen).getStr());
-            printf("Arg: %s\n", createHex(pArgBuffer, nArgLen).getStr());
-
             delete [] pArgBuffer;
             delete [] pKeyBuffer;
 
@@ -649,15 +583,9 @@ public:
             memset(pArgBuffer, 0, nArgLen);
             pArgBuffer[0] = 1;
 
-            printf("Key: %s\n", createHex(pKeyBuffer, nKeyLen).getStr());
-            printf("Arg: %s\n", createHex(pArgBuffer, nArgLen).getStr());
-
             rtlCipherError aError = rtl_cipher_init(aCipher, rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
             CPPUNIT_ASSERT_MESSAGE("wrong init", aError == rtl_Cipher_E_None);
 
-            printf("Key: %s\n", createHex(pKeyBuffer, nKeyLen).getStr());
-            printf("Arg: %s\n", createHex(pArgBuffer, nArgLen).getStr());
-
             delete [] pArgBuffer;
             delete [] pKeyBuffer;
 
diff --git a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
index 1ffdd0e..638dbea 100644
--- a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
+++ b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
@@ -54,15 +54,6 @@ struct Gregorian : public ::rtl::StaticWithInit<const ::rtl::OUString, Gregorian
 };
 }
 
-inline void printOUString( ::rtl::OUString const & _suStr )
-{
-    rtl::OString aString;
-
-    printf( "OUString: " );
-    aString = ::rtl::OUStringToOString( _suStr, RTL_TEXTENCODING_ASCII_US );
-    printf( "'%s'\n", aString.getStr( ) );
-}
-
 // -----------------------------------------------------------------------------
 namespace ThreadHelper
 {
@@ -127,8 +118,6 @@ protected:
             while(schedule())
             {
                 rtl::OUString aStr = Gregorian::get();
-                 printOUString(aStr);
-                 printOUString(m_sConstStr);
                 if (aStr.equals(m_sConstStr))
                 {
                     m_nOK++;
@@ -181,7 +170,6 @@ namespace rtl_DoubleLocking
         void getValue_001()
             {
                 rtl::OUString aStr = Gregorian::get();
-                printOUString(aStr);
 
                 CPPUNIT_ASSERT_MESSAGE(
                     "Gregorian::get() failed, wrong value expected.",
@@ -208,7 +196,7 @@ namespace rtl_DoubleLocking
                 pThread->create();
                 p2Thread->create();
 
-                ThreadHelper::thread_sleep_tenth_sec(50);
+                ThreadHelper::thread_sleep_tenth_sec(5);
 
                 pThread->terminate();
                 p2Thread->terminate();
@@ -219,8 +207,10 @@ namespace rtl_DoubleLocking
                 sal_Int32 nValueOK2 = 0;
                 nValueOK2 = p2Thread->getOK();
 
+#if OSL_DEBUG_LEVEL > 2
                 printf("Value in Thread #1 is %d\n", nValueOK);
                 printf("Value in Thread #2 is %d\n", nValueOK2);
+#endif
 
                 sal_Int32 nValueFails = 0;
                 nValueFails = pThread->getFails();
@@ -228,10 +218,11 @@ namespace rtl_DoubleLocking
                 sal_Int32 nValueFails2 = 0;
                 nValueFails2 = p2Thread->getFails();
 
+#if OSL_DEBUG_LEVEL > 2
                 printf("Fails in Thread #1 is %d\n", nValueFails);
                 printf("Fails in Thread #2 is %d\n", nValueFails2);
+#endif
 
-                // ThreadHelper::thread_sleep_tenth_sec(1);
                 pThread->join();
                 p2Thread->join();
 
diff --git a/sal/qa/rtl/locale/rtl_locale.cxx b/sal/qa/rtl/locale/rtl_locale.cxx
index 712d375..12ced3b 100644
--- a/sal/qa/rtl/locale/rtl_locale.cxx
+++ b/sal/qa/rtl/locale/rtl_locale.cxx
@@ -142,16 +142,14 @@ public:
     // insert your test code here.
     void getLanguage_001()
     {
-       rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
+        rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
         rtl::OUString suLanguage = aLocale.getLanguage();
-        printf("Language: %s\n", rtl::OUStringToOString(suLanguage, osl_getThreadTextEncoding()).getStr());
         CPPUNIT_ASSERT_MESSAGE("locale language must be 'de'", suLanguage.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("de"))));
     }
     void getLanguage_002()
     {
-       rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
+        rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
         rtl::OUString suLanguage = rtl_locale_getLanguage(aLocale.getData());
-        printf("Language: %s\n", rtl::OUStringToOString(suLanguage, osl_getThreadTextEncoding()).getStr());
         CPPUNIT_ASSERT_MESSAGE("locale language must be 'de'", suLanguage.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("de"))));
     }
 
@@ -183,16 +181,14 @@ public:
     // insert your test code here.
     void getCountry_001()
     {
-       rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
+        rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
         rtl::OUString suCountry = aLocale.getCountry();
-        printf("Country: %s\n", rtl::OUStringToOString(suCountry, osl_getThreadTextEncoding()).getStr());
         CPPUNIT_ASSERT_MESSAGE("locale country must be 'DE'", suCountry.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DE"))));
     }
     void getCountry_002()
     {
-       rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
+        rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
         rtl::OUString suCountry = rtl_locale_getCountry(aLocale.getData());
-        printf("Country: %s\n", rtl::OUStringToOString(suCountry, osl_getThreadTextEncoding()).getStr());
         CPPUNIT_ASSERT_MESSAGE("locale country must be 'DE'", suCountry.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DE"))));
     }
 
@@ -224,16 +220,14 @@ public:
     // insert your test code here.
     void getVariant_001()
     {
-       rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
+        rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
         rtl::OUString suVariant = aLocale.getVariant();
-        printf("Variant: %s\n", rtl::OUStringToOString(suVariant, osl_getThreadTextEncoding()).getStr());
         CPPUNIT_ASSERT_MESSAGE("locale variant must be 'hochdeutsch'", suVariant.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("hochdeutsch"))));
     }
     void getVariant_002()
     {
-       rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
+        rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
         rtl::OUString suVariant = rtl_locale_getVariant(aLocale.getData());
-        printf("Variant: %s\n", rtl::OUStringToOString(suVariant, osl_getThreadTextEncoding()).getStr());
         CPPUNIT_ASSERT_MESSAGE("locale variant must be 'hochdeutsch'", suVariant.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("hochdeutsch"))));
     }
 
@@ -265,16 +259,14 @@ public:
     // insert your test code here.
     void hashCode_001()
     {
-       rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
+        rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
         sal_Int32 nHashCode = aLocale.hashCode();
-        printf("Hashcode: %d\n", nHashCode);
         CPPUNIT_ASSERT_MESSAGE("locale hashcode must be 3831", nHashCode != 0);
     }
     void hashCode_002()
     {
-       rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
+        rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
         sal_Int32 nHashCode = rtl_locale_hashCode(aLocale.getData());
-        printf("Hashcode: %d\n", nHashCode);
         CPPUNIT_ASSERT_MESSAGE("locale hashcode must be 3831", nHashCode != 0);
     }
 
@@ -321,7 +313,6 @@ public:
         rtl::OLocale aLocale2 = rtl::OLocale::registerLocale(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US")));
 
         sal_Int32 nEqual = rtl_locale_equals(aLocale1.getData(), aLocale2.getData());
-        printf("rtl_locale_equals() result: %d\n", nEqual);
         CPPUNIT_ASSERT(nEqual != 0);
     }
 


More information about the Libreoffice-commits mailing list