[Libreoffice-commits] .: sw/CppunitTest_sw_swdoc_test.mk sw/qa
Caolán McNamara
caolan at kemper.freedesktop.org
Mon Jun 13 05:10:12 PDT 2011
sw/CppunitTest_sw_swdoc_test.mk | 1
sw/qa/core/Test-BigPtrArray.cxx | 45 +++++++++++++++++++++++++++++++---------
2 files changed, 36 insertions(+), 10 deletions(-)
New commits:
commit e1a72179340c710788ecd081b157731cdd65584e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Jun 13 13:09:44 2011 +0100
restore Test-BigPtrArray unit test
diff --git a/sw/CppunitTest_sw_swdoc_test.mk b/sw/CppunitTest_sw_swdoc_test.mk
index c25b2b9..9953cea 100644
--- a/sw/CppunitTest_sw_swdoc_test.mk
+++ b/sw/CppunitTest_sw_swdoc_test.mk
@@ -31,6 +31,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,sw_swdoc_test))
$(eval $(call gb_CppunitTest_add_exception_objects,sw_swdoc_test, \
sw/qa/core/swdoc-test \
+ sw/qa/core/Test-BigPtrArray \
))
$(call gb_CxxObject_get_target,sw/qa/core/swdoc-test): $(WORKDIR)/AllLangRes/sw
diff --git a/sw/qa/core/Test-BigPtrArray.cxx b/sw/qa/core/Test-BigPtrArray.cxx
index 3251cec..bacd5f0 100644
--- a/sw/qa/core/Test-BigPtrArray.cxx
+++ b/sw/qa/core/Test-BigPtrArray.cxx
@@ -29,19 +29,18 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-#define TIMELOG
+//#define TIMELOG for measuring performance
-#include <cppunit/TestSuite.h>
-#include <cppunit/TestFixture.h>
-#include <cppunit/TestCase.h>
-#include <cppunit/plugin/TestPlugIn.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <bparr.hxx>
#include <string.h>
#include <stdlib.h>
+
+#include <sal/cppunit.h>
+
+#include <sal/config.h>
#include <rtl/logfile.hxx>
+#include <bparr.hxx>
+
using namespace std;
@@ -118,7 +117,9 @@ namespace /* private */
delete bparr[i];
}
+#ifdef TIMELOG
RTL_LOGFILE_CONTEXT(logFile, "BigPtrArray performance measures" );
+#endif
}
class BigPtrArrayUnittest : public CppUnit::TestFixture
@@ -151,7 +152,9 @@ public:
{
printMethodName("test_insert_entries_at_front\n");
+#ifdef TIMELOG
RTL_LOGFILE_CONTEXT_TRACE(logFile, "START: test_insert_entries_at_front");
+#endif
BigPtrArray bparr;
@@ -166,7 +169,9 @@ public:
);
}
+#ifdef TIMELOG
RTL_LOGFILE_CONTEXT_TRACE(logFile, "END: test_insert_entries_at_front");
+#endif
for (sal_uLong i = 0, j = NUM_ENTRIES - 1; i < NUM_ENTRIES; i++, j--)
{
@@ -191,7 +196,9 @@ public:
{
printMethodName("test_insert_entries_in_the_middle\n");
+#ifdef TIMELOG
RTL_LOGFILE_CONTEXT_TRACE(logFile, "START: test_insert_entries_in_the_middle");
+#endif
BigPtrArray bparr;
@@ -202,7 +209,9 @@ public:
bparr.Insert(new BigPtrEntryMock(NUM_ENTRIES), bparr.Count() / 2);
+#ifdef TIMELOG
RTL_LOGFILE_CONTEXT_TRACE(logFile, "END: test_insert_entries_in_the_middle");
+#endif
CPPUNIT_ASSERT_MESSAGE
(
@@ -224,7 +233,9 @@ public:
{
printMethodName("test_insert_at_already_used_index\n");
+#ifdef TIMELOG
RTL_LOGFILE_CONTEXT_TRACE(logFile, "START: test_insert_at_already_used_index");
+#endif
BigPtrArray bparr;
@@ -236,7 +247,9 @@ public:
for (sal_uLong i = 0, j = -5; i < 5; i++, j++)
bparr.Insert(new BigPtrEntryMock(j), i);
+#ifdef TIMELOG
RTL_LOGFILE_CONTEXT_TRACE(logFile, "END: test_insert_at_already_used_index");
+#endif
CPPUNIT_ASSERT_MESSAGE
(
@@ -295,7 +308,9 @@ public:
{
printMethodName("test_remove_at_front\n");
+#ifdef TIMELOG
RTL_LOGFILE_CONTEXT_TRACE(logFile, "START: test_remove_at_front");
+#endif
BigPtrArray bparr;
@@ -333,7 +348,9 @@ public:
dumpBigPtrArray(bparr);
}
+#ifdef TIMELOG
RTL_LOGFILE_CONTEXT_TRACE(logFile, "END: test_remove_at_front");
+#endif
}
void test_remove_at_back()
@@ -380,7 +397,9 @@ public:
{
printMethodName("test_remove_in_the_middle\n");
+#ifdef TIMELOG
RTL_LOGFILE_CONTEXT_TRACE(logFile, "START: test_remove_in_the_middle");
+#endif
BigPtrArray bparr;
@@ -418,7 +437,9 @@ public:
dumpBigPtrArray(bparr);
}
+#ifdef TIMELOG
RTL_LOGFILE_CONTEXT_TRACE(logFile, "END: test_remove_in_the_middle");
+#endif
}
void test_remove_multiple_elements_at_once()
@@ -777,12 +798,16 @@ public:
{
startString_ += methodName;
endString_ += methodName;
+#ifdef TIMELOG
RTL_LOGFILE_CONTEXT_TRACE(logFile, startString_.c_str());
+#endif
}
~PerformanceTracer()
{
+#ifdef TIMELOG
RTL_LOGFILE_CONTEXT_TRACE(logFile, endString_.c_str());
+#endif
}
private:
@@ -864,8 +889,8 @@ private:
// register test suites
CPPUNIT_TEST_SUITE_REGISTRATION(BigPtrArrayUnittest);
+#ifdef TIMELOG
CPPUNIT_TEST_SUITE_REGISTRATION(BigPtrArrayPerformanceTest);
-
-CPPUNIT_PLUGIN_IMPLEMENT();
+#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list