[Libreoffice-commits] .: 8 commits - sal/qa
Caolán McNamara
caolan at kemper.freedesktop.org
Fri Mar 18 02:37:13 PDT 2011
sal/qa/inc/valueequal.hxx | 32 +++----
sal/qa/rtl/cipher/rtl_cipher.cxx | 112 +++++++++++++------------
sal/qa/rtl/crc32/jobfile.txt | 5 -
sal/qa/rtl/crc32/rtl_crc32.cxx | 9 +-
sal/qa/rtl/doublelock/rtl_doublelocking.cxx | 35 ++++---
sal/qa/rtl/locale/rtl_locale.cxx | 62 ++++++++------
sal/qa/rtl/logfile/rtl_logfile.cxx | 23 ++---
sal/qa/rtl/math/export.exp | 1
sal/qa/rtl/math/rtl_math.cxx | 9 +-
sal/qa/rtl/math/test_rtl_math.cxx | 123 ++++++++++++----------------
sal/qa/rtl/ostring/joblist.txt | 10 --
sal/qa/rtl/ostring/rtl_OString2.cxx | 29 +++---
sal/qa/rtl/ostring/rtl_str.cxx | 48 ++++++----
sal/qa/rtl/ostring/rtl_string.cxx | 16 ++-
14 files changed, 263 insertions(+), 251 deletions(-)
New commits:
commit 712ca1cd5a3e9796d9dcb752b1c53d588f26f43d
Author: Theo van Klaveren <theo.van.klaveren at gmail.com>
Date: Thu Mar 17 14:40:51 2011 +0100
Remove some now-unneeded files.
diff --git a/sal/qa/rtl/crc32/jobfile.txt b/sal/qa/rtl/crc32/jobfile.txt
deleted file mode 100755
index ddf886b..0000000
--- a/sal/qa/rtl/crc32/jobfile.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-# JobFile for rtl_crc32
-# header source sal/inc/rtl/crc.h
-
-rtl_crc32.test.rtl_crc32_001
-rtl_crc32.test.rtl_crc32_002
diff --git a/sal/qa/rtl/math/export.exp b/sal/qa/rtl/math/export.exp
deleted file mode 100644
index a13529d..0000000
--- a/sal/qa/rtl/math/export.exp
+++ /dev/null
@@ -1 +0,0 @@
-registerAllTestFunction
diff --git a/sal/qa/rtl/ostring/joblist.txt b/sal/qa/rtl/ostring/joblist.txt
deleted file mode 100644
index 81d1b7a..0000000
--- a/sal/qa/rtl/ostring/joblist.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-# JobFile for rtl_OString
-# header source sal/inc/rtl/string.hxx
-
-rtl_OString.valueOf.valueOf_test_001
-rtl_OString.valueOf.valueOf_test_002
-rtl_OString.valueOf.valueOf_test_003
-rtl_OString.valueOf.valueOf_test_004
-rtl_OString.valueOf.valueOf_test_005
-rtl_OString.valueOf.valueOf_test_006
-rtl_OString.valueOf.valueOf_test_007
commit 19382894cfc2c3237f0860223bdfd362d69133b4
Author: Theo van Klaveren <theo.van.klaveren at gmail.com>
Date: Thu Mar 17 14:35:53 2011 +0100
Make the qa/rtl/rtl_ostring test compile again.
These crash on NULL pointers, which they expect the API to handle properly.
It doesn't.
diff --git a/sal/qa/rtl/ostring/rtl_OString2.cxx b/sal/qa/rtl/ostring/rtl_OString2.cxx
index 27158a1..e81a734 100644
--- a/sal/qa/rtl/ostring/rtl_OString2.cxx
+++ b/sal/qa/rtl/ostring/rtl_OString2.cxx
@@ -32,7 +32,12 @@
// autogenerated file with codegen.pl
// There exist some more test code in sal/qa/rtl_strings/rtl_OString.cxx
-#include <testshl/simpleheader.hxx>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
+#include <rtl/string.hxx>
+
#include "valueequal.hxx"
namespace rtl_OString
@@ -44,7 +49,7 @@ class valueOf : public CppUnit::TestFixture
{
rtl::OString sValue;
sValue = rtl::OString::valueOf( _nValue );
- t_print(T_VERBOSE, "nFloat := %.9f sValue := %s\n", _nValue, sValue.getStr());
+ printf("nFloat := %.9f sValue := %s\n", _nValue, sValue.getStr());
float nValueATOF = static_cast<float>(atof( sValue.getStr() ));
@@ -122,7 +127,7 @@ private:
{
rtl::OString sValue;
sValue = rtl::OString::valueOf( _nValue );
- t_print(T_VERBOSE, "nDouble := %.20f sValue := %s\n", _nValue, sValue.getStr());
+ printf("nDouble := %.20f sValue := %s\n", _nValue, sValue.getStr());
double nValueATOF = atof( sValue.getStr() );
@@ -255,7 +260,7 @@ public:
// insert your test code here.
void toDouble_selftest()
{
- t_print("Start selftest:\n");
+ printf("Start selftest:\n");
CPPUNIT_ASSERT (is_double_equal(1.0, 1.01) == false);
CPPUNIT_ASSERT (is_double_equal(1.0, 1.001) == false);
CPPUNIT_ASSERT (is_double_equal(1.0, 1.0001) == false);
@@ -272,7 +277,7 @@ public:
CPPUNIT_ASSERT (is_double_equal(1.0, 1.00000000000001) == true);
CPPUNIT_ASSERT (is_double_equal(1.0, 1.000000000000001) == true);
CPPUNIT_ASSERT (is_double_equal(1.0, 1.0000000000000001) == true);
- t_print("Selftest done.\n");
+ printf("Selftest done.\n");
}
void toDouble_test_3()
@@ -389,7 +394,7 @@ public:
rtl::OString sToken = sTokenStr.getToken( 0, ';', nIndex );
}
while ( nIndex >= 0 );
- // t_print("Index %d\n", nIndex);
+ // printf("Index %d\n", nIndex);
// should not GPF
}
@@ -498,7 +503,7 @@ public:
::rtl::OString aStr1;
aStr1= input->replaceAt( index, count, *newStr );
- t_print("the result OString is %s#\n", aStr1.getStr() );
+ printf("the result OString is %s#\n", aStr1.getStr() );
sal_Bool bRes = ( expVal->compareTo(aStr1) == 0 );
return bRes;
@@ -553,10 +558,10 @@ public:
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OString::valueOf, "rtl_OString");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OString::toDouble, "rtl_OString");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OString::getToken, "rtl_OString");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OString::replaceAt, "rtl_OString");
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OString::valueOf);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OString::toDouble);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OString::getToken);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_OString::replaceAt);
} // namespace rtl_OString
@@ -565,6 +570,6 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_OString::replaceAt, "rtl_OString");
// 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;
+CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/ostring/rtl_str.cxx b/sal/qa/rtl/ostring/rtl_str.cxx
index 5dfb336..eede2e2 100644
--- a/sal/qa/rtl/ostring/rtl_str.cxx
+++ b/sal/qa/rtl/ostring/rtl_str.cxx
@@ -29,7 +29,13 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sal.hxx"
-#include <testshl/simpleheader.hxx>
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
+#include <rtl/string.hxx>
+#include <cstring>
namespace rtl_str
{
@@ -253,7 +259,7 @@ namespace rtl_str
{
rtl::OString aStr1 = "Line for a hashCode.";
sal_Int32 nHashCode = rtl_str_hashCode( aStr1.getStr() );
- t_print("hashcode: %d\n", nHashCode);
+ printf("hashcode: %d\n", nHashCode);
// CPPUNIT_ASSERT_MESSAGE("failed.", nValue == 0);
}
@@ -638,7 +644,7 @@ namespace rtl_str
rtl_str_toAsciiLowerCase_WithLength( pStr, 10 );
- t_print("Lowercase with length: '%s'\n", pStr);
+ printf("Lowercase with length: '%s'\n", pStr);
CPPUNIT_ASSERT_MESSAGE("failed", aShouldStr1.equals(rtl::OString(pStr)) == sal_True);
free(pStr);
}
@@ -710,7 +716,7 @@ namespace rtl_str
strcpy(pStr, aStr1.getStr());
rtl_str_toAsciiUpperCase_WithLength( pStr, 10 );
- t_print("Uppercase with length: '%s'\n", aStr1.getStr());
+ printf("Uppercase with length: '%s'\n", aStr1.getStr());
CPPUNIT_ASSERT_MESSAGE("failed", aShouldStr1.equals(rtl::OString(pStr)) == sal_True);
free(pStr);
}
@@ -861,26 +867,26 @@ namespace rtl_str
};
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::compare, "rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::compareIgnoreAsciiCase, "rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::shortenedCompareIgnoreAsciiCase_WithLength, "rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::hashCode, "rtl_str");
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::compare);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::compareIgnoreAsciiCase);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::shortenedCompareIgnoreAsciiCase_WithLength);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::hashCode);
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::indexOfChar, "rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::lastIndexOfChar, "rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::indexOfStr, "rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::lastIndexOfStr, "rtl_str");
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::indexOfChar);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::lastIndexOfChar);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::indexOfStr);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::lastIndexOfStr);
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::replaceChar, "rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::replaceChar_WithLength, "rtl_str");
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::replaceChar);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::replaceChar_WithLength);
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::toAsciiLowerCase, "rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::toAsciiLowerCase_WithLength, "rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::toAsciiUpperCase, "rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::toAsciiUpperCase_WithLength, "rtl_str");
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::toAsciiLowerCase);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::toAsciiLowerCase_WithLength);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::toAsciiUpperCase);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::toAsciiUpperCase_WithLength);
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::trim_WithLength, "rtl_str");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::valueOfChar, "rtl_str");
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::trim_WithLength);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_str::valueOfChar);
} // namespace rtl_str
@@ -888,6 +894,6 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_str::valueOfChar, "rtl_str");
// 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;
+CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/ostring/rtl_string.cxx b/sal/qa/rtl/ostring/rtl_string.cxx
index 1f0b6d5..06a5eea 100644
--- a/sal/qa/rtl/ostring/rtl_string.cxx
+++ b/sal/qa/rtl/ostring/rtl_string.cxx
@@ -29,7 +29,13 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sal.hxx"
-#include <testshl/simpleheader.hxx>
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
+#include <rtl/ustring.hxx>
+#include <cstring>
namespace rtl_string
{
@@ -173,14 +179,14 @@ namespace rtl_string
} // namespace rtl_string
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_string::getLength, "rtl_string");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_string::newFromString, "rtl_string");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_string::convertUStringToString, "rtl_string");
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_string::getLength);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_string::newFromString);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_string::convertUStringToString);
// -----------------------------------------------------------------------------
// 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;
+CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit a14cf0613dfdb49d2479a6116f2f51e7481b1525
Author: Theo van Klaveren <theo.van.klaveren at gmail.com>
Date: Thu Mar 17 14:21:47 2011 +0100
Make the qa/rtl/rtl_math test compile again.
Interesting is that it fails a test that according to the API
docs should work (rtl_matH_doubleToString of 1.#INF returns 'INF'
instead of '1.#INF').
diff --git a/sal/qa/inc/valueequal.hxx b/sal/qa/inc/valueequal.hxx
index b043d66..782362a 100644
--- a/sal/qa/inc/valueequal.hxx
+++ b/sal/qa/inc/valueequal.hxx
@@ -43,8 +43,8 @@ bool is_equal(T x, T y, sal_Int16 _nPrec)
if (_nPrec != PREC_long_double)
{
- t_print(T_VERBOSE, "double equal: %.20f\n", x);
- t_print(T_VERBOSE, " %.20f\n", y);
+ printf("double equal: %.20f\n", x);
+ printf(" %.20f\n", y);
}
//here nPrecOfN is the number after dot
sal_Int32 nBeforeDot = sal_Int32( log10(x) );
@@ -52,34 +52,34 @@ bool is_equal(T x, T y, sal_Int16 _nPrec)
{
nBeforeDot = 0;
}
- //t_print(T_VERBOSE, "nPRECISION is %d\n", nPRECISION);
+ //printf("nPRECISION is %d\n", nPRECISION);
sal_Int32 nPrecOfN = -nPRECISION + nBeforeDot;
if (_nPrec != PREC_long_double)
- t_print(T_VERBOSE, "nPrecOfN is %d\n", nPrecOfN);
+ printf("nPrecOfN is %d\n", nPrecOfN);
long double nPrec = pow(0.1, -nPrecOfN);
if (_nPrec != PREC_long_double)
- t_print(T_VERBOSE, " prec: %.20f\n", nPrec);
+ printf(" prec: %.20f\n", nPrec);
long double nDelta = fabs( x - y ) ;
if (_nPrec != PREC_long_double)
{
- t_print(T_VERBOSE, " delta: %.20f\n", nDelta);
- t_print(T_VERBOSE, " nPrec: %.20f\n", nPrec);
- t_print(T_VERBOSE, "delta must be less or equal to prec!\n\n");
+ printf(" delta: %.20f\n", nDelta);
+ printf(" nPrec: %.20f\n", nPrec);
+ printf("delta must be less or equal to prec!\n\n");
}
if (nDelta > nPrec)
{
- // t_print(T_VERBOSE, "values are not equal! ndelta:%.20f\n", nDelta);
+ // printf("values are not equal! ndelta:%.20f\n", nDelta);
return false;
}
// else
// {
- // t_print(T_VERBOSE, "values are equal. ndelta:%.20f\n", nDelta);
+ // printf("values are equal. ndelta:%.20f\n", nDelta);
return true;
// }
}
@@ -101,25 +101,25 @@ bool is_equal(T x, T y, sal_Int16 _nPrec)
// LLA: y = -y;
// LLA: }
// LLA:
-// LLA: t_print(T_VERBOSE, "double equal: %.20f\n# %.20f\n", x, y);
+// LLA: printf("double equal: %.20f\n# %.20f\n", x, y);
// LLA: sal_Int32 nPrecOfN = -nPRECISION + sal_Int32( log10(x) );
// LLA:
-// LLA: t_print(T_VERBOSE, "prec: %d\n", nPrecOfN);
+// LLA: printf("prec: %d\n", nPrecOfN);
// LLA: double nPrec = pow(10, nPrecOfN) * 1;
// LLA:
-// LLA: t_print(T_VERBOSE, " prec: %.20f\n", nPrec);
+// LLA: printf(" prec: %.20f\n", nPrec);
// LLA:
// LLA: double nDelta = fabs( x - y );
-// LLA: t_print(T_VERBOSE, " delta: %.20f\n\n", nDelta);
+// LLA: printf(" delta: %.20f\n\n", nDelta);
// LLA:
// LLA: if (nDelta > nPrec)
// LLA: {
-// LLA: // t_print(T_VERBOSE, "values are not equal! ndelta:%.20f\n", nDelta);
+// LLA: // printf("values are not equal! ndelta:%.20f\n", nDelta);
// LLA: return false;
// LLA: }
// LLA: // else
// LLA: // {
-// LLA: // t_print(T_VERBOSE, "values are equal. ndelta:%.20f\n", nDelta);
+// LLA: // printf("values are equal. ndelta:%.20f\n", nDelta);
// LLA: return true;
// LLA: // }
// LLA: }
diff --git a/sal/qa/rtl/math/rtl_math.cxx b/sal/qa/rtl/math/rtl_math.cxx
index 25d77f6..a6c4cc9 100644
--- a/sal/qa/rtl/math/rtl_math.cxx
+++ b/sal/qa/rtl/math/rtl_math.cxx
@@ -35,10 +35,13 @@
#endif
#include <math.h>
-#include <testshl/simpleheader.hxx>
#include <rtl/math.h>
#include <rtl/string.hxx>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
#include "valueequal.hxx"
namespace rtl_math
@@ -615,7 +618,7 @@ public:
}; // class test
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_math::test, "rtl_math");
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_math::test);
} // namespace rtl_math
@@ -623,6 +626,6 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_math::test, "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;
+CPPUNIT_PLUGIN_IMPLEMENT();
/* 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
index 2dc2ffd..a28e194 100644
--- a/sal/qa/rtl/math/test_rtl_math.cxx
+++ b/sal/qa/rtl/math/test_rtl_math.cxx
@@ -35,13 +35,16 @@
#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>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
namespace {
struct FloatTraits
@@ -118,12 +121,11 @@ struct TestNumberToString
};
template< typename StringT, typename NumberT >
-bool testNumberToString(hTestResult pTestResult,
- TestNumberToString const & rTest)
+void testNumberToString(TestNumberToString const & rTest)
{
typename NumberT::Number fValue = static_cast< typename NumberT::Number >(rTest.fValue);
if (fValue != rTest.fValue)
- return true;
+ return;
// LLA: t_print("size: %d ", sizeof(fValue));
typename StringT::String aResult1;
@@ -134,16 +136,6 @@ bool testNumberToString(hTestResult pTestResult,
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("/"));
@@ -160,27 +152,19 @@ bool testNumberToString(hTestResult pTestResult,
aBuffer.append(static_cast< sal_Int32 >(rTest.bEraseTrailingDecZeros));
aBuffer.append(RTL_CONSTASCII_STRINGPARAM("): "));
StringT::appendBuffer(aBuffer, aResult1);
- if (!bSuccess)
+ if (aResult1 != aResult2)
{
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;
+ CPPUNIT_ASSERT_MESSAGE(aBuffer.getStr(), aResult1 == aResult2);
}
template< typename StringT, typename NumberT >
-bool testNumberToString(hTestResult pTestResult,
- TestNumberToString const * pTests, size_t nCount)
+void testNumberToString(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;
+ testNumberToString< StringT, NumberT >(pTests[i]);
}
struct TestStringToNumberToString
@@ -194,8 +178,7 @@ struct TestStringToNumberToString
};
template< typename StringT >
-bool testStringToNumberToString(hTestResult pTestResult,
- TestStringToNumberToString const & rTest)
+void testStringToNumberToString(TestStringToNumberToString const & rTest)
{
double d = rtl::math::stringToDouble(StringT::createFromAscii(rTest.pValue),
rTest.cDecSeparator, 0, 0, 0);
@@ -204,7 +187,6 @@ bool testStringToNumberToString(hTestResult pTestResult,
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(
@@ -222,37 +204,36 @@ bool testStringToNumberToString(hTestResult pTestResult,
aBuffer.append(static_cast< sal_Int32 >(rTest.bEraseTrailingDecZeros));
aBuffer.append(RTL_CONSTASCII_STRINGPARAM("): "));
StringT::appendBuffer(aBuffer, aResult1);
- if (!bSuccess)
+ if (aResult1 != aResult2)
{
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;
+ CPPUNIT_ASSERT_MESSAGE(aBuffer.getStr(), aResult1 == aResult2);
}
template< typename StringT >
-bool testStringToNumberToString(hTestResult pTestResult,
- TestStringToNumberToString const * pTests,
+void testStringToNumberToString(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;
+ testStringToNumberToString< StringT >(pTests[i]);
}
}
-extern "C" sal_Bool SAL_CALL test_rtl_math(hTestResult pTestResult)
+class Math : public CppUnit::TestFixture
{
- bool bReturn = true;
-
+public:
+ void setUp()
+ {
+ }
+
+ void tearDown()
+ {
+ }
+
+ void rtl_math_001()
{
static TestNumberToString const aTest[]
= { // 1, 1+2^-1, ..., 1+2^-52
@@ -541,14 +522,13 @@ extern "C" sal_Bool SAL_CALL test_rtl_math(hTestResult pTestResult)
// bReturn &= testNumberToString< StringTraits, FloatTraits >(
// pTestResult, aTest, nCount);
- bReturn &= testNumberToString< StringTraits, DoubleTraits >(
- pTestResult, aTest, nCount);
+ testNumberToString< StringTraits, DoubleTraits >(aTest, nCount);
// bReturn &= testNumberToString< UStringTraits, FloatTraits >(
// pTestResult, aTest, nCount);
- bReturn &= testNumberToString< UStringTraits, DoubleTraits >(
- pTestResult, aTest, nCount);
+ testNumberToString< UStringTraits, DoubleTraits >(aTest, nCount);
}
+ void rtl_math_002()
{
static TestStringToNumberToString const aTest[]
= { { "1", rtl_math_StringFormat_Automatic,
@@ -647,31 +627,36 @@ extern "C" sal_Bool SAL_CALL test_rtl_math(hTestResult pTestResult)
"1.#INF" },
};
size_t const nCount = SAL_N_ELEMENTS(aTest);
- bReturn &= testStringToNumberToString< StringTraits >(
- pTestResult, aTest, nCount);
- bReturn &= testStringToNumberToString< UStringTraits >(
- pTestResult, aTest, nCount);
+ testStringToNumberToString< StringTraits >(aTest, nCount);
+ testStringToNumberToString< UStringTraits >(aTest, nCount);
}
- return bReturn;
-}
+ CPPUNIT_TEST_SUITE(Math);
+ CPPUNIT_TEST(rtl_math_001);
+ CPPUNIT_TEST(rtl_math_002);
+ CPPUNIT_TEST_SUITE_END();
+};
// -----------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_math2( hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start(hRtlTestResult, "rtl_math" );
+//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, "");
+// }
+//}
- test_rtl_math( hRtlTestResult );
+CPPUNIT_TEST_SUITE_REGISTRATION(::Math);
- c_rtl_tres_state_end(hRtlTestResult, "rtl_math" );
-}
-// -----------------------------------------------------------------------------
-void RegisterAdditionalFunctions(FktRegFuncPtr _pFunc)
-{
- if (_pFunc)
- {
- (_pFunc)(&test_rtl_math2, "");
- }
-}
+CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 082cf074471341e1ea8f069f5013bdcccdcdc38a
Author: Theo van Klaveren <theo.van.klaveren at gmail.com>
Date: Thu Mar 17 13:32:10 2011 +0100
Make the qa/rtl/rtl_logfile test compile again.
diff --git a/sal/qa/rtl/logfile/rtl_logfile.cxx b/sal/qa/rtl/logfile/rtl_logfile.cxx
index e5f50b0..de93646 100644
--- a/sal/qa/rtl/logfile/rtl_logfile.cxx
+++ b/sal/qa/rtl/logfile/rtl_logfile.cxx
@@ -42,7 +42,6 @@
#endif
#include <rtl/logfile.hxx>
-#include <testshl/simpleheader.hxx>
#include <osl/file.hxx>
#if ( defined WNT ) // Windows
@@ -51,6 +50,10 @@
#include <postwin.h>
#endif
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
using namespace ::osl;
inline void printUString( const ::rtl::OUString & str, const sal_Char * msg = "" )
@@ -58,11 +61,11 @@ inline void printUString( const ::rtl::OUString & str, const sal_Char * msg = ""
if (strlen(msg) > 0)
{
- t_print("%s: ", msg );
+ printf("%s: ", msg );
}
rtl::OString aString;
aString = ::rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US );
- t_print("%s\n", (char *)aString.getStr( ) );
+ printf("%s\n", (char *)aString.getStr( ) );
}
/** get the absolute source file URL "file:///.../sal/qa/rtl/logfile/"
@@ -150,7 +153,7 @@ namespace rtl_logfile
sal_Char buffer_read[400];
sal_uInt64 nCount_read;
nError1 = aTestFile.read( buffer_read, 400, nCount_read );
- //t_print("buffer is %s\n", buffer_read );
+ //printf("buffer is %s\n", buffer_read );
CPPUNIT_ASSERT_MESSAGE("write right logs", strstr( buffer_read, "trace 1 2 3") != NULL );
aTestFile.sync();
aTestFile.close();
@@ -211,10 +214,10 @@ namespace rtl_logfile
} // namespace rtl_logfile
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( rtl_logfile::logfile, "rtl_logfile" );
+CPPUNIT_TEST_SUITE_REGISTRATION( rtl_logfile::logfile);
// -----------------------------------------------------------------------------
-NOADDITIONAL;
+CPPUNIT_PLUGIN_IMPLEMENT();
//~ do some clean up work after all test completed.
class GlobalObject
@@ -224,7 +227,7 @@ public:
{
try
{
- t_print( "\n#Do some clean-ups ... only delete logfile1_*.log here!\n" );
+ printf( "\n#Do some clean-ups ... only delete logfile1_*.log here!\n" );
rtl::OUString suFilePath = getTempPath();
suFilePath += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("logfile1_")) + getCurrentPID( );
suFilePath += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".log"));
@@ -233,16 +236,16 @@ public:
::osl::FileBase::RC nError1;
nError1 = osl::File::remove( suFilePath );
#ifdef WNT
- t_print("Please remove logfile* manully! Error is Permision denied!");
+ printf("Please remove logfile* manully! Error is Permision denied!");
#endif
}
catch (CppUnit::Exception &e)
{
- t_print("Exception caught in GlobalObject dtor(). Exception message: '%s'. Source line: %d\n", e.what(), e.sourceLine().lineNumber());
+ printf("Exception caught in GlobalObject dtor(). Exception message: '%s'. Source line: %d\n", e.what(), e.sourceLine().lineNumber());
}
catch (...)
{
- t_print("Exception caught (...) in GlobalObject dtor()\n");
+ printf("Exception caught (...) in GlobalObject dtor()\n");
}
}
};
commit 5eacd7683cbce9ba1a6900cf9d8f60e7c82d5615
Author: Theo van Klaveren <theo.van.klaveren at gmail.com>
Date: Thu Mar 17 13:22:55 2011 +0100
Make the qa/rtl/rtl_locale test compile again.
diff --git a/sal/qa/rtl/locale/rtl_locale.cxx b/sal/qa/rtl/locale/rtl_locale.cxx
index 6395ecb..712d375 100644
--- a/sal/qa/rtl/locale/rtl_locale.cxx
+++ b/sal/qa/rtl/locale/rtl_locale.cxx
@@ -31,9 +31,12 @@
#include "precompiled_sal.hxx"
// autogenerated file with codegen.pl
-#include <testshl/simpleheader.hxx>
-#include <rtl/locale.hxx>
#include <osl/thread.h>
+#include <rtl/locale.hxx>
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
namespace rtl_locale
{
@@ -49,6 +52,8 @@ public:
// initialise your test code values here.
void setUp()
{
+ // start message
+ rtl_locale::setDefaultLocale();
}
void tearDown()
@@ -91,6 +96,8 @@ public:
// initialise your test code values here.
void setUp()
{
+ // start message
+ rtl_locale::setDefaultLocale();
}
void tearDown()
@@ -124,6 +131,8 @@ public:
// initialise your test code values here.
void setUp()
{
+ // start message
+ rtl_locale::setDefaultLocale();
}
void tearDown()
@@ -135,14 +144,14 @@ public:
{
rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
rtl::OUString suLanguage = aLocale.getLanguage();
- t_print("Language: %s\n", rtl::OUStringToOString(suLanguage, osl_getThreadTextEncoding()).getStr());
+ 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::OUString suLanguage = rtl_locale_getLanguage(aLocale.getData());
- t_print("Language: %s\n", rtl::OUStringToOString(suLanguage, osl_getThreadTextEncoding()).getStr());
+ 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"))));
}
@@ -163,6 +172,8 @@ public:
// initialise your test code values here.
void setUp()
{
+ // start message
+ rtl_locale::setDefaultLocale();
}
void tearDown()
@@ -174,14 +185,14 @@ public:
{
rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
rtl::OUString suCountry = aLocale.getCountry();
- t_print("Country: %s\n", rtl::OUStringToOString(suCountry, osl_getThreadTextEncoding()).getStr());
+ 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::OUString suCountry = rtl_locale_getCountry(aLocale.getData());
- t_print("Country: %s\n", rtl::OUStringToOString(suCountry, osl_getThreadTextEncoding()).getStr());
+ 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"))));
}
@@ -202,6 +213,8 @@ public:
// initialise your test code values here.
void setUp()
{
+ // start message
+ rtl_locale::setDefaultLocale();
}
void tearDown()
@@ -213,14 +226,14 @@ public:
{
rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
rtl::OUString suVariant = aLocale.getVariant();
- t_print("Variant: %s\n", rtl::OUStringToOString(suVariant, osl_getThreadTextEncoding()).getStr());
+ 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::OUString suVariant = rtl_locale_getVariant(aLocale.getData());
- t_print("Variant: %s\n", rtl::OUStringToOString(suVariant, osl_getThreadTextEncoding()).getStr());
+ 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"))));
}
@@ -241,6 +254,8 @@ public:
// initialise your test code values here.
void setUp()
{
+ // start message
+ rtl_locale::setDefaultLocale();
}
void tearDown()
@@ -252,14 +267,14 @@ public:
{
rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
sal_Int32 nHashCode = aLocale.hashCode();
- t_print("Hashcode: %d\n", nHashCode);
+ printf("Hashcode: %d\n", nHashCode);
CPPUNIT_ASSERT_MESSAGE("locale hashcode must be 3831", nHashCode != 0);
}
void hashCode_002()
{
rtl::OLocale aLocale = ::rtl::OLocale::getDefault();
sal_Int32 nHashCode = rtl_locale_hashCode(aLocale.getData());
- t_print("Hashcode: %d\n", nHashCode);
+ printf("Hashcode: %d\n", nHashCode);
CPPUNIT_ASSERT_MESSAGE("locale hashcode must be 3831", nHashCode != 0);
}
@@ -280,6 +295,8 @@ public:
// initialise your test code values here.
void setUp()
{
+ // start message
+ rtl_locale::setDefaultLocale();
}
void tearDown()
@@ -304,7 +321,7 @@ 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());
- t_print("rtl_locale_equals() result: %d\n", nEqual);
+ printf("rtl_locale_equals() result: %d\n", nEqual);
CPPUNIT_ASSERT(nEqual != 0);
}
@@ -319,13 +336,13 @@ public:
}; // class equals
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_locale::getDefault, "rtl_locale");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_locale::setDefault, "rtl_locale");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_locale::getLanguage, "rtl_locale");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_locale::getCountry, "rtl_locale");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_locale::getVariant, "rtl_locale");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_locale::hashCode, "rtl_locale");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_locale::equals, "rtl_locale");
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::getDefault);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::setDefault);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::getLanguage);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::getCountry);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::getVariant);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::hashCode);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_locale::equals);
} // namespace rtl_locale
@@ -333,14 +350,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_locale::equals, "rtl_locale");
// 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;
-void RegisterAdditionalFunctions(FktRegFuncPtr)
-{
- // start message
- t_print("Initializing ...\n" );
- rtl_locale::setDefaultLocale();
- t_print("Initialization Done.\n" );
-}
+CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 0ca3e466c7f39a54a369e1cf65718dac4ce32498
Author: Theo van Klaveren <theo.van.klaveren at gmail.com>
Date: Thu Mar 17 13:15:48 2011 +0100
Make the qa/rtl/rtl_doublelock test compile again.
diff --git a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
index dc6560d..1ffdd0e 100644
--- a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
+++ b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
@@ -33,20 +33,21 @@
//------------------------------------------------------------------------
#include <sal/types.h>
-#include <rtl/string.hxx>
-
#include <osl/thread.hxx>
#include <osl/time.h>
#include <rtl/instance.hxx>
+#include <rtl/ustring.hxx>
-#include <testshl/simpleheader.hxx>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
// -----------------------------------------------------------------------------
#define CONST_TEST_STRING "gregorian"
namespace {
-struct Gregorian : public rtl::StaticWithInit<const ::rtl::OUString, Gregorian> {
+struct Gregorian : public ::rtl::StaticWithInit<const ::rtl::OUString, Gregorian> {
const ::rtl::OUString operator () () {
return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( CONST_TEST_STRING ));
}
@@ -57,9 +58,9 @@ inline void printOUString( ::rtl::OUString const & _suStr )
{
rtl::OString aString;
- t_print( "OUString: " );
+ printf( "OUString: " );
aString = ::rtl::OUStringToOString( _suStr, RTL_TEXTENCODING_ASCII_US );
- t_print( "'%s'\n", aString.getStr( ) );
+ printf( "'%s'\n", aString.getStr( ) );
}
// -----------------------------------------------------------------------------
@@ -74,7 +75,7 @@ namespace ThreadHelper
{
// if (nVerbose == VERBOSE)
// {
- // t_print("wait %d tenth seconds. ", _nTenthSec );
+ // printf("wait %d tenth seconds. ", _nTenthSec );
// fflush(stdout);
// }
#ifdef WNT //Windows
@@ -88,7 +89,7 @@ namespace ThreadHelper
#endif
// if (nVerbose == VERBOSE)
// {
- // t_print("done\n");
+ // printf("done\n");
// }
}
}
@@ -126,8 +127,8 @@ protected:
while(schedule())
{
rtl::OUString aStr = Gregorian::get();
- // printOUString(aStr);
- // printOUString(m_sConstStr);
+ printOUString(aStr);
+ printOUString(m_sConstStr);
if (aStr.equals(m_sConstStr))
{
m_nOK++;
@@ -151,7 +152,7 @@ public:
{
if (isRunning())
{
- t_print("error: not terminated.\n");
+ printf("error: not terminated.\n");
}
}
};
@@ -218,8 +219,8 @@ namespace rtl_DoubleLocking
sal_Int32 nValueOK2 = 0;
nValueOK2 = p2Thread->getOK();
- t_print("Value in Thread #1 is %d\n", nValueOK);
- t_print("Value in Thread #2 is %d\n", nValueOK2);
+ printf("Value in Thread #1 is %d\n", nValueOK);
+ printf("Value in Thread #2 is %d\n", nValueOK2);
sal_Int32 nValueFails = 0;
nValueFails = pThread->getFails();
@@ -227,8 +228,8 @@ namespace rtl_DoubleLocking
sal_Int32 nValueFails2 = 0;
nValueFails2 = p2Thread->getFails();
- t_print("Fails in Thread #1 is %d\n", nValueFails);
- t_print("Fails in Thread #2 is %d\n", nValueFails2);
+ printf("Fails in Thread #1 is %d\n", nValueFails);
+ printf("Fails in Thread #2 is %d\n", nValueFails2);
// ThreadHelper::thread_sleep_tenth_sec(1);
pThread->join();
@@ -249,11 +250,11 @@ namespace rtl_DoubleLocking
CPPUNIT_TEST_SUITE_END();
}; // class create
// -----------------------------------------------------------------------------
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_DoubleLocking::getValue, "rtl_DoubleLocking");
+ CPPUNIT_TEST_SUITE_REGISTRATION(rtl_DoubleLocking::getValue);
} // namespace rtl_DoubleLocking
// 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;
+CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 5173f778bd6656a5050bc2321f6676226cf4e5e5
Author: Theo van Klaveren <theo.van.klaveren at gmail.com>
Date: Thu Mar 17 12:53:22 2011 +0100
Make the qa/rtl/rtl_cipher unit test compile again.
diff --git a/sal/qa/rtl/cipher/rtl_cipher.cxx b/sal/qa/rtl/cipher/rtl_cipher.cxx
index cc304a4..6d5007c 100644
--- a/sal/qa/rtl/cipher/rtl_cipher.cxx
+++ b/sal/qa/rtl/cipher/rtl_cipher.cxx
@@ -30,7 +30,12 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sal.hxx"
-#include <testshl/simpleheader.hxx>
+#include <cstring>
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
#include <rtl/strbuf.hxx>
#include <rtl/cipher.h>
@@ -47,7 +52,8 @@ rtl::OString createHex(sal_uInt8 *_pKeyBuffer, sal_uInt32 _nKeyLen)
sal_Int32 nValue = (sal_Int32)_pKeyBuffer[i];
if (nValue < 16) // maximul hex value for 1 byte
{
- aBuffer.append( sal_Int32(0), 16 /* radix */ );
+ sal_Int32 nil = sal_Int32(0);
+ aBuffer.append( nil, 16 /* radix */ );
}
aBuffer.append( nValue, 16 /* radix */ );
}
@@ -205,8 +211,8 @@ public:
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_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
CPPUNIT_ASSERT_MESSAGE("wrong init", aError == rtl_Cipher_E_None);
@@ -223,10 +229,10 @@ public:
/* 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());
+ 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 ];
@@ -236,10 +242,10 @@ public:
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());
+ // printf(" Plain: %s\n", createHex(pPlainText2Buffer, nPlainText2Len).getStr());
+ // printf(" 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);
//
@@ -271,8 +277,8 @@ public:
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);
@@ -289,10 +295,10 @@ public:
/* 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());
+ 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 ];
@@ -302,10 +308,10 @@ public:
CPPUNIT_ASSERT_MESSAGE("wrong decode", 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, " as ascii: %s\n", sPlainText2Str.getStr());
+ 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);
@@ -454,8 +460,8 @@ public:
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_DirectionEncode, pKeyBuffer, nKeyLen, pArgBuffer, nArgLen);
CPPUNIT_ASSERT_MESSAGE("wrong init", aError == rtl_Cipher_E_None);
@@ -472,10 +478,10 @@ public:
/* rtlCipherError */ aError = rtl_cipher_encode(aCipher, pDataBuffer, nDataLen, pBuffer, nLen);
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, "Data: %s\n", createHex(pDataBuffer, nDataLen).getStr());
- t_print(T_VERBOSE, " Buf: %s\n", createHex(pBuffer, nLen).getStr());
+ 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;
@@ -557,14 +563,14 @@ public:
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);
- 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;
@@ -586,14 +592,14 @@ public:
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);
- 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;
@@ -614,14 +620,14 @@ public:
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);
- 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;
@@ -643,14 +649,14 @@ public:
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);
- 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;
@@ -697,16 +703,16 @@ public:
// -----------------------------------------------------------------------------
-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");
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::create);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::createBF);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::decode);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::decodeBF);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::destroy);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::destroyBF);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::encode);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::encodeBF);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::init);
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_cipher::initBF);
} // namespace rtl_cipher
@@ -715,6 +721,6 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_cipher::initBF, "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;
+CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit ae3e70dc5ba6d1ad3cd920d6f462138b8546e3ff
Author: Theo van Klaveren <theo.van.klaveren at gmail.com>
Date: Thu Mar 17 12:42:27 2011 +0100
Make the qa/rtl/rtl_crc32 test compile again.
diff --git a/sal/qa/rtl/crc32/rtl_crc32.cxx b/sal/qa/rtl/crc32/rtl_crc32.cxx
index 8334f97..56af660 100644
--- a/sal/qa/rtl/crc32/rtl_crc32.cxx
+++ b/sal/qa/rtl/crc32/rtl_crc32.cxx
@@ -31,7 +31,10 @@
#include "precompiled_sal.hxx"
// autogenerated file with codegen.pl
-#include <testshl/simpleheader.hxx>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
#include <rtl/crc.h>
namespace rtl_CRC32
@@ -170,7 +173,7 @@ public:
}; // class test
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_CRC32::test, "rtl_crc32");
+CPPUNIT_TEST_SUITE_REGISTRATION(rtl_CRC32::test);
} // namespace rtl_CRC32
@@ -178,6 +181,6 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_CRC32::test, "rtl_crc32");
// 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;
+CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list