Author: damjan
Date: Tue Sep  1 16:15:23 2015
New Revision: 1700604

URL: http://svn.apache.org/r1700604
Log:
#i125003# migrate main/sal/qa/rtl/cipher from cppunit to Google Test.


Modified:
    openoffice/trunk/main/sal/qa/rtl/cipher/makefile.mk
    openoffice/trunk/main/sal/qa/rtl/cipher/rtl_cipher.cxx

Modified: openoffice/trunk/main/sal/qa/rtl/cipher/makefile.mk
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sal/qa/rtl/cipher/makefile.mk?rev=1700604&r1=1700603&r2=1700604&view=diff
==============================================================================
--- openoffice/trunk/main/sal/qa/rtl/cipher/makefile.mk (original)
+++ openoffice/trunk/main/sal/qa/rtl/cipher/makefile.mk Tue Sep  1 16:15:23 2015
@@ -33,34 +33,29 @@ ENABLE_EXCEPTIONS=TRUE
 
 .INCLUDE :  settings.mk
 
+.IF "$(ENABLE_UNIT_TESTS)" != "YES"
+all:
+       @echo unit tests are disabled. Nothing to do.
+
+.ELSE
+
 CFLAGS+= $(LFS_CFLAGS)
 CXXFLAGS+= $(LFS_CFLAGS)
 
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
-
 # BEGIN ----------------------------------------------------------------
 # auto generated Target:joblist by codegen.pl
-SHL1OBJS=  \
+APP1OBJS=  \
        $(SLO)$/rtl_cipher.obj
 
-SHL1TARGET= rtl_cipher
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-# SHL1DEF=    $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME    =$(SHL1TARGET)
-# DEF2EXPORTFILE= export.exp
-SHL1VERSIONMAP= $(PRJ)$/qa$/export.map
+APP1TARGET= rtl_cipher
+APP1STDLIBS= $(SALLIB) $(GTESTLIB) $(TESTSHL2LIB)
+APP1RPATH = NONE
+APP1TEST = enabled
 # auto generated Target:joblist
 # END ------------------------------------------------------------------
 
-#------------------------------- All object files 
-------------------------------
-# do this here, so we get right dependencies
-# SLOFILES=$(SHL1OBJS)
-
 # --- Targets ------------------------------------------------------
 
 .INCLUDE :  target.mk
-.INCLUDE : _cppunit.mk
 
+.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES"

Modified: openoffice/trunk/main/sal/qa/rtl/cipher/rtl_cipher.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sal/qa/rtl/cipher/rtl_cipher.cxx?rev=1700604&r1=1700603&r2=1700604&view=diff
==============================================================================
--- openoffice/trunk/main/sal/qa/rtl/cipher/rtl_cipher.cxx (original)
+++ openoffice/trunk/main/sal/qa/rtl/cipher/rtl_cipher.cxx Tue Sep  1 16:15:23 
2015
@@ -25,7 +25,7 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sal.hxx"
 
-#include <testshl/simpleheader.hxx>
+#include "gtest/gtest.h"
 #include <rtl/strbuf.hxx>
 #include <rtl/cipher.h>
 
@@ -42,7 +42,7 @@ rtl::OString createHex(sal_uInt8 *_pKeyB
         sal_Int32 nValue = (sal_Int32)_pKeyBuffer[i];
         if (nValue < 16)                         // maximul hex value for 1 
byte
         {
-            aBuffer.append( sal_Int32(0), 16 /* radix */ );
+            aBuffer.append( sal_Int32(0), sal_Int16(16) /* radix */ );
         }
         aBuffer.append( nValue, 16 /* radix */ );
     }
@@ -52,662 +52,565 @@ rtl::OString createHex(sal_uInt8 *_pKeyB
 
 // 
-----------------------------------------------------------------------------
 
-class create : public CppUnit::TestFixture
+class create : public ::testing::Test
 {
 public:
     // initialise your test code values here.
-    void setUp()
+    void SetUp()
     {
     }
 
-    void tearDown()
+    void TearDown()
     {
     }
-
-    void create_001()
-        {
-            rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeECB);
-            CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
-            rtl_cipher_destroy(aCipher);
-        }
-    void create_002()
-        {
-            rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmInvalid, 
rtl_Cipher_ModeECB);
-            CPPUNIT_ASSERT_MESSAGE("create provide wrong object.", aCipher == 
NULL);
-        }
-    void create_003()
-        {
-            rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeCBC);
-            CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
-            rtl_cipher_destroy(aCipher);
-        }
-    void create_004()
-        {
-            rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmInvalid, 
rtl_Cipher_ModeCBC);
-            CPPUNIT_ASSERT_MESSAGE("create provide wrong object.", aCipher == 
NULL);
-        }
-    void create_005()
-        {
-            rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeStream);
-            CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
-            rtl_cipher_destroy(aCipher);
-        }
-    void create_006()
-        {
-            rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmInvalid, 
rtl_Cipher_ModeStream);
-            CPPUNIT_ASSERT_MESSAGE("create provide wrong object.", aCipher == 
NULL);
-        }
-    void create_007()
-        {
-            rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeInvalid);
-            CPPUNIT_ASSERT_MESSAGE("create provide wrong object.", aCipher == 
NULL);
-        }
-    void create_008()
-        {
-            rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmInvalid, 
rtl_Cipher_ModeInvalid);
-            CPPUNIT_ASSERT_MESSAGE("create provide wrong object.", aCipher == 
NULL);
-        }
-
-    // Change the following lines only, if you add, remove or rename
-    // member functions of the current class,
-    // because these macros are need by auto register mechanism.
-
-    CPPUNIT_TEST_SUITE(create);
-    CPPUNIT_TEST(create_001);
-    CPPUNIT_TEST(create_002);
-    CPPUNIT_TEST(create_003);
-    CPPUNIT_TEST(create_004);
-    CPPUNIT_TEST(create_005);
-    CPPUNIT_TEST(create_006);
-    CPPUNIT_TEST(create_007);
-    CPPUNIT_TEST(create_008);
-    CPPUNIT_TEST_SUITE_END();
 }; // class create
 
+TEST_F(create, create_001)
+{
+    rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeECB);
+    ASSERT_TRUE(aCipher != NULL) << "create failed.";
+    rtl_cipher_destroy(aCipher);
+}
+TEST_F(create, create_002)
+{
+    rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmInvalid, 
rtl_Cipher_ModeECB);
+    ASSERT_TRUE(aCipher == NULL) << "create provide wrong object.";
+}
+TEST_F(create, create_003)
+{
+    rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeCBC);
+    ASSERT_TRUE(aCipher != NULL) << "create failed.";
+    rtl_cipher_destroy(aCipher);
+}
+TEST_F(create, create_004)
+{
+    rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmInvalid, 
rtl_Cipher_ModeCBC);
+    ASSERT_TRUE(aCipher == NULL) << "create provide wrong object.";
+}
+TEST_F(create, create_005)
+{
+    rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeStream);
+    ASSERT_TRUE(aCipher != NULL) << "create failed.";
+    rtl_cipher_destroy(aCipher);
+}
+TEST_F(create, create_006)
+{
+    rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmInvalid, 
rtl_Cipher_ModeStream);
+    ASSERT_TRUE(aCipher == NULL) << "create provide wrong object.";
+}
+TEST_F(create, create_007)
+{
+    rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeInvalid);
+    ASSERT_TRUE(aCipher == NULL) << "create provide wrong object.";
+}
+TEST_F(create, create_008)
+{
+    rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmInvalid, 
rtl_Cipher_ModeInvalid);
+    ASSERT_TRUE(aCipher == NULL) << "create provide wrong object.";
+}
 // 
-----------------------------------------------------------------------------
-class createBF : public CppUnit::TestFixture
+class createBF : public ::testing::Test
 {
 public:
     // initialise your test code values here.
-    void setUp()
+    void SetUp()
     {
     }
 
-    void tearDown()
+    void TearDown()
     {
     }
-
-    void createBF_001()
-        {
-            rtlCipher aCipher = rtl_cipher_createBF(rtl_Cipher_ModeECB);
-            CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
-            rtl_cipher_destroy(aCipher);
-        }
-    void createBF_002()
-        {
-            rtlCipher aCipher = rtl_cipher_createBF(rtl_Cipher_ModeCBC);
-            CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
-            rtl_cipher_destroy(aCipher);
-        }
-    void createBF_003()
-        {
-            rtlCipher aCipher = rtl_cipher_createBF(rtl_Cipher_ModeStream);
-            CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
-            rtl_cipher_destroy(aCipher);
-        }
-    void createBF_004()
-        {
-            rtlCipher aCipher = rtl_cipher_createBF(rtl_Cipher_ModeInvalid);
-            CPPUNIT_ASSERT_MESSAGE("create provide wrong object.", aCipher == 
NULL);
-            // rtl_cipher_destroy(aCipher);
-        }
-    // Change the following lines only, if you add, remove or rename
-    // member functions of the current class,
-    // because these macros are need by auto register mechanism.
-
-    CPPUNIT_TEST_SUITE(createBF);
-    CPPUNIT_TEST(createBF_001);
-    CPPUNIT_TEST(createBF_002);
-    CPPUNIT_TEST(createBF_003);
-    CPPUNIT_TEST(createBF_004);
-    CPPUNIT_TEST_SUITE_END();
 }; // class createBF
+
+TEST_F(createBF, createBF_001)
+{
+    rtlCipher aCipher = rtl_cipher_createBF(rtl_Cipher_ModeECB);
+    ASSERT_TRUE(aCipher != NULL) << "create failed.";
+    rtl_cipher_destroy(aCipher);
+}
+TEST_F(createBF, createBF_002)
+{
+    rtlCipher aCipher = rtl_cipher_createBF(rtl_Cipher_ModeCBC);
+    ASSERT_TRUE(aCipher != NULL) << "create failed.";
+    rtl_cipher_destroy(aCipher);
+}
+TEST_F(createBF, createBF_003)
+{
+    rtlCipher aCipher = rtl_cipher_createBF(rtl_Cipher_ModeStream);
+    ASSERT_TRUE(aCipher != NULL) << "create failed.";
+    rtl_cipher_destroy(aCipher);
+}
+TEST_F(createBF, createBF_004)
+{
+    rtlCipher aCipher = rtl_cipher_createBF(rtl_Cipher_ModeInvalid);
+    ASSERT_TRUE(aCipher == NULL) << "create provide wrong object.";
+    // rtl_cipher_destroy(aCipher);
+}
 // 
-----------------------------------------------------------------------------
-class decode : public CppUnit::TestFixture
+class decode : public ::testing::Test
 {
 public:
     // initialise your test code values here.
-    void setUp()
+    void SetUp()
     {
     }
 
-    void tearDown()
+    void TearDown()
     {
     }
 
     void test_encode(sal_uInt8 _nKeyValue, sal_uInt8 _nArgValue, rtl::OString 
const& _sPlainTextStr)
-        {
-            rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeECB);
-            CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
+    {
+        rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeECB);
+        ASSERT_TRUE(aCipher != NULL) << "create failed.";
 
-            sal_uInt32     nKeyLen = 16;
-            sal_uInt8     *pKeyBuffer = new sal_uInt8[ nKeyLen ];
-            memset(pKeyBuffer, 0, nKeyLen);
-            pKeyBuffer[0] = _nKeyValue;
-
-            sal_uInt32     nArgLen = 16;
-            sal_uInt8     *pArgBuffer = new sal_uInt8[ nArgLen ];
-            memset(pArgBuffer, 0, nArgLen);
-            pArgBuffer[0] = _nArgValue;
-
-            t_print(T_VERBOSE, "  init Key: %s\n", createHex(pKeyBuffer, 
nKeyLen).getStr());
-            t_print(T_VERBOSE, "  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);
-
-            sal_uInt32     nPlainTextLen = 16;
-            sal_uInt8     *pPlainTextBuffer = new sal_uInt8[ nPlainTextLen ];
-            memset(pPlainTextBuffer, 0, nPlainTextLen);
-            strncpy((char*)pPlainTextBuffer, _sPlainTextStr.getStr(), 16);
-
-            sal_uInt32     nCipherLen = 16;
-            sal_uInt8     *pCipherBuffer = new sal_uInt8[ nCipherLen ];
-            memset(pCipherBuffer, 0, nCipherLen);
-
-            /* rtlCipherError */ aError = rtl_cipher_encode(aCipher, 
pPlainTextBuffer, nPlainTextLen, pCipherBuffer, nCipherLen);
-            CPPUNIT_ASSERT_MESSAGE("wrong encode", aError == 
rtl_Cipher_E_None);
-
-            t_print(T_VERBOSE, "       Key: %s\n", createHex(pKeyBuffer, 
nKeyLen).getStr());
-            t_print(T_VERBOSE, "       Arg: %s\n", createHex(pArgBuffer, 
nArgLen).getStr());
-            t_print(T_VERBOSE, "     Plain: %s\n", createHex(pPlainTextBuffer, 
nPlainTextLen).getStr());
-            t_print(           "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);
-            // t_print(T_VERBOSE, " Plain: %s\n", createHex(pPlainText2Buffer, 
nPlainText2Len).getStr());
-            // t_print(T_VERBOSE, " ascii: %s\n", sPlainText2Str.getStr());
-            //
-            // // t_print("   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);
-        }
+        sal_uInt32     nKeyLen = 16;
+        sal_uInt8     *pKeyBuffer = new sal_uInt8[ nKeyLen ];
+        memset(pKeyBuffer, 0, nKeyLen);
+        pKeyBuffer[0] = _nKeyValue;
+
+        sal_uInt32     nArgLen = 16;
+        sal_uInt8     *pArgBuffer = new sal_uInt8[ nArgLen ];
+        memset(pArgBuffer, 0, nArgLen);
+        pArgBuffer[0] = _nArgValue;
+
+        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);
+        ASSERT_TRUE(aError == rtl_Cipher_E_None) << "wrong init";
+
+        sal_uInt32     nPlainTextLen = 16;
+        sal_uInt8     *pPlainTextBuffer = new sal_uInt8[ nPlainTextLen ];
+        memset(pPlainTextBuffer, 0, nPlainTextLen);
+        strncpy((char*)pPlainTextBuffer, _sPlainTextStr.getStr(), 16);
+
+        sal_uInt32     nCipherLen = 16;
+        sal_uInt8     *pCipherBuffer = new sal_uInt8[ nCipherLen ];
+        memset(pCipherBuffer, 0, nCipherLen);
+
+        /* rtlCipherError */ aError = rtl_cipher_encode(aCipher, 
pPlainTextBuffer, nPlainTextLen, pCipherBuffer, nCipherLen);
+        ASSERT_TRUE(aError == rtl_Cipher_E_None) << "wrong encode";
+
+        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);
+        ASSERT_TRUE(aError != rtl_Cipher_E_None) << "decode should not work";
+
+        // 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);
+        //
+        // ASSERT_TRUE(nCompare == 0) << "compare between plain and decoded 
plain failed";
+        //
+        // delete [] pPlainText2Buffer;
+        //
+        // delete [] pCipherBuffer;
+        // delete [] pPlainTextBuffer;
+        //
+        // delete [] pArgBuffer;
+        // delete [] pKeyBuffer;
+        //
+        // rtl_cipher_destroy(aCipher);
+    }
 
     void test_encode_and_decode(sal_uInt8 _nKeyValue, sal_uInt8 _nArgValue, 
rtl::OString const& _sPlainTextStr)
-        {
-            rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeECB);
-            CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
+    {
+        rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeECB);
+        ASSERT_TRUE(aCipher != NULL) << "create failed.";
 
-            sal_uInt32     nKeyLen = 16;
-            sal_uInt8     *pKeyBuffer = new sal_uInt8[ nKeyLen ];
-            memset(pKeyBuffer, 0, nKeyLen);
-            pKeyBuffer[0] = _nKeyValue;
+        sal_uInt32     nKeyLen = 16;
+        sal_uInt8     *pKeyBuffer = new sal_uInt8[ nKeyLen ];
+        memset(pKeyBuffer, 0, nKeyLen);
+        pKeyBuffer[0] = _nKeyValue;
 
-            sal_uInt32     nArgLen = 16;
-            sal_uInt8     *pArgBuffer = new sal_uInt8[ nArgLen ];
-            memset(pArgBuffer, 0, nArgLen);
-            pArgBuffer[0] = _nArgValue;
+        sal_uInt32     nArgLen = 16;
+        sal_uInt8     *pArgBuffer = new sal_uInt8[ nArgLen ];
+        memset(pArgBuffer, 0, nArgLen);
+        pArgBuffer[0] = _nArgValue;
 
-            t_print(T_VERBOSE, "  init Key: %s\n", createHex(pKeyBuffer, 
nKeyLen).getStr());
-            t_print(T_VERBOSE, "  init Arg: %s\n", createHex(pArgBuffer, 
nArgLen).getStr());
+        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);
+        rtlCipherError aError = rtl_cipher_init(aCipher, 
rtl_Cipher_DirectionBoth, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
+        ASSERT_TRUE(aError == rtl_Cipher_E_None) << "wrong init";
 
-            sal_uInt32     nPlainTextLen = 16;
-            sal_uInt8     *pPlainTextBuffer = new sal_uInt8[ nPlainTextLen ];
-            memset(pPlainTextBuffer, 0, nPlainTextLen);
-            strncpy((char*)pPlainTextBuffer, _sPlainTextStr.getStr(), 16);
+        sal_uInt32     nPlainTextLen = 16;
+        sal_uInt8     *pPlainTextBuffer = new sal_uInt8[ nPlainTextLen ];
+        memset(pPlainTextBuffer, 0, nPlainTextLen);
+        strncpy((char*)pPlainTextBuffer, _sPlainTextStr.getStr(), 16);
 
-            sal_uInt32     nCipherLen = 16;
-            sal_uInt8     *pCipherBuffer = new sal_uInt8[ nCipherLen ];
-            memset(pCipherBuffer, 0, nCipherLen);
+        sal_uInt32     nCipherLen = 16;
+        sal_uInt8     *pCipherBuffer = new sal_uInt8[ nCipherLen ];
+        memset(pCipherBuffer, 0, nCipherLen);
 
-            /* rtlCipherError */ aError = rtl_cipher_encode(aCipher, 
pPlainTextBuffer, nPlainTextLen, pCipherBuffer, nCipherLen);
-            CPPUNIT_ASSERT_MESSAGE("wrong encode", aError == 
rtl_Cipher_E_None);
+        /* rtlCipherError */ aError = rtl_cipher_encode(aCipher, 
pPlainTextBuffer, nPlainTextLen, pCipherBuffer, nCipherLen);
+        ASSERT_TRUE(aError == rtl_Cipher_E_None) << "wrong encode";
 
-            t_print(T_VERBOSE, "       Key: %s\n", createHex(pKeyBuffer, 
nKeyLen).getStr());
-            t_print(T_VERBOSE, "       Arg: %s\n", createHex(pArgBuffer, 
nArgLen).getStr());
-            t_print(T_VERBOSE, "     Plain: %s\n", createHex(pPlainTextBuffer, 
nPlainTextLen).getStr());
-            t_print(           "Cipher Buf: %s\n", createHex(pCipherBuffer, 
nCipherLen).getStr());
+        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);
+        sal_uInt32     nPlainText2Len = 16;
+        sal_uInt8     *pPlainText2Buffer = new sal_uInt8[ nPlainText2Len ];
+        memset(pPlainText2Buffer, 0, nPlainText2Len);
 
-            /* rtlCipherError */ aError = rtl_cipher_decode(aCipher, 
pCipherBuffer, nCipherLen, pPlainText2Buffer, nPlainText2Len);
-            CPPUNIT_ASSERT_MESSAGE("wrong decode", aError == 
rtl_Cipher_E_None);
+        /* rtlCipherError */ aError = rtl_cipher_decode(aCipher, 
pCipherBuffer, nCipherLen, pPlainText2Buffer, nPlainText2Len);
+        ASSERT_TRUE(aError == rtl_Cipher_E_None) << "wrong decode";
 
-            rtl::OString sPlainText2Str((char*)pPlainText2Buffer, 
nPlainText2Len);
-            t_print(T_VERBOSE, "     Plain: %s\n", 
createHex(pPlainText2Buffer, nPlainText2Len).getStr());
-            t_print(T_VERBOSE, "  as ascii: %s\n", sPlainText2Str.getStr());
+        rtl::OString sPlainText2Str((char*)pPlainText2Buffer, nPlainText2Len);
+        printf("     Plain: %s\n", createHex(pPlainText2Buffer, 
nPlainText2Len).getStr());
+        printf("  as ascii: %s\n", sPlainText2Str.getStr());
 
-            // t_print("   Buf: %s\n", createHex(pCipherBuffer, 
nCipherLen).getStr());
+        // printf("   Buf: %s\n", createHex(pCipherBuffer, 
nCipherLen).getStr());
 
-            sal_Int32 nCompare = memcmp(pPlainTextBuffer, pPlainText2Buffer, 
16);
+        sal_Int32 nCompare = memcmp(pPlainTextBuffer, pPlainText2Buffer, 16);
 
-            CPPUNIT_ASSERT_MESSAGE("compare between plain and decoded plain 
failed", nCompare == 0);
+        ASSERT_TRUE(nCompare == 0) << "compare between plain and decoded plain 
failed";
 
-            delete [] pPlainText2Buffer;
+        delete [] pPlainText2Buffer;
 
-            delete [] pCipherBuffer;
-            delete [] pPlainTextBuffer;
+        delete [] pCipherBuffer;
+        delete [] pPlainTextBuffer;
 
-            delete [] pArgBuffer;
-            delete [] pKeyBuffer;
+        delete [] pArgBuffer;
+        delete [] pKeyBuffer;
 
-            rtl_cipher_destroy(aCipher);
-        }
+        rtl_cipher_destroy(aCipher);
+    }
+}; // class decode
 
-    void decode_001()
-        {
-            test_encode_and_decode(0,0,"");
-            test_encode_and_decode(0,0,"hallo");
-            test_encode_and_decode(1,0,"B2Aahg5B");
-            test_encode_and_decode(1,2,"Longer text string");
-        }
+TEST_F(decode, decode_001)
+{
+    test_encode_and_decode(0,0,"");
+    test_encode_and_decode(0,0,"hallo");
+    test_encode_and_decode(1,0,"B2Aahg5B");
+    test_encode_and_decode(1,2,"Longer text string");
+}
 
-    void decode_002()
-        {
-            test_encode(0,0,"");
-            test_encode(0,0,"hallo");
-            test_encode(1,0,"B2Aahg5B");
-            test_encode(1,2,"Longer text string");
-        }
-    // Change the following lines only, if you add, remove or rename
-    // member functions of the current class,
-    // because these macros are need by auto register mechanism.
-
-    CPPUNIT_TEST_SUITE(decode);
-    CPPUNIT_TEST(decode_001);
-    CPPUNIT_TEST(decode_002);
-    CPPUNIT_TEST_SUITE_END();
-}; // class decode
+TEST_F(decode, decode_002)
+{
+    test_encode(0,0,"");
+    test_encode(0,0,"hallo");
+    test_encode(1,0,"B2Aahg5B");
+    test_encode(1,2,"Longer text string");
+}
 // 
-----------------------------------------------------------------------------
-class decodeBF : public CppUnit::TestFixture
+class decodeBF : public ::testing::Test
 {
 public:
     // initialise your test code values here.
-    void setUp()
+    void SetUp()
     {
     }
 
-    void tearDown()
+    void TearDown()
     {
     }
-
-    void decodeBF_001()
-        {
-        }
-    // Change the following lines only, if you add, remove or rename
-    // member functions of the current class,
-    // because these macros are need by auto register mechanism.
-
-    CPPUNIT_TEST_SUITE(decodeBF);
-    CPPUNIT_TEST(decodeBF_001);
-    CPPUNIT_TEST_SUITE_END();
 }; // class decodeBF
+
+TEST_F(decodeBF, decodeBF_001)
+{
+}
+
 // 
-----------------------------------------------------------------------------
-class destroy : public CppUnit::TestFixture
+class destroy : public ::testing::Test
 {
 public:
     // initialise your test code values here.
-    void setUp()
+    void SetUp()
     {
     }
 
-    void tearDown()
+    void TearDown()
     {
     }
-
-    void destroy_001()
-        {
-            rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeCBC);
-            CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
-            rtl_cipher_destroy(aCipher);
-        }
-    // Change the following lines only, if you add, remove or rename
-    // member functions of the current class,
-    // because these macros are need by auto register mechanism.
-
-    CPPUNIT_TEST_SUITE(destroy);
-    CPPUNIT_TEST(destroy_001);
-    CPPUNIT_TEST_SUITE_END();
 }; // class destroy
+
+TEST_F(destroy, destroy_001)
+{
+    rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeCBC);
+    ASSERT_TRUE(aCipher != NULL) << "create failed.";
+    rtl_cipher_destroy(aCipher);
+}
+
 // 
-----------------------------------------------------------------------------
-class destroyBF : public CppUnit::TestFixture
+class destroyBF : public ::testing::Test
 {
 public:
     // initialise your test code values here.
-    void setUp()
+    void SetUp()
     {
     }
 
-    void tearDown()
+    void TearDown()
     {
     }
-
-    void destroyBF_001()
-        {
-            rtlCipher aCipher = rtl_cipher_createBF(rtl_Cipher_ModeECB);
-            CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
-            rtl_cipher_destroyBF(aCipher);
-            // more proforma
-            // should not GPF
-        }
-    // Change the following lines only, if you add, remove or rename
-    // member functions of the current class,
-    // because these macros are need by auto register mechanism.
-
-    CPPUNIT_TEST_SUITE(destroyBF);
-    CPPUNIT_TEST(destroyBF_001);
-    CPPUNIT_TEST_SUITE_END();
 }; // class destroyBF
+
+TEST_F(destroyBF, destroyBF_001)
+{
+    rtlCipher aCipher = rtl_cipher_createBF(rtl_Cipher_ModeECB);
+    ASSERT_TRUE(aCipher != NULL) << "create failed.";
+    rtl_cipher_destroyBF(aCipher);
+    // more proforma
+    // should not GPF
+}
+
 // 
-----------------------------------------------------------------------------
-class encode : public CppUnit::TestFixture
+class encode : public ::testing::Test
 {
 public:
     // initialise your test code values here.
-    void setUp()
+    void SetUp()
     {
     }
 
-    void tearDown()
+    void TearDown()
     {
     }
+}; // class encode
 
-    void test_encode(sal_uInt8 _nKeyValue, sal_uInt8 _nArgValue, sal_uInt8 
_nDataValue)
-        {
-            rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeECB);
-            CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
-
-            sal_uInt32     nKeyLen = 16;
-            sal_uInt8     *pKeyBuffer = new sal_uInt8[ nKeyLen ];
-            memset(pKeyBuffer, 0, nKeyLen);
-            pKeyBuffer[0] = _nKeyValue;
+void test_encode(sal_uInt8 _nKeyValue, sal_uInt8 _nArgValue, sal_uInt8 
_nDataValue)
+{
+    rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeECB);
+    ASSERT_TRUE(aCipher != NULL) << "create failed.";
 
-            sal_uInt32     nArgLen = 16;
-            sal_uInt8     *pArgBuffer = new sal_uInt8[ nArgLen ];
-            memset(pArgBuffer, 0, nArgLen);
-            pArgBuffer[0] = _nArgValue;
+    sal_uInt32     nKeyLen = 16;
+    sal_uInt8     *pKeyBuffer = new sal_uInt8[ nKeyLen ];
+    memset(pKeyBuffer, 0, nKeyLen);
+    pKeyBuffer[0] = _nKeyValue;
 
-            t_print(T_VERBOSE, "init Key: %s\n", createHex(pKeyBuffer, 
nKeyLen).getStr());
-            t_print(T_VERBOSE, "init Arg: %s\n", createHex(pArgBuffer, 
nArgLen).getStr());
+    sal_uInt32     nArgLen = 16;
+    sal_uInt8     *pArgBuffer = new sal_uInt8[ nArgLen ];
+    memset(pArgBuffer, 0, nArgLen);
+    pArgBuffer[0] = _nArgValue;
 
-            rtlCipherError aError = rtl_cipher_init(aCipher, 
rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
-            CPPUNIT_ASSERT_MESSAGE("wrong init", aError == rtl_Cipher_E_None);
+    printf("init Key: %s\n", createHex(pKeyBuffer, nKeyLen).getStr());
+    printf("init Arg: %s\n", createHex(pArgBuffer, nArgLen).getStr());
 
-            sal_uInt32     nDataLen = 16;
-            sal_uInt8     *pDataBuffer = new sal_uInt8[ nDataLen ];
-            memset(pDataBuffer, 0, nDataLen);
-            pDataBuffer[0] = _nDataValue;
+    rtlCipherError aError = rtl_cipher_init(aCipher, 
rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
+    ASSERT_TRUE(aError == rtl_Cipher_E_None) << "wrong init";
 
-            sal_uInt32     nLen = 16;
-            sal_uInt8     *pBuffer = new sal_uInt8[ nLen ];
-            memset(pBuffer, 0, nLen);
+    sal_uInt32     nDataLen = 16;
+    sal_uInt8     *pDataBuffer = new sal_uInt8[ nDataLen ];
+    memset(pDataBuffer, 0, nDataLen);
+    pDataBuffer[0] = _nDataValue;
 
-            /* rtlCipherError */ aError = rtl_cipher_encode(aCipher, 
pDataBuffer, nDataLen, pBuffer, nLen);
-            CPPUNIT_ASSERT_MESSAGE("wrong encode", aError == 
rtl_Cipher_E_None);
+    sal_uInt32     nLen = 16;
+    sal_uInt8     *pBuffer = new sal_uInt8[ nLen ];
+    memset(pBuffer, 0, nLen);
 
-            t_print(T_VERBOSE, " Key: %s\n", createHex(pKeyBuffer, 
nKeyLen).getStr());
-            t_print(T_VERBOSE, " Arg: %s\n", createHex(pArgBuffer, 
nArgLen).getStr());
-            t_print(T_VERBOSE, "Data: %s\n", createHex(pDataBuffer, 
nDataLen).getStr());
-            t_print(T_VERBOSE, " Buf: %s\n", createHex(pBuffer, 
nLen).getStr());
+    /* rtlCipherError */ aError = rtl_cipher_encode(aCipher, pDataBuffer, 
nDataLen, pBuffer, nLen);
+    ASSERT_TRUE(aError == rtl_Cipher_E_None) << "wrong encode";
 
-            delete [] pBuffer;
-            delete [] pDataBuffer;
+    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 [] pArgBuffer;
-            delete [] pKeyBuffer;
+    delete [] pBuffer;
+    delete [] pDataBuffer;
 
-            rtl_cipher_destroy(aCipher);
-        }
+    delete [] pArgBuffer;
+    delete [] pKeyBuffer;
 
-    void encode_001()
-        {
-            test_encode(0,0,0);
-            test_encode(1,0,0);
-            test_encode(0,1,0);
-            test_encode(1,1,0);
-
-            test_encode(0,0,1);
-            test_encode(1,0,1);
-            test_encode(0,1,1);
-            test_encode(1,1,1);
-        }
+    rtl_cipher_destroy(aCipher);
+}
 
-    // Change the following lines only, if you add, remove or rename
-    // member functions of the current class,
-    // because these macros are need by auto register mechanism.
-
-    CPPUNIT_TEST_SUITE(encode);
-    CPPUNIT_TEST(encode_001);
-    CPPUNIT_TEST_SUITE_END();
-}; // class encode
+void encode_001()
+{
+    test_encode(0,0,0);
+    test_encode(1,0,0);
+    test_encode(0,1,0);
+    test_encode(1,1,0);
+
+    test_encode(0,0,1);
+    test_encode(1,0,1);
+    test_encode(0,1,1);
+    test_encode(1,1,1);
+}
 // 
-----------------------------------------------------------------------------
-class encodeBF : public CppUnit::TestFixture
+class encodeBF : public ::testing::Test
 {
 public:
     // initialise your test code values here.
-    void setUp()
+    void SetUp()
     {
     }
 
-    void tearDown()
+    void TearDown()
     {
     }
-
-    void encodeBF_001()
-        {
-        }
-    // Change the following lines only, if you add, remove or rename
-    // member functions of the current class,
-    // because these macros are need by auto register mechanism.
-
-    CPPUNIT_TEST_SUITE(encodeBF);
-    CPPUNIT_TEST(encodeBF_001);
-    CPPUNIT_TEST_SUITE_END();
 }; // class encodeBF
+
+TEST_F(encodeBF, encodeBF_001)
+{
+}
+
 // 
-----------------------------------------------------------------------------
-class init : public CppUnit::TestFixture
+class init : public ::testing::Test
 {
 public:
     // initialise your test code values here.
-    void setUp()
+    void SetUp()
     {
     }
 
-    void tearDown()
+    void TearDown()
     {
     }
+}; // class init
 
-    void init_001()
-        {
-            rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeECB);
-            CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
+TEST_F(init, init_001)
+{
+    rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeECB);
+    ASSERT_TRUE(aCipher != NULL) << "create failed.";
 
-            sal_uInt32     nKeyLen = 16;
-            sal_uInt8     *pKeyBuffer = new sal_uInt8[ nKeyLen ];
-            memset(pKeyBuffer, 0, nKeyLen);
+    sal_uInt32     nKeyLen = 16;
+    sal_uInt8     *pKeyBuffer = new sal_uInt8[ nKeyLen ];
+    memset(pKeyBuffer, 0, nKeyLen);
 
-            sal_uInt32     nArgLen = 16;
-            sal_uInt8     *pArgBuffer = new sal_uInt8[ nArgLen ];
-            memset(pArgBuffer, 0, nArgLen);
+    sal_uInt32     nArgLen = 16;
+    sal_uInt8     *pArgBuffer = new sal_uInt8[ nArgLen ];
+    memset(pArgBuffer, 0, nArgLen);
 
-            t_print(T_VERBOSE, "Key: %s\n", createHex(pKeyBuffer, 
nKeyLen).getStr());
-            t_print(T_VERBOSE, "Arg: %s\n", createHex(pArgBuffer, 
nArgLen).getStr());
+    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);
+    rtlCipherError aError = rtl_cipher_init(aCipher, 
rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
+    ASSERT_TRUE(aError == rtl_Cipher_E_None) << "wrong init";
 
-            t_print(T_VERBOSE, "Key: %s\n", createHex(pKeyBuffer, 
nKeyLen).getStr());
-            t_print(T_VERBOSE, "Arg: %s\n", createHex(pArgBuffer, 
nArgLen).getStr());
+    printf("Key: %s\n", createHex(pKeyBuffer, nKeyLen).getStr());
+    printf("Arg: %s\n", createHex(pArgBuffer, nArgLen).getStr());
 
-            delete [] pArgBuffer;
-            delete [] pKeyBuffer;
+    delete [] pArgBuffer;
+    delete [] pKeyBuffer;
 
-            rtl_cipher_destroy(aCipher);
-        }
+    rtl_cipher_destroy(aCipher);
+}
 
-    void init_002()
-        {
-            rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeECB);
-            CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
+TEST_F(init, init_002)
+{
+    rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeECB);
+    ASSERT_TRUE(aCipher != NULL) << "create failed.";
 
-            sal_uInt32     nKeyLen = 16;
-            sal_uInt8     *pKeyBuffer = new sal_uInt8[ nKeyLen ];
-            memset(pKeyBuffer, 0, nKeyLen);
-            pKeyBuffer[0] = 1;
+    sal_uInt32     nKeyLen = 16;
+    sal_uInt8     *pKeyBuffer = new sal_uInt8[ nKeyLen ];
+    memset(pKeyBuffer, 0, nKeyLen);
+    pKeyBuffer[0] = 1;
 
-            sal_uInt32     nArgLen = 16;
-            sal_uInt8     *pArgBuffer = new sal_uInt8[ nArgLen ];
-            memset(pArgBuffer, 0, nArgLen);
+    sal_uInt32     nArgLen = 16;
+    sal_uInt8     *pArgBuffer = new sal_uInt8[ nArgLen ];
+    memset(pArgBuffer, 0, nArgLen);
 
-            t_print(T_VERBOSE, "Key: %s\n", createHex(pKeyBuffer, 
nKeyLen).getStr());
-            t_print(T_VERBOSE, "Arg: %s\n", createHex(pArgBuffer, 
nArgLen).getStr());
+    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);
+    rtlCipherError aError = rtl_cipher_init(aCipher, 
rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
+    ASSERT_TRUE(aError == rtl_Cipher_E_None) << "wrong init";
 
-            t_print(T_VERBOSE, "Key: %s\n", createHex(pKeyBuffer, 
nKeyLen).getStr());
-            t_print(T_VERBOSE, "Arg: %s\n", createHex(pArgBuffer, 
nArgLen).getStr());
+    printf("Key: %s\n", createHex(pKeyBuffer, nKeyLen).getStr());
+    printf("Arg: %s\n", createHex(pArgBuffer, nArgLen).getStr());
 
-            delete [] pArgBuffer;
-            delete [] pKeyBuffer;
+    delete [] pArgBuffer;
+    delete [] pKeyBuffer;
 
-            rtl_cipher_destroy(aCipher);
-        }
-    void init_003()
-        {
-            rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeECB);
-            CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
+    rtl_cipher_destroy(aCipher);
+}
+TEST_F(init, init_003)
+{
+    rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeECB);
+    ASSERT_TRUE(aCipher != NULL) << "create failed.";
 
-            sal_uInt32     nKeyLen = 16;
-            sal_uInt8     *pKeyBuffer = new sal_uInt8[ nKeyLen ];
-            memset(pKeyBuffer, 0, nKeyLen);
+    sal_uInt32     nKeyLen = 16;
+    sal_uInt8     *pKeyBuffer = new sal_uInt8[ nKeyLen ];
+    memset(pKeyBuffer, 0, nKeyLen);
 
-            sal_uInt32     nArgLen = 16;
-            sal_uInt8     *pArgBuffer = new sal_uInt8[ nArgLen ];
-            memset(pArgBuffer, 0, nArgLen);
-            pArgBuffer[0] = 1;
+    sal_uInt32     nArgLen = 16;
+    sal_uInt8     *pArgBuffer = new sal_uInt8[ nArgLen ];
+    memset(pArgBuffer, 0, nArgLen);
+    pArgBuffer[0] = 1;
 
-            t_print(T_VERBOSE, "Key: %s\n", createHex(pKeyBuffer, 
nKeyLen).getStr());
-            t_print(T_VERBOSE, "Arg: %s\n", createHex(pArgBuffer, 
nArgLen).getStr());
+    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);
+    rtlCipherError aError = rtl_cipher_init(aCipher, 
rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
+    ASSERT_TRUE(aError == rtl_Cipher_E_None) << "wrong init";
 
-            t_print(T_VERBOSE, "Key: %s\n", createHex(pKeyBuffer, 
nKeyLen).getStr());
-            t_print(T_VERBOSE, "Arg: %s\n", createHex(pArgBuffer, 
nArgLen).getStr());
+    printf("Key: %s\n", createHex(pKeyBuffer, nKeyLen).getStr());
+    printf("Arg: %s\n", createHex(pArgBuffer, nArgLen).getStr());
 
-            delete [] pArgBuffer;
-            delete [] pKeyBuffer;
+    delete [] pArgBuffer;
+    delete [] pKeyBuffer;
 
-            rtl_cipher_destroy(aCipher);
-        }
-    void init_004()
-        {
-            rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeECB);
-            CPPUNIT_ASSERT_MESSAGE("create failed.", aCipher != NULL);
+    rtl_cipher_destroy(aCipher);
+}
+TEST_F(init, init_004)
+{
+    rtlCipher aCipher = rtl_cipher_create(rtl_Cipher_AlgorithmBF, 
rtl_Cipher_ModeECB);
+    ASSERT_TRUE(aCipher != NULL) << "create failed.";
 
-            sal_uInt32     nKeyLen = 16;
-            sal_uInt8     *pKeyBuffer = new sal_uInt8[ nKeyLen ];
-            memset(pKeyBuffer, 0, nKeyLen);
-            pKeyBuffer[0] = 1;
+    sal_uInt32     nKeyLen = 16;
+    sal_uInt8     *pKeyBuffer = new sal_uInt8[ nKeyLen ];
+    memset(pKeyBuffer, 0, nKeyLen);
+    pKeyBuffer[0] = 1;
 
-            sal_uInt32     nArgLen = 16;
-            sal_uInt8     *pArgBuffer = new sal_uInt8[ nArgLen ];
-            memset(pArgBuffer, 0, nArgLen);
-            pArgBuffer[0] = 1;
+    sal_uInt32     nArgLen = 16;
+    sal_uInt8     *pArgBuffer = new sal_uInt8[ nArgLen ];
+    memset(pArgBuffer, 0, nArgLen);
+    pArgBuffer[0] = 1;
 
-            t_print(T_VERBOSE, "Key: %s\n", createHex(pKeyBuffer, 
nKeyLen).getStr());
-            t_print(T_VERBOSE, "Arg: %s\n", createHex(pArgBuffer, 
nArgLen).getStr());
+    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);
+    rtlCipherError aError = rtl_cipher_init(aCipher, 
rtl_Cipher_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
+    ASSERT_TRUE(aError == rtl_Cipher_E_None) << "wrong init";
 
-            t_print(T_VERBOSE, "Key: %s\n", createHex(pKeyBuffer, 
nKeyLen).getStr());
-            t_print(T_VERBOSE, "Arg: %s\n", createHex(pArgBuffer, 
nArgLen).getStr());
+    printf("Key: %s\n", createHex(pKeyBuffer, nKeyLen).getStr());
+    printf("Arg: %s\n", createHex(pArgBuffer, nArgLen).getStr());
 
-            delete [] pArgBuffer;
-            delete [] pKeyBuffer;
+    delete [] pArgBuffer;
+    delete [] pKeyBuffer;
 
-            rtl_cipher_destroy(aCipher);
-        }
-    // Change the following lines only, if you add, remove or rename
-    // member functions of the current class,
-    // because these macros are need by auto register mechanism.
-
-    CPPUNIT_TEST_SUITE(init);
-    CPPUNIT_TEST(init_001);
-    CPPUNIT_TEST(init_002);
-    CPPUNIT_TEST(init_003);
-    CPPUNIT_TEST(init_004);
-    CPPUNIT_TEST_SUITE_END();
-}; // class init
+    rtl_cipher_destroy(aCipher);
+}
 // 
-----------------------------------------------------------------------------
-class initBF : public CppUnit::TestFixture
+class initBF : public ::testing::Test
 {
 public:
     // initialise your test code values here.
-    void setUp()
+    void SetUp()
     {
     }
 
-    void tearDown()
+    void TearDown()
     {
     }
-
-    void initBF_001()
-        {
-            // seems to be the same as init, so empty
-        }
-
-    // Change the following lines only, if you add, remove or rename
-    // member functions of the current class,
-    // because these macros are need by auto register mechanism.
-
-    CPPUNIT_TEST_SUITE(initBF);
-    CPPUNIT_TEST(initBF_001);
-    CPPUNIT_TEST_SUITE_END();
 }; // class initBF
 
-// 
-----------------------------------------------------------------------------
+TEST_F(initBF, initBF_001)
+{
+    // seems to be the same as init, so empty
+}
 
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_cipher::create, "rtl_cipher");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_cipher::createBF, "rtl_cipher");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_cipher::decode, "rtl_cipher");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_cipher::decodeBF, "rtl_cipher");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_cipher::destroy, "rtl_cipher");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_cipher::destroyBF, "rtl_cipher");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_cipher::encode, "rtl_cipher");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_cipher::encodeBF, "rtl_cipher");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_cipher::init, "rtl_cipher");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_cipher::initBF, "rtl_cipher");
 
 } // namespace rtl_cipher
 
-
-// 
-----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the 
RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-NOADDITIONAL;
+int main(int argc, char **argv)
+{
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}


Reply via email to