You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by ca...@apache.org on 2008/01/28 19:40:24 UTC
svn commit: r615984 [1/4] - in /logging/log4cxx/trunk/src/test/cpp: ./
customlogger/ db/ defaultinit/ helpers/ net/ nt/ pattern/ rolling/ spi/
util/ varia/ xml/
Author: carnold
Date: Mon Jan 28 10:40:19 2008
New Revision: 615984
URL: http://svn.apache.org/viewvc?rev=615984&view=rev
Log:
LOGCXX-225: Replace CPPUNIT with LOGUNIT abstraction of CPPUNIT
Added:
logging/log4cxx/trunk/src/test/cpp/logunit.cpp
logging/log4cxx/trunk/src/test/cpp/logunit.h
Modified:
logging/log4cxx/trunk/src/test/cpp/appenderskeletontestcase.cpp
logging/log4cxx/trunk/src/test/cpp/appenderskeletontestcase.h
logging/log4cxx/trunk/src/test/cpp/asyncappendertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/consoleappendertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/customlogger/xloggertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/db/odbcappendertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase1.cpp
logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase2.cpp
logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase3.cpp
logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase4.cpp
logging/log4cxx/trunk/src/test/cpp/encodingtest.cpp
logging/log4cxx/trunk/src/test/cpp/fileappendertest.cpp
logging/log4cxx/trunk/src/test/cpp/fileappendertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/filetestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/absolutetimedateformattestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/cacheddateformattestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/charsetdecodertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/charsetencodertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/cyclicbuffertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/datetimedateformattestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/inetaddresstestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/iso8601dateformattestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/messagebuffertest.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/optionconvertertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/propertiestestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/relativetimedateformattestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/stringhelpertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/stringtokenizertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/syslogwritertest.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/timezonetestcase.cpp
logging/log4cxx/trunk/src/test/cpp/helpers/transcodertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/hierarchytest.cpp
logging/log4cxx/trunk/src/test/cpp/hierarchythresholdtestcase.cpp
logging/log4cxx/trunk/src/test/cpp/l7dtestcase.cpp
logging/log4cxx/trunk/src/test/cpp/leveltestcase.cpp
logging/log4cxx/trunk/src/test/cpp/loggertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/minimumtestcase.cpp
logging/log4cxx/trunk/src/test/cpp/ndctestcase.cpp
logging/log4cxx/trunk/src/test/cpp/net/smtpappendertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/net/socketappendertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/net/sockethubappendertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/net/socketservertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/net/syslogappendertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/net/telnetappendertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/net/xmlsocketappendertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/nt/nteventlogappendertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/pattern/patternparsertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/patternlayouttest.cpp
logging/log4cxx/trunk/src/test/cpp/propertyconfiguratortest.cpp
logging/log4cxx/trunk/src/test/cpp/rolling/filenamepatterntestcase.cpp
logging/log4cxx/trunk/src/test/cpp/rolling/filterbasedrollingtest.cpp
logging/log4cxx/trunk/src/test/cpp/rolling/manualrollingtest.cpp
logging/log4cxx/trunk/src/test/cpp/rolling/obsoletedailyrollingfileappendertest.cpp
logging/log4cxx/trunk/src/test/cpp/rolling/obsoleterollingfileappendertest.cpp
logging/log4cxx/trunk/src/test/cpp/rolling/sizebasedrollingtest.cpp
logging/log4cxx/trunk/src/test/cpp/rolling/timebasedrollingtest.cpp
logging/log4cxx/trunk/src/test/cpp/rollingfileappendertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/spi/loggingeventtest.cpp
logging/log4cxx/trunk/src/test/cpp/streamtestcase.cpp
logging/log4cxx/trunk/src/test/cpp/util/binarycompare.cpp
logging/log4cxx/trunk/src/test/cpp/varia/errorhandlertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/varia/levelmatchfiltertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/varia/levelrangefiltertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/writerappendertestcase.cpp
logging/log4cxx/trunk/src/test/cpp/writerappendertestcase.h
logging/log4cxx/trunk/src/test/cpp/xml/customleveltestcase.cpp
logging/log4cxx/trunk/src/test/cpp/xml/domtestcase.cpp
logging/log4cxx/trunk/src/test/cpp/xml/xmllayouttest.cpp
logging/log4cxx/trunk/src/test/cpp/xml/xmllayouttestcase.cpp
Modified: logging/log4cxx/trunk/src/test/cpp/appenderskeletontestcase.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/appenderskeletontestcase.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/appenderskeletontestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/appenderskeletontestcase.cpp Mon Jan 28 10:40:19 2008
@@ -16,7 +16,7 @@
*/
#include "appenderskeletontestcase.h"
-#include <cppunit/extensions/HelperMacros.h>
+#include "logunit.h"
#include <log4cxx/helpers/objectptr.h>
#include <log4cxx/appenderskeleton.h>
@@ -28,12 +28,12 @@
void AppenderSkeletonTestCase::testDefaultThreshold() {
ObjectPtrT<AppenderSkeleton> appender(createAppenderSkeleton());
LevelPtr threshold(appender->getThreshold());
- CPPUNIT_ASSERT_EQUAL(Level::getAll()->toInt(), threshold->toInt());
+ LOGUNIT_ASSERT_EQUAL(Level::getAll()->toInt(), threshold->toInt());
}
void AppenderSkeletonTestCase::testSetOptionThreshold() {
ObjectPtrT<AppenderSkeleton> appender(createAppenderSkeleton());
appender->setOption(LOG4CXX_STR("threshold"), LOG4CXX_STR("debug"));
LevelPtr threshold(appender->getThreshold());
- CPPUNIT_ASSERT_EQUAL(Level::getDebug()->toInt(), threshold->toInt());
+ LOGUNIT_ASSERT_EQUAL(Level::getDebug()->toInt(), threshold->toInt());
}
Modified: logging/log4cxx/trunk/src/test/cpp/appenderskeletontestcase.h
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/appenderskeletontestcase.h?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/appenderskeletontestcase.h (original)
+++ logging/log4cxx/trunk/src/test/cpp/appenderskeletontestcase.h Mon Jan 28 10:40:19 2008
@@ -15,15 +15,14 @@
* limitations under the License.
*/
-#include <cppunit/TestFixture.h>
#include <log4cxx/appenderskeleton.h>
-
+#include "logunit.h"
/**
An abstract set of tests for inclusion in concrete
appender test case
*/
-class AppenderSkeletonTestCase : public CppUnit::TestFixture
+LOGUNIT_CLASS(AppenderSkeletonTestCase)
{
public:
Modified: logging/log4cxx/trunk/src/test/cpp/asyncappendertestcase.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/asyncappendertestcase.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/asyncappendertestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/asyncappendertestcase.cpp Mon Jan 28 10:40:19 2008
@@ -15,8 +15,7 @@
* limitations under the License.
*/
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
+#include "logunit.h"
#include <log4cxx/logger.h>
#include <log4cxx/logmanager.h>
@@ -103,22 +102,22 @@
*/
class AsyncAppenderTestCase : public AppenderSkeletonTestCase
{
- CPPUNIT_TEST_SUITE(AsyncAppenderTestCase);
+ LOGUNIT_TEST_SUITE(AsyncAppenderTestCase);
//
// tests inherited from AppenderSkeletonTestCase
//
- CPPUNIT_TEST(testDefaultThreshold);
- CPPUNIT_TEST(testSetOptionThreshold);
+ LOGUNIT_TEST(testDefaultThreshold);
+ LOGUNIT_TEST(testSetOptionThreshold);
- CPPUNIT_TEST(closeTest);
- CPPUNIT_TEST(test2);
- CPPUNIT_TEST(test3);
+ LOGUNIT_TEST(closeTest);
+ LOGUNIT_TEST(test2);
+ LOGUNIT_TEST(test3);
//
// TODO: test fails on Linux.
- //CPPUNIT_TEST(testBadAppender);
- CPPUNIT_TEST(testLocationInfoTrue);
- CPPUNIT_TEST(testConfiguration);
- CPPUNIT_TEST_SUITE_END();
+ //LOGUNIT_TEST(testBadAppender);
+ LOGUNIT_TEST(testLocationInfoTrue);
+ LOGUNIT_TEST(testConfiguration);
+ LOGUNIT_TEST_SUITE_END();
public:
@@ -152,7 +151,7 @@
root->debug(LOG4CXX_TEST_STR("m2"));
const std::vector<spi::LoggingEventPtr>& v = vectorAppender->getVector();
- CPPUNIT_ASSERT_EQUAL((size_t) 1, v.size());
+ LOGUNIT_ASSERT_EQUAL((size_t) 1, v.size());
}
// this test checks whether appenders embedded within an AsyncAppender are also
@@ -172,8 +171,8 @@
root->debug(LOG4CXX_TEST_STR("m2"));
const std::vector<spi::LoggingEventPtr>& v = vectorAppender->getVector();
- CPPUNIT_ASSERT_EQUAL((size_t) 1, v.size());
- CPPUNIT_ASSERT(vectorAppender->isClosed());
+ LOGUNIT_ASSERT_EQUAL((size_t) 1, v.size());
+ LOGUNIT_ASSERT(vectorAppender->isClosed());
}
// this test checks whether appenders embedded within an AsyncAppender are also
@@ -196,8 +195,8 @@
root->debug(LOG4CXX_TEST_STR("m2"));
const std::vector<spi::LoggingEventPtr>& v = vectorAppender->getVector();
- CPPUNIT_ASSERT_EQUAL(LEN, v.size());
- CPPUNIT_ASSERT_EQUAL(true, vectorAppender->isClosed());
+ LOGUNIT_ASSERT_EQUAL(LEN, v.size());
+ LOGUNIT_ASSERT_EQUAL(true, vectorAppender->isClosed());
}
/**
@@ -216,7 +215,7 @@
Thread::sleep(10);
try {
LOG4CXX_INFO(root, "Message");
- CPPUNIT_FAIL("Should have thrown exception");
+ LOGUNIT_FAIL("Should have thrown exception");
} catch(NullPointerException& ex) {
}
}
@@ -247,27 +246,27 @@
const std::vector<spi::LoggingEventPtr>& events = blockableAppender->getVector();
LoggingEventPtr initialEvent = events[0];
LoggingEventPtr discardEvent = events[events.size() - 1];
- CPPUNIT_ASSERT(initialEvent->getMessage() == LOG4CXX_STR("Hello, World"));
- CPPUNIT_ASSERT(discardEvent->getMessage().substr(0,10) == LOG4CXX_STR("Discarded "));
- CPPUNIT_ASSERT_EQUAL(log4cxx::spi::LocationInfo::getLocationUnavailable().getClassName(),
+ LOGUNIT_ASSERT(initialEvent->getMessage() == LOG4CXX_STR("Hello, World"));
+ LOGUNIT_ASSERT(discardEvent->getMessage().substr(0,10) == LOG4CXX_STR("Discarded "));
+ LOGUNIT_ASSERT_EQUAL(log4cxx::spi::LocationInfo::getLocationUnavailable().getClassName(),
discardEvent->getLocationInformation().getClassName());
}
void testConfiguration() {
log4cxx::xml::DOMConfigurator::configure("input/xml/asyncAppender1.xml");
AsyncAppenderPtr asyncAppender(Logger::getRootLogger()->getAppender(LOG4CXX_STR("ASYNC")));
- CPPUNIT_ASSERT(!(asyncAppender == 0));
- CPPUNIT_ASSERT_EQUAL(100, asyncAppender->getBufferSize());
- CPPUNIT_ASSERT_EQUAL(false, asyncAppender->getBlocking());
- CPPUNIT_ASSERT_EQUAL(true, asyncAppender->getLocationInfo());
+ LOGUNIT_ASSERT(!(asyncAppender == 0));
+ LOGUNIT_ASSERT_EQUAL(100, asyncAppender->getBufferSize());
+ LOGUNIT_ASSERT_EQUAL(false, asyncAppender->getBlocking());
+ LOGUNIT_ASSERT_EQUAL(true, asyncAppender->getLocationInfo());
AppenderList nestedAppenders(asyncAppender->getAllAppenders());
// TODO:
// test seems to work okay, but have not found a working way to
// get a reference to the nested vector appender
//
-// CPPUNIT_ASSERT_EQUAL((size_t) 1, nestedAppenders.size());
+// LOGUNIT_ASSERT_EQUAL((size_t) 1, nestedAppenders.size());
// VectorAppenderPtr vectorAppender(nestedAppenders[0]);
-// CPPUNIT_ASSERT(0 != vectorAppender);
+// LOGUNIT_ASSERT(0 != vectorAppender);
LoggerPtr root(Logger::getRootLogger());
size_t LEN = 20;
@@ -277,12 +276,12 @@
asyncAppender->close();
// const std::vector<spi::LoggingEventPtr>& v = vectorAppender->getVector();
-// CPPUNIT_ASSERT_EQUAL(LEN, v.size());
-// CPPUNIT_ASSERT_EQUAL(true, vectorAppender->isClosed());
+// LOGUNIT_ASSERT_EQUAL(LEN, v.size());
+// LOGUNIT_ASSERT_EQUAL(true, vectorAppender->isClosed());
}
};
-//CPPUNIT_TEST_SUITE_REGISTRATION(AsyncAppenderTestCase);
+//LOGUNIT_TEST_SUITE_REGISTRATION(AsyncAppenderTestCase);
#endif
Modified: logging/log4cxx/trunk/src/test/cpp/consoleappendertestcase.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/consoleappendertestcase.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/consoleappendertestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/consoleappendertestcase.cpp Mon Jan 28 10:40:19 2008
@@ -15,9 +15,8 @@
* limitations under the License.
*/
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/consoleappender.h>
+#include "logunit.h"
#include "writerappendertestcase.h"
using namespace log4cxx;
@@ -28,14 +27,14 @@
*/
class ConsoleAppenderTestCase : public WriterAppenderTestCase
{
- CPPUNIT_TEST_SUITE(ConsoleAppenderTestCase);
+ LOGUNIT_TEST_SUITE(ConsoleAppenderTestCase);
//
// tests inherited from AppenderSkeletonTestCase
//
- CPPUNIT_TEST(testDefaultThreshold);
- CPPUNIT_TEST(testSetOptionThreshold);
+ LOGUNIT_TEST(testDefaultThreshold);
+ LOGUNIT_TEST(testSetOptionThreshold);
- CPPUNIT_TEST_SUITE_END();
+ LOGUNIT_TEST_SUITE_END();
public:
@@ -45,4 +44,4 @@
}
};
-CPPUNIT_TEST_SUITE_REGISTRATION(ConsoleAppenderTestCase);
+LOGUNIT_TEST_SUITE_REGISTRATION(ConsoleAppenderTestCase);
Modified: logging/log4cxx/trunk/src/test/cpp/customlogger/xloggertestcase.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/customlogger/xloggertestcase.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/customlogger/xloggertestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/customlogger/xloggertestcase.cpp Mon Jan 28 10:40:19 2008
@@ -18,9 +18,7 @@
#define LOG4CXX_TEST 1
#include <log4cxx/private/log4cxx_private.h>
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
+#include "../logunit.h"
#include "xlogger.h"
#include <log4cxx/xml/domconfigurator.h>
#include "../util/transformer.h"
@@ -36,12 +34,12 @@
/**
Tests handling of custom loggers.
*/
-class XLoggerTestCase : public CppUnit::TestFixture
+LOGUNIT_CLASS(XLoggerTestCase)
{
- CPPUNIT_TEST_SUITE(XLoggerTestCase);
- CPPUNIT_TEST(test1);
- CPPUNIT_TEST(test2);
- CPPUNIT_TEST_SUITE_END();
+ LOGUNIT_TEST_SUITE(XLoggerTestCase);
+ LOGUNIT_TEST(test1);
+ LOGUNIT_TEST(test2);
+ LOGUNIT_TEST_SUITE_END();
XLoggerPtr logger;
@@ -67,37 +65,27 @@
fn.append(".xml");
DOMConfigurator::configure(fn);
- int i = -1;
- std::ostringstream os;
- os << "Message " << ++i;
- if (logger->isEnabledFor(log4cxx::XLevel::getTrace())) {
- logger->forcedLog(log4cxx::XLevel::getTrace(), os.str(), LOG4CXX_LOCATION);
- }
-
- os.str("");
- os << "Message " << ++ i;
- LOG4CXX_DEBUG(logger, os.str());
- os.str("");
- os << "Message " << ++ i;
- LOG4CXX_WARN(logger, os.str());
- os.str("");
- os << "Message " << ++ i;
- LOG4CXX_ERROR(logger, os.str());
- os.str("");
- os << "Message " << ++ i;
- LOG4CXX_FATAL(logger, os.str());
- os.str("");
- os << "Message " << ++ i;
- LOG4CXX_DEBUG(logger, os.str());
+ int i = 0;
+ LOG4CXX_LOG(logger, log4cxx::XLevel::getTrace(), "Message " << i);
+
+ i++;
+ LOG4CXX_DEBUG(logger, "Message " << i);
+ i++;
+ LOG4CXX_WARN(logger, "Message " << i);
+ i++;
+ LOG4CXX_ERROR(logger, "Message " << i);
+ i++;
+ LOG4CXX_FATAL(logger, "Message " << i);
+ i++;
+ LOG4CXX_DEBUG(logger, "Message " << i);
const File OUTPUT("output/temp");
std::string witness("witness/customLogger.");
witness.append(number);
const File WITNESS(witness);
- CPPUNIT_ASSERT(Compare::compare(OUTPUT, WITNESS));
-//#endif
+ LOGUNIT_ASSERT(Compare::compare(OUTPUT, WITNESS));
}
};
-CPPUNIT_TEST_SUITE_REGISTRATION(XLoggerTestCase);
+LOGUNIT_TEST_SUITE_REGISTRATION(XLoggerTestCase);
Modified: logging/log4cxx/trunk/src/test/cpp/db/odbcappendertestcase.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/db/odbcappendertestcase.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/db/odbcappendertestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/db/odbcappendertestcase.cpp Mon Jan 28 10:40:19 2008
@@ -15,10 +15,9 @@
* limitations under the License.
*/
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/db/odbcappender.h>
#include "../appenderskeletontestcase.h"
+#include "../logunit.h"
#define LOG4CXX_TEST 1
#include <log4cxx/private/log4cxx_private.h>
@@ -33,14 +32,14 @@
*/
class ODBCAppenderTestCase : public AppenderSkeletonTestCase
{
- CPPUNIT_TEST_SUITE(ODBCAppenderTestCase);
+ LOGUNIT_TEST_SUITE(ODBCAppenderTestCase);
//
// tests inherited from AppenderSkeletonTestCase
//
- CPPUNIT_TEST(testDefaultThreshold);
- CPPUNIT_TEST(testSetOptionThreshold);
+ LOGUNIT_TEST(testDefaultThreshold);
+ LOGUNIT_TEST(testSetOptionThreshold);
- CPPUNIT_TEST_SUITE_END();
+ LOGUNIT_TEST_SUITE_END();
public:
@@ -50,6 +49,6 @@
}
};
-CPPUNIT_TEST_SUITE_REGISTRATION(ODBCAppenderTestCase);
+LOGUNIT_TEST_SUITE_REGISTRATION(ODBCAppenderTestCase);
#endif
Modified: logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase1.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase1.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase1.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase1.cpp Mon Jan 28 10:40:19 2008
@@ -15,19 +15,18 @@
* limitations under the License.
*/
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
+#include "../logunit.h"
#include <log4cxx/logmanager.h>
#include <log4cxx/logger.h>
using namespace log4cxx;
-class TestCase1 : public CppUnit::TestFixture
+LOGUNIT_CLASS(TestCase1)
{
- CPPUNIT_TEST_SUITE(TestCase1);
- CPPUNIT_TEST(noneTest);
- CPPUNIT_TEST_SUITE_END();
+ LOGUNIT_TEST_SUITE(TestCase1);
+ LOGUNIT_TEST(noneTest);
+ LOGUNIT_TEST_SUITE_END();
public:
void setUp()
@@ -44,11 +43,10 @@
LoggerPtr root = Logger::getRootLogger();
LOG4CXX_DEBUG(root, "Hello, world");
bool rootIsConfigured = !root->getAllAppenders().empty();
- CPPUNIT_ASSERT(!rootIsConfigured);
+ LOGUNIT_ASSERT(!rootIsConfigured);
}
};
-CPPUNIT_NS::Test* createTestCase1() {
- return TestCase1::suite();
-}
+
+LOGUNIT_TEST_SUITE_REGISTRATION_NO_AUTO_RUN(TestCase1)
Modified: logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase2.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase2.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase2.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase2.cpp Mon Jan 28 10:40:19 2008
@@ -19,20 +19,18 @@
#include <log4cxx/private/log4cxx_private.h>
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
#include <log4cxx/logmanager.h>
#include <log4cxx/logger.h>
#include "../insertwide.h"
+#include "../logunit.h"
using namespace log4cxx;
-class TestCase2 : public CppUnit::TestFixture
+LOGUNIT_CLASS(TestCase2)
{
- CPPUNIT_TEST_SUITE(TestCase2);
- CPPUNIT_TEST(xmlTest);
- CPPUNIT_TEST_SUITE_END();
+ LOGUNIT_TEST_SUITE(TestCase2);
+ LOGUNIT_TEST(xmlTest);
+ LOGUNIT_TEST_SUITE_END();
public:
void setUp()
@@ -49,17 +47,15 @@
LoggerPtr root = Logger::getRootLogger();
LOG4CXX_DEBUG(root, "Hello, world");
bool rootIsConfigured = !root->getAllAppenders().empty();
- CPPUNIT_ASSERT(rootIsConfigured);
+ LOGUNIT_ASSERT(rootIsConfigured);
AppenderList list = root->getAllAppenders();
AppenderPtr appender = list.front();
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("D1"), appender->getName());
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("D1"), appender->getName());
}
};
-CPPUNIT_NS::Test* createTestCase2() {
- return TestCase2::suite();
-}
+LOGUNIT_TEST_SUITE_REGISTRATION_NO_AUTO_RUN(TestCase2)
Modified: logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase3.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase3.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase3.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase3.cpp Mon Jan 28 10:40:19 2008
@@ -15,20 +15,18 @@
* limitations under the License.
*/
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
#include <log4cxx/logmanager.h>
#include <log4cxx/logger.h>
#include "../insertwide.h"
+#include "../logunit.h"
using namespace log4cxx;
-class TestCase3 : public CppUnit::TestFixture
+LOGUNIT_CLASS(TestCase3)
{
- CPPUNIT_TEST_SUITE(TestCase3);
- CPPUNIT_TEST(testProperties);
- CPPUNIT_TEST_SUITE_END();
+ LOGUNIT_TEST_SUITE(TestCase3);
+ LOGUNIT_TEST(testProperties);
+ LOGUNIT_TEST_SUITE_END();
public:
void setUp()
@@ -45,15 +43,13 @@
LoggerPtr root = Logger::getRootLogger();
LOG4CXX_DEBUG(root, "Hello, world");
bool rootIsConfigured = !root->getAllAppenders().empty();
- CPPUNIT_ASSERT(rootIsConfigured);
+ LOGUNIT_ASSERT(rootIsConfigured);
AppenderList list = root->getAllAppenders();
AppenderPtr appender = list.front();
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("D3"), appender->getName());
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("D3"), appender->getName());
}
};
-CPPUNIT_NS::Test* createTestCase3() {
- return TestCase3::suite();
-}
+LOGUNIT_TEST_SUITE_REGISTRATION_NO_AUTO_RUN(TestCase3)
Modified: logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase4.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase4.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase4.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/defaultinit/testcase4.cpp Mon Jan 28 10:40:19 2008
@@ -19,20 +19,18 @@
#include <log4cxx/private/log4cxx_private.h>
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
#include <log4cxx/logmanager.h>
#include <log4cxx/logger.h>
#include "../insertwide.h"
+#include "../logunit.h"
using namespace log4cxx;
-class TestCase4 : public CppUnit::TestFixture
+LOGUNIT_CLASS(TestCase4)
{
- CPPUNIT_TEST_SUITE(TestCase4);
- CPPUNIT_TEST(combinedTest);
- CPPUNIT_TEST_SUITE_END();
+ LOGUNIT_TEST_SUITE(TestCase4);
+ LOGUNIT_TEST(combinedTest);
+ LOGUNIT_TEST_SUITE_END();
public:
void setUp()
@@ -49,17 +47,15 @@
LoggerPtr root = Logger::getRootLogger();
LOG4CXX_DEBUG(root, "Hello, world");
bool rootIsConfigured = !root->getAllAppenders().empty();
- CPPUNIT_ASSERT(rootIsConfigured);
+ LOGUNIT_ASSERT(rootIsConfigured);
AppenderList list = root->getAllAppenders();
- CPPUNIT_ASSERT_EQUAL((size_t) 1, list.size());
+ LOGUNIT_ASSERT_EQUAL((size_t) 1, list.size());
AppenderPtr appender = list.front();
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("D1"), appender->getName());
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("D1"), appender->getName());
}
};
-CPPUNIT_NS::Test* createTestCase4() {
- return TestCase4::suite();
-}
+LOGUNIT_TEST_SUITE_REGISTRATION_NO_AUTO_RUN(TestCase4)
Modified: logging/log4cxx/trunk/src/test/cpp/encodingtest.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/encodingtest.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/encodingtest.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/encodingtest.cpp Mon Jan 28 10:40:19 2008
@@ -16,11 +16,8 @@
*/
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
#include <log4cxx/logger.h>
-
+#include "logunit.h"
//
// If there is no support for wchar_t logging then
// there is not a consistent way to get the test characters logged
@@ -45,15 +42,15 @@
* @author Curt Arnold
* @since 0.9.8
*/
-class EncodingTest : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(EncodingTest);
- CPPUNIT_TEST(testASCII);
- CPPUNIT_TEST(testLatin1);
- CPPUNIT_TEST(testUtf8);
- CPPUNIT_TEST(testUtf16);
- CPPUNIT_TEST(testUtf16LE);
- CPPUNIT_TEST(testUtf16BE);
- CPPUNIT_TEST_SUITE_END();
+LOGUNIT_CLASS(EncodingTest) {
+ LOGUNIT_TEST_SUITE(EncodingTest);
+ LOGUNIT_TEST(testASCII);
+ LOGUNIT_TEST(testLatin1);
+ LOGUNIT_TEST(testUtf8);
+ LOGUNIT_TEST(testUtf16);
+ LOGUNIT_TEST(testUtf16LE);
+ LOGUNIT_TEST(testUtf16BE);
+ LOGUNIT_TEST_SUITE_END();
public:
/**
* Resets configuration after each test.
@@ -163,7 +160,7 @@
}
};
-CPPUNIT_TEST_SUITE_REGISTRATION(EncodingTest);
+LOGUNIT_TEST_SUITE_REGISTRATION(EncodingTest);
#endif
Modified: logging/log4cxx/trunk/src/test/cpp/fileappendertest.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/fileappendertest.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/fileappendertest.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/fileappendertest.cpp Mon Jan 28 10:40:19 2008
@@ -14,12 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
#include <log4cxx/helpers/pool.h>
#include <log4cxx/fileappender.h>
#include <log4cxx/patternlayout.h>
+#include "logunit.h"
using namespace log4cxx;
using namespace log4cxx::helpers;
@@ -29,12 +27,12 @@
*
* FileAppender tests.
*/
-class FileAppenderTest : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(FileAppenderTest);
- CPPUNIT_TEST(testDirectoryCreation);
- CPPUNIT_TEST(testgetSetThreshold);
- CPPUNIT_TEST(testIsAsSevereAsThreshold);
- CPPUNIT_TEST_SUITE_END();
+LOGUNIT_CLASS(FileAppenderTest) {
+ LOGUNIT_TEST_SUITE(FileAppenderTest);
+ LOGUNIT_TEST(testDirectoryCreation);
+ LOGUNIT_TEST(testgetSetThreshold);
+ LOGUNIT_TEST(testIsAsSevereAsThreshold);
+ LOGUNIT_TEST_SUITE_END();
public:
/**
* Tests that any necessary directories are attempted to
@@ -54,7 +52,7 @@
wa->setLayout(new PatternLayout(LOG4CXX_STR("%m%n")));
wa->activateOptions(p);
- CPPUNIT_ASSERT(File(LOG4CXX_STR("output/newdir/temp.log")).exists(p));
+ LOGUNIT_ASSERT(File(LOG4CXX_STR("output/newdir/temp.log")).exists(p));
}
/**
@@ -66,9 +64,9 @@
//
// different from log4j where threshold is null.
//
- CPPUNIT_ASSERT_EQUAL(Level::getAll(), appender->getThreshold());
+ LOGUNIT_ASSERT_EQUAL(Level::getAll(), appender->getThreshold());
appender->setThreshold(debug);
- CPPUNIT_ASSERT_EQUAL(debug, appender->getThreshold());
+ LOGUNIT_ASSERT_EQUAL(debug, appender->getThreshold());
}
/**
@@ -77,9 +75,9 @@
void testIsAsSevereAsThreshold() {
FileAppenderPtr appender = new FileAppender();
LevelPtr debug = Level::getDebug();
- CPPUNIT_ASSERT(appender->isAsSevereAsThreshold(debug));
+ LOGUNIT_ASSERT(appender->isAsSevereAsThreshold(debug));
}
};
-CPPUNIT_TEST_SUITE_REGISTRATION(FileAppenderTest);
+LOGUNIT_TEST_SUITE_REGISTRATION(FileAppenderTest);
Modified: logging/log4cxx/trunk/src/test/cpp/fileappendertestcase.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/fileappendertestcase.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/fileappendertestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/fileappendertestcase.cpp Mon Jan 28 10:40:19 2008
@@ -16,7 +16,6 @@
*/
#include "fileappendertestcase.h"
-#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/helpers/objectptr.h>
#include <log4cxx/fileappender.h>
#include "insertwide.h"
@@ -34,18 +33,18 @@
*/
class FileAppenderTestCase : public FileAppenderAbstractTestCase
{
- CPPUNIT_TEST_SUITE(FileAppenderTestCase);
+ LOGUNIT_TEST_SUITE(FileAppenderTestCase);
//
// tests inherited from AppenderSkeletonTestCase
//
- CPPUNIT_TEST(testDefaultThreshold);
- CPPUNIT_TEST(testSetOptionThreshold);
+ LOGUNIT_TEST(testDefaultThreshold);
+ LOGUNIT_TEST(testSetOptionThreshold);
// tests defined here
- CPPUNIT_TEST(testSetDoubleBackslashes);
- CPPUNIT_TEST(testStripDuplicateBackslashes);
+ LOGUNIT_TEST(testSetDoubleBackslashes);
+ LOGUNIT_TEST(testStripDuplicateBackslashes);
- CPPUNIT_TEST_SUITE_END();
+ LOGUNIT_TEST_SUITE_END();
@@ -60,7 +59,7 @@
FileAppender appender;
appender.setOption(LOG4CXX_STR("FILE"), LOG4CXX_STR("output\\\\temp"));
const File& file = appender.getFile();
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("output\\temp"), file.getName());
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("output\\temp"), file.getName());
}
/**
@@ -73,7 +72,7 @@
FileAppender appender;
appender.setOption(LOG4CXX_STR("FILE"), LOG4CXX_STR("output\\\\temp"));
const File& file = appender.getFile();
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("output\\temp"), file.getName());
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("output\\temp"), file.getName());
}
/**
@@ -82,31 +81,31 @@
* @since 0.9.8
*/
void testStripDuplicateBackslashes() {
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("\\foo\\bar\\foo"),
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("\\foo\\bar\\foo"),
FileAppender::stripDuplicateBackslashes(LOG4CXX_STR("\\foo\\bar\\foo")));
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("\\foo\\bar\\foo\\"),
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("\\foo\\bar\\foo\\"),
FileAppender::stripDuplicateBackslashes(LOG4CXX_STR("\\\\foo\\\\bar\\\\foo\\\\")));
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("\\foo\\bar\\foo\\"),
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("\\foo\\bar\\foo\\"),
FileAppender::stripDuplicateBackslashes(LOG4CXX_STR("\\foo\\bar\\foo\\")));
//
// UNC's should either start with two backslashes and contain additional singles
// or four back slashes and addition doubles
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("\\\\foo\\bar\\foo"),
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("\\\\foo\\bar\\foo"),
FileAppender::stripDuplicateBackslashes(LOG4CXX_STR("\\\\\\\\foo\\\\bar\\\\foo")));
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("\\\\foo\\bar\\foo"),
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("\\\\foo\\bar\\foo"),
FileAppender::stripDuplicateBackslashes(LOG4CXX_STR("\\\\foo\\bar\\foo")));
//
// it it starts with doubles but has no other path component
// then it is a file path
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("\\foo.log"),
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("\\foo.log"),
FileAppender::stripDuplicateBackslashes(LOG4CXX_STR("\\\\foo.log")));
//
// it it starts with quads but has no other path component
// then it is a UNC
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("\\\\foo.log"),
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("\\\\foo.log"),
FileAppender::stripDuplicateBackslashes(LOG4CXX_STR("\\\\\\\\foo.log")));
}
};
-CPPUNIT_TEST_SUITE_REGISTRATION(FileAppenderTestCase);
+LOGUNIT_TEST_SUITE_REGISTRATION(FileAppenderTestCase);
Modified: logging/log4cxx/trunk/src/test/cpp/filetestcase.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/filetestcase.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/filetestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/filetestcase.cpp Mon Jan 28 10:40:19 2008
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/file.h>
+#include "logunit.h"
#include "insertwide.h"
#include <log4cxx/helpers/pool.h>
#include <apr_errno.h>
@@ -36,33 +36,33 @@
using namespace log4cxx::helpers;
-class FileTestCase : public CppUnit::TestFixture
+LOGUNIT_CLASS(FileTestCase)
{
- CPPUNIT_TEST_SUITE(FileTestCase);
- CPPUNIT_TEST(defaultConstructor);
- CPPUNIT_TEST(defaultExists);
- CPPUNIT_TEST(defaultRead);
- CPPUNIT_TEST(propertyRead);
- CPPUNIT_TEST(propertyExists);
- CPPUNIT_TEST(fileWrite1);
+ LOGUNIT_TEST_SUITE(FileTestCase);
+ LOGUNIT_TEST(defaultConstructor);
+ LOGUNIT_TEST(defaultExists);
+ LOGUNIT_TEST(defaultRead);
+ LOGUNIT_TEST(propertyRead);
+ LOGUNIT_TEST(propertyExists);
+ LOGUNIT_TEST(fileWrite1);
#if LOG4CXX_WCHAR_T_API
- CPPUNIT_TEST(wcharConstructor);
+ LOGUNIT_TEST(wcharConstructor);
#endif
#if LOG4CXX_UNICHAR_API
- CPPUNIT_TEST(unicharConstructor);
+ LOGUNIT_TEST(unicharConstructor);
#endif
#if LOG4CXX_CFSTRING_API
- CPPUNIT_TEST(cfstringConstructor);
+ LOGUNIT_TEST(cfstringConstructor);
#endif
- CPPUNIT_TEST(copyConstructor);
- CPPUNIT_TEST(assignment);
- CPPUNIT_TEST(deleteBackslashedFileName);
- CPPUNIT_TEST_SUITE_END();
+ LOGUNIT_TEST(copyConstructor);
+ LOGUNIT_TEST(assignment);
+ LOGUNIT_TEST(deleteBackslashedFileName);
+ LOGUNIT_TEST_SUITE_END();
public:
void defaultConstructor() {
File defFile;
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR(""), defFile.getName());
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR(""), defFile.getName());
}
@@ -71,7 +71,7 @@
File defFile;
Pool pool;
bool exists = defFile.exists(pool);
- CPPUNIT_ASSERT_EQUAL(false, exists);
+ LOGUNIT_ASSERT_EQUAL(false, exists);
}
// check default constructor. read() throws an exception
@@ -83,7 +83,7 @@
InputStreamPtr defInput = new FileInputStream(defFile);
InputStreamReaderPtr inputReader = new InputStreamReader(defInput);
LogString contents(inputReader->read(pool));
- CPPUNIT_ASSERT(false);
+ LOGUNIT_ASSERT(false);
} catch(IOException &ex) {
}
}
@@ -94,7 +94,7 @@
File propFile(L"input/patternLayout1.properties");
Pool pool;
bool exists = propFile.exists(pool);
- CPPUNIT_ASSERT_EQUAL(true, exists);
+ LOGUNIT_ASSERT_EQUAL(true, exists);
}
#endif
@@ -106,7 +106,7 @@
File propFile(filename);
Pool pool;
bool exists = propFile.exists(pool);
- CPPUNIT_ASSERT_EQUAL(true, exists);
+ LOGUNIT_ASSERT_EQUAL(true, exists);
}
#endif
@@ -115,7 +115,7 @@
File propFile(CFSTR("input/patternLayout.properties"));
Pool pool;
bool exists = propFile.exists(pool);
- CPPUNIT_ASSERT_EQUAL(true, exists);
+ LOGUNIT_ASSERT_EQUAL(true, exists);
}
#endif
@@ -124,7 +124,7 @@
File copy(propFile);
Pool pool;
bool exists = copy.exists(pool);
- CPPUNIT_ASSERT_EQUAL(true, exists);
+ LOGUNIT_ASSERT_EQUAL(true, exists);
}
void assignment() {
@@ -132,7 +132,7 @@
File copy = propFile;
Pool pool;
bool exists = copy.exists(pool);
- CPPUNIT_ASSERT_EQUAL(true, exists);
+ LOGUNIT_ASSERT_EQUAL(true, exists);
}
void propertyRead() {
@@ -142,14 +142,14 @@
InputStreamReaderPtr propReader = new InputStreamReader(propStream);
LogString props(propReader->read(pool));
LogString line1(LOG4CXX_STR("# Licensed to the Apache Software Foundation (ASF) under one or more"));
- CPPUNIT_ASSERT_EQUAL(line1, props.substr(0, line1.length()));
+ LOGUNIT_ASSERT_EQUAL(line1, props.substr(0, line1.length()));
}
void propertyExists() {
File propFile("input/patternLayout1.properties");
Pool pool;
bool exists = propFile.exists(pool);
- CPPUNIT_ASSERT_EQUAL(true, exists);
+ LOGUNIT_ASSERT_EQUAL(true, exists);
}
void fileWrite1() {
@@ -167,7 +167,7 @@
InputStreamReaderPtr isr = new InputStreamReader(is);
LogString reply = isr->read(pool);
- CPPUNIT_ASSERT_EQUAL(greeting, reply);
+ LOGUNIT_ASSERT_EQUAL(greeting, reply);
}
/**
@@ -182,4 +182,4 @@
};
-CPPUNIT_TEST_SUITE_REGISTRATION(FileTestCase);
+LOGUNIT_TEST_SUITE_REGISTRATION(FileTestCase);
Modified: logging/log4cxx/trunk/src/test/cpp/helpers/absolutetimedateformattestcase.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/helpers/absolutetimedateformattestcase.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/helpers/absolutetimedateformattestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/helpers/absolutetimedateformattestcase.cpp Mon Jan 28 10:40:19 2008
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include "../logunit.h"
#include <log4cxx/logstring.h>
#include <log4cxx/helpers/absolutetimedateformat.h>
-#include <cppunit/extensions/HelperMacros.h>
#include "../insertwide.h"
#include <apr.h>
#include <apr_time.h>
@@ -37,17 +37,17 @@
Unit test {@link AbsoluteTimeDateFormat}.
@author Curt Arnold
@since 1.3.0 */
-class AbsoluteTimeDateFormatTestCase : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(AbsoluteTimeDateFormatTestCase);
- CPPUNIT_TEST(test1);
- CPPUNIT_TEST(test2);
- CPPUNIT_TEST(test3);
- CPPUNIT_TEST(test4);
- CPPUNIT_TEST(test5);
- CPPUNIT_TEST(test6);
- CPPUNIT_TEST(test7);
- CPPUNIT_TEST(test8);
- CPPUNIT_TEST_SUITE_END();
+LOGUNIT_CLASS(AbsoluteTimeDateFormatTestCase) {
+ LOGUNIT_TEST_SUITE(AbsoluteTimeDateFormatTestCase);
+ LOGUNIT_TEST(test1);
+ LOGUNIT_TEST(test2);
+ LOGUNIT_TEST(test3);
+ LOGUNIT_TEST(test4);
+ LOGUNIT_TEST(test5);
+ LOGUNIT_TEST(test6);
+ LOGUNIT_TEST(test7);
+ LOGUNIT_TEST(test8);
+ LOGUNIT_TEST_SUITE_END();
public:
@@ -68,7 +68,7 @@
LogString actual;
Pool p;
formatter.format(actual, date, p);
- CPPUNIT_ASSERT_EQUAL(expected, actual);
+ LOGUNIT_ASSERT_EQUAL(expected, actual);
}
#define MICROSECONDS_PER_DAY APR_INT64_C(86400000000)
@@ -170,10 +170,10 @@
LogString numb;
AbsoluteTimeDateFormat formatter;
formatter.numberFormat(numb, 87, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("87"), numb);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("87"), numb);
}
};
-CPPUNIT_TEST_SUITE_REGISTRATION(AbsoluteTimeDateFormatTestCase);
+LOGUNIT_TEST_SUITE_REGISTRATION(AbsoluteTimeDateFormatTestCase);
Modified: logging/log4cxx/trunk/src/test/cpp/helpers/cacheddateformattestcase.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/helpers/cacheddateformattestcase.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/helpers/cacheddateformattestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/helpers/cacheddateformattestcase.cpp Mon Jan 28 10:40:19 2008
@@ -16,9 +16,9 @@
*/
#include <log4cxx/helpers/cacheddateformat.h>
+#include "../logunit.h"
#include <log4cxx/helpers/absolutetimedateformat.h>
#include <log4cxx/helpers/relativetimedateformat.h>
-#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/helpers/pool.h>
#include <locale>
#include "../insertwide.h"
@@ -51,33 +51,33 @@
Unit test {@link CachedDateFormat}.
@author Curt Arnold
@since 0.9.8 */
- class CachedDateFormatTestCase : public CppUnit::TestFixture
+LOGUNIT_CLASS(CachedDateFormatTestCase)
{
- CPPUNIT_TEST_SUITE( CachedDateFormatTestCase );
- CPPUNIT_TEST( test1 );
- CPPUNIT_TEST( test2 );
- CPPUNIT_TEST( test3 );
- CPPUNIT_TEST( test4 );
+ LOGUNIT_TEST_SUITE( CachedDateFormatTestCase );
+ LOGUNIT_TEST( test1 );
+ LOGUNIT_TEST( test2 );
+ LOGUNIT_TEST( test3 );
+ LOGUNIT_TEST( test4 );
#if LOG4CXX_HAS_STD_LOCALE
- CPPUNIT_TEST( test5 );
+ LOGUNIT_TEST( test5 );
#endif
- CPPUNIT_TEST( test6 );
- CPPUNIT_TEST( test8 );
+ LOGUNIT_TEST( test6 );
+ LOGUNIT_TEST( test8 );
// Gump doesn't like this test
-// CPPUNIT_TEST( test9 );
- CPPUNIT_TEST( test10 );
- CPPUNIT_TEST( test11);
- CPPUNIT_TEST( test12 );
- CPPUNIT_TEST( test13 );
- CPPUNIT_TEST( test14 );
- CPPUNIT_TEST( test15 );
- CPPUNIT_TEST( test16 );
- CPPUNIT_TEST( test17);
- CPPUNIT_TEST( test18);
- CPPUNIT_TEST( test19);
- CPPUNIT_TEST( test20);
- CPPUNIT_TEST( test21);
- CPPUNIT_TEST_SUITE_END();
+// LOGUNIT_TEST( test9 );
+ LOGUNIT_TEST( test10 );
+ LOGUNIT_TEST( test11);
+ LOGUNIT_TEST( test12 );
+ LOGUNIT_TEST( test13 );
+ LOGUNIT_TEST( test14 );
+ LOGUNIT_TEST( test15 );
+ LOGUNIT_TEST( test16 );
+ LOGUNIT_TEST( test17);
+ LOGUNIT_TEST( test18);
+ LOGUNIT_TEST( test19);
+ LOGUNIT_TEST( test20);
+ LOGUNIT_TEST( test21);
+ LOGUNIT_TEST_SUITE_END();
#define MICROSECONDS_PER_DAY APR_INT64_C(86400000000)
@@ -101,23 +101,23 @@
LogString actual;
gmtFormat.format(actual, jul1, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,000"), actual);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,000"), actual);
actual.erase(actual.begin(), actual.end());
gmtFormat.format(actual, jul1 + 8000, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,008"), actual);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,008"), actual);
actual.erase(actual.begin(), actual.end());
gmtFormat.format(actual, jul1 + 17000, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,017"), actual);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,017"), actual);
actual.erase(actual.begin(), actual.end());
gmtFormat.format(actual, jul1 + 237000, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,237"), actual);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,237"), actual);
actual.erase(actual.begin(), actual.end());
gmtFormat.format(actual, jul1 + 1415000, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:01,415"), actual);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:01,415"), actual);
actual.erase(actual.begin(), actual.end());
}
@@ -139,15 +139,15 @@
Pool p;
LogString actual;
gmtFormat.format(actual, jul2, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,000"), actual);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,000"), actual);
actual.erase(actual.begin(), actual.end());
chicagoFormat.format(actual, jul2, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("19:00:00,000"), actual);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("19:00:00,000"), actual);
actual.erase(actual.begin(), actual.end());
gmtFormat.format(actual, jul2, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,000"), actual);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,000"), actual);
}
/**
@@ -169,26 +169,26 @@
gmtFormat.format(actual, ticks, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,000"), actual);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,000"), actual);
actual.erase(actual.begin(), actual.end());
//
// APR's explode_time method does not properly calculate tm_usec
// prior to 1 Jan 1970 on Unix
gmtFormat.format(actual, ticks + 8000, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,008"), actual);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,008"), actual);
actual.erase(actual.begin(), actual.end());
gmtFormat.format(actual, ticks + 17000, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,017"), actual);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,017"), actual);
actual.erase(actual.begin(), actual.end());
gmtFormat.format(actual, ticks + 237000, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,237"), actual);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,237"), actual);
actual.erase(actual.begin(), actual.end());
gmtFormat.format(actual, ticks + 1423000, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:01,423"), actual);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:01,423"), actual);
}
void assertFormattedEquals(
@@ -203,7 +203,7 @@
cachedFormat.format(actual, date, p);
- CPPUNIT_ASSERT_EQUAL(expected, actual);
+ LOGUNIT_ASSERT_EQUAL(expected, actual);
}
void test4() {
@@ -266,7 +266,7 @@
Pool p;
AbsoluteTimeDateFormat formatter;
formatter.numberFormat(numb, 87, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("87"), numb);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("87"), numb);
}
@@ -283,13 +283,13 @@
LogString actual;
cachedFormat.format(actual, jul4, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("2004-07-04 00:00:00,000"), actual);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("2004-07-04 00:00:00,000"), actual);
cachedFormat.setTimeZone(TimeZone::getTimeZone(LOG4CXX_STR("GMT-6")));
actual.erase(actual.begin(), actual.end());
cachedFormat.format(actual, jul4, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("2004-07-03 18:00:00,000"), actual);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("2004-07-03 18:00:00,000"), actual);
}
@@ -318,14 +318,14 @@
apr_time_t dec12;
apr_status_t stat = apr_time_exp_gmt_get(&dec12, &c);
const apr_status_t statOK = 0;
- CPPUNIT_ASSERT_EQUAL(statOK, stat);
+ LOGUNIT_ASSERT_EQUAL(statOK, stat);
Pool p;
LogString s;
cachedFormat->format(s, dec12, p);
- CPPUNIT_ASSERT_EQUAL(
+ LOGUNIT_ASSERT_EQUAL(
(LogString) LOG4CXX_STR("2004-December-12 20:00:37,23 +0100"), s);
memset(&c, 0, sizeof(c));
@@ -338,12 +338,12 @@
apr_time_t jan1;
stat = apr_time_exp_gmt_get(&jan1, &c);
- CPPUNIT_ASSERT_EQUAL(statOK, stat);
+ LOGUNIT_ASSERT_EQUAL(statOK, stat);
s.erase(s.begin(), s.end());
cachedFormat->format(s, jan1, p);
- CPPUNIT_ASSERT_EQUAL(
+ LOGUNIT_ASSERT_EQUAL(
(LogString) LOG4CXX_STR("2005-January-01 00:00:13,905 +0100"), s);
}
@@ -376,14 +376,14 @@
apr_time_t oct5;
apr_status_t stat = apr_time_exp_gmt_get(&oct5, &c);
const apr_status_t statOK = 0;
- CPPUNIT_ASSERT_EQUAL(statOK, stat);
+ LOGUNIT_ASSERT_EQUAL(statOK, stat);
Pool p;
LogString s;
cachedFormat->format(s, oct5, p);
- CPPUNIT_ASSERT_EQUAL(
+ LOGUNIT_ASSERT_EQUAL(
(LogString) LOG4CXX_STR("October 023 Tuesday"), s);
memset(&c, 0, sizeof(c));
@@ -394,19 +394,19 @@
apr_time_t nov1;
stat = apr_time_exp_gmt_get(&nov1, &c);
- CPPUNIT_ASSERT_EQUAL(statOK, stat);
+ LOGUNIT_ASSERT_EQUAL(statOK, stat);
s.erase(s.begin(), s.end());
cachedFormat->format(s, nov1, p);
- CPPUNIT_ASSERT_EQUAL(
+ LOGUNIT_ASSERT_EQUAL(
(LogString) LOG4CXX_STR("November 023 Monday"), s);
nov1 += 961000;
s.erase(s.begin(), s.end());
cachedFormat->format(s, nov1, p);
- CPPUNIT_ASSERT_EQUAL(
+ LOGUNIT_ASSERT_EQUAL(
(LogString) LOG4CXX_STR("November 984 Monday"), s);
}
@@ -434,7 +434,7 @@
LogString s;
gmtFormat->format(s, jul2, p);
- CPPUNIT_ASSERT_EQUAL(
+ LOGUNIT_ASSERT_EQUAL(
(LogString) LOG4CXX_STR("00,1200"), s);
jul2 = ticks + 87000;
@@ -442,7 +442,7 @@
s.erase(s.begin(), s.end());
gmtFormat->format(s, jul2, p);
- CPPUNIT_ASSERT_EQUAL(
+ LOGUNIT_ASSERT_EQUAL(
(LogString) LOG4CXX_STR("00,870"), s);
}
@@ -460,7 +460,7 @@
int millisecondStart = CachedDateFormat::findMillisecondStart(ticks,
formatted, df, p);
- CPPUNIT_ASSERT_EQUAL(20, millisecondStart);
+ LOGUNIT_ASSERT_EQUAL(20, millisecondStart);
}
/**
@@ -477,7 +477,7 @@
int millisecondStart = CachedDateFormat::findMillisecondStart(ticks,
formatted, df, p);
- CPPUNIT_ASSERT_EQUAL((int) CachedDateFormat::NO_MILLISECONDS, millisecondStart);
+ LOGUNIT_ASSERT_EQUAL((int) CachedDateFormat::NO_MILLISECONDS, millisecondStart);
}
/**
@@ -493,7 +493,7 @@
int millisecondStart = CachedDateFormat::findMillisecondStart(ticks,
formatted, df, p);
- CPPUNIT_ASSERT_EQUAL(9, millisecondStart);
+ LOGUNIT_ASSERT_EQUAL(9, millisecondStart);
}
/**
@@ -509,7 +509,7 @@
int millisecondStart = CachedDateFormat::findMillisecondStart(ticks,
formatted, df, p);
- CPPUNIT_ASSERT_EQUAL((int) CachedDateFormat::UNRECOGNIZED_MILLISECONDS, millisecondStart);
+ LOGUNIT_ASSERT_EQUAL((int) CachedDateFormat::UNRECOGNIZED_MILLISECONDS, millisecondStart);
}
/**
@@ -525,7 +525,7 @@
int millisecondStart =
CachedDateFormat::findMillisecondStart(ticks, formatted, df, p);
- CPPUNIT_ASSERT_EQUAL((int) CachedDateFormat::UNRECOGNIZED_MILLISECONDS, millisecondStart);
+ LOGUNIT_ASSERT_EQUAL((int) CachedDateFormat::UNRECOGNIZED_MILLISECONDS, millisecondStart);
}
@@ -543,20 +543,20 @@
LogString s;
cachedFormat->format(s, jul2, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,000 00:00:00,000"), s);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,000 00:00:00,000"), s);
jul2 += 120000;
s.erase(s.begin(), s.end());
simpleFormat->format(s, jul2, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,120 00:00:00,120"), s);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,120 00:00:00,120"), s);
s.erase(s.begin(), s.end());
cachedFormat->format(s, jul2, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,120 00:00:00,120"), s) ;
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("00:00:00,120 00:00:00,120"), s) ;
int maxValid = CachedDateFormat::getMaximumCacheValidity(badPattern);
- CPPUNIT_ASSERT_EQUAL(1000, maxValid);
+ LOGUNIT_ASSERT_EQUAL(1000, maxValid);
}
/**
@@ -568,7 +568,7 @@
int maxValid =
CachedDateFormat::getMaximumCacheValidity(
LOG4CXX_STR("yyyy-MM-dd"));
- CPPUNIT_ASSERT_EQUAL(1000000, maxValid);
+ LOGUNIT_ASSERT_EQUAL(1000000, maxValid);
}
/**
@@ -580,7 +580,7 @@
int maxValid =
CachedDateFormat::getMaximumCacheValidity(
LOG4CXX_STR("yyyy-MM-dd SSS"));
- CPPUNIT_ASSERT_EQUAL(1000000, maxValid);
+ LOGUNIT_ASSERT_EQUAL(1000000, maxValid);
}
/**
@@ -592,7 +592,7 @@
int maxValid =
CachedDateFormat::getMaximumCacheValidity(
LOG4CXX_STR("yyyy-MM-dd SS"));
- CPPUNIT_ASSERT_EQUAL(1000, maxValid);
+ LOGUNIT_ASSERT_EQUAL(1000, maxValid);
}
/**
@@ -604,10 +604,10 @@
int maxValid =
CachedDateFormat::getMaximumCacheValidity(
LOG4CXX_STR("yyyy-MM-dd SSS SSS"));
- CPPUNIT_ASSERT_EQUAL(1000, maxValid);
+ LOGUNIT_ASSERT_EQUAL(1000, maxValid);
}
};
-CPPUNIT_TEST_SUITE_REGISTRATION(CachedDateFormatTestCase);
+LOGUNIT_TEST_SUITE_REGISTRATION(CachedDateFormatTestCase);
Modified: logging/log4cxx/trunk/src/test/cpp/helpers/charsetdecodertestcase.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/helpers/charsetdecodertestcase.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/helpers/charsetdecodertestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/helpers/charsetdecodertestcase.cpp Mon Jan 28 10:40:19 2008
@@ -15,10 +15,8 @@
* limitations under the License.
*/
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
#include <log4cxx/helpers/charsetdecoder.h>
+#include "../logunit.h"
#include "../insertwide.h"
#include <log4cxx/helpers/bytebuffer.h>
@@ -30,13 +28,13 @@
-class CharsetDecoderTestCase : public CppUnit::TestFixture
+LOGUNIT_CLASS(CharsetDecoderTestCase)
{
- CPPUNIT_TEST_SUITE(CharsetDecoderTestCase);
- CPPUNIT_TEST(decode1);
- CPPUNIT_TEST(decode2);
- CPPUNIT_TEST(decode8);
- CPPUNIT_TEST_SUITE_END();
+ LOGUNIT_TEST_SUITE(CharsetDecoderTestCase);
+ LOGUNIT_TEST(decode1);
+ LOGUNIT_TEST(decode2);
+ LOGUNIT_TEST(decode8);
+ LOGUNIT_TEST_SUITE_END();
enum { BUFSIZE = 256 };
@@ -50,13 +48,13 @@
CharsetDecoderPtr dec(CharsetDecoder::getDefaultDecoder());
LogString greeting;
log4cxx_status_t stat = dec->decode(src, greeting);
- CPPUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
+ LOGUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
stat = dec->decode(src, greeting);
- CPPUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
- CPPUNIT_ASSERT_EQUAL((size_t) 12, src.position());
+ LOGUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
+ LOGUNIT_ASSERT_EQUAL((size_t) 12, src.position());
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("Hello, World"), greeting);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("Hello, World"), greeting);
}
void decode2() {
@@ -74,16 +72,16 @@
LogString greeting;
log4cxx_status_t stat = dec->decode(src, greeting);
- CPPUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
- CPPUNIT_ASSERT_EQUAL((size_t) 0, src.remaining());
+ LOGUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
+ LOGUNIT_ASSERT_EQUAL((size_t) 0, src.remaining());
stat = dec->decode(src, greeting);
- CPPUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
+ LOGUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
LogString manyAs(BUFSIZE - 3, LOG4CXX_STR('A'));
- CPPUNIT_ASSERT_EQUAL(manyAs, greeting.substr(0, BUFSIZE - 3));
- CPPUNIT_ASSERT_EQUAL(LogString(LOG4CXX_STR("Hello")), greeting.substr(BUFSIZE - 3));
+ LOGUNIT_ASSERT_EQUAL(manyAs, greeting.substr(0, BUFSIZE - 3));
+ LOGUNIT_ASSERT_EQUAL(LogString(LOG4CXX_STR("Hello")), greeting.substr(BUFSIZE - 3));
}
@@ -95,18 +93,18 @@
CharsetDecoderPtr dec(CharsetDecoder::getDefaultDecoder());
LogString greeting;
log4cxx_status_t stat = dec->decode(src, greeting);
- CPPUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
+ LOGUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
stat = dec->decode(src, greeting);
- CPPUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
- CPPUNIT_ASSERT_EQUAL((size_t) 12, src.position());
+ LOGUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
+ LOGUNIT_ASSERT_EQUAL((size_t) 12, src.position());
const logchar expected[] = { 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x2C, 0x00, 0x57, 0x6F, 0x72, 0x6C, 0x64 };
- CPPUNIT_ASSERT_EQUAL(LogString(expected, 12), greeting);
+ LOGUNIT_ASSERT_EQUAL(LogString(expected, 12), greeting);
}
};
-CPPUNIT_TEST_SUITE_REGISTRATION(CharsetDecoderTestCase);
+LOGUNIT_TEST_SUITE_REGISTRATION(CharsetDecoderTestCase);
Modified: logging/log4cxx/trunk/src/test/cpp/helpers/charsetencodertestcase.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/helpers/charsetencodertestcase.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/helpers/charsetencodertestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/helpers/charsetencodertestcase.cpp Mon Jan 28 10:40:19 2008
@@ -15,10 +15,8 @@
* limitations under the License.
*/
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
#include <log4cxx/helpers/charsetencoder.h>
+#include "../logunit.h"
#include "../insertwide.h"
#include <log4cxx/helpers/bytebuffer.h>
#include <log4cxx/helpers/thread.h>
@@ -35,15 +33,15 @@
class CharsetEncoderTestCase : public CppUnit::TestFixture
{
- CPPUNIT_TEST_SUITE(CharsetEncoderTestCase);
+ LOGUNIT_TEST_SUITE(CharsetEncoderTestCase);
#if APR_HAS_THREADS
- CPPUNIT_TEST(thread1);
+ LOGUNIT_TEST(thread1);
#endif
- CPPUNIT_TEST(encode1);
- CPPUNIT_TEST(encode2);
- CPPUNIT_TEST(encode3);
- CPPUNIT_TEST(encode4);
- CPPUNIT_TEST_SUITE_END();
+ LOGUNIT_TEST(encode1);
+ LOGUNIT_TEST(encode2);
+ LOGUNIT_TEST(encode3);
+ LOGUNIT_TEST(encode4);
+ LOGUNIT_TEST_SUITE_END();
enum { BUFSIZE = 256 };
@@ -57,17 +55,17 @@
ByteBuffer out(buf, BUFSIZE);
LogString::const_iterator iter = greeting.begin();
log4cxx_status_t stat = enc->encode(greeting, iter, out);
- CPPUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
- CPPUNIT_ASSERT(iter == greeting.end());
+ LOGUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
+ LOGUNIT_ASSERT(iter == greeting.end());
stat = enc->encode(greeting, iter, out);
- CPPUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
- CPPUNIT_ASSERT_EQUAL((size_t) 12, out.position());
+ LOGUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
+ LOGUNIT_ASSERT_EQUAL((size_t) 12, out.position());
out.flip();
std::string encoded((const char*) out.data(), out.limit());
- CPPUNIT_ASSERT_EQUAL((std::string) "Hello, World", encoded);
- CPPUNIT_ASSERT(iter == greeting.end());
+ LOGUNIT_ASSERT_EQUAL((std::string) "Hello, World", encoded);
+ LOGUNIT_ASSERT(iter == greeting.end());
}
void encode2() {
@@ -80,27 +78,27 @@
ByteBuffer out(buf, BUFSIZE);
LogString::const_iterator iter = greeting.begin();
log4cxx_status_t stat = enc->encode(greeting, iter, out);
- CPPUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
- CPPUNIT_ASSERT_EQUAL((size_t) 0, out.remaining());
- CPPUNIT_ASSERT_EQUAL(LOG4CXX_STR('o'), *(iter+1));
+ LOGUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
+ LOGUNIT_ASSERT_EQUAL((size_t) 0, out.remaining());
+ LOGUNIT_ASSERT_EQUAL(LOG4CXX_STR('o'), *(iter+1));
out.flip();
std::string encoded((char*) out.data(), out.limit());
out.clear();
stat = enc->encode(greeting, iter, out);
- CPPUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
- CPPUNIT_ASSERT_EQUAL((size_t) 2, out.position());
- CPPUNIT_ASSERT(iter == greeting.end());
+ LOGUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
+ LOGUNIT_ASSERT_EQUAL((size_t) 2, out.position());
+ LOGUNIT_ASSERT(iter == greeting.end());
stat = enc->encode(greeting, iter, out);
out.flip();
- CPPUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
+ LOGUNIT_ASSERT_EQUAL(APR_SUCCESS, stat);
encoded.append(out.data(), out.limit());
std::string manyAs(BUFSIZE - 3, 'A');
- CPPUNIT_ASSERT_EQUAL(manyAs, encoded.substr(0, BUFSIZE - 3));
- CPPUNIT_ASSERT_EQUAL(std::string("Hello"), encoded.substr(BUFSIZE - 3));
+ LOGUNIT_ASSERT_EQUAL(manyAs, encoded.substr(0, BUFSIZE - 3));
+ LOGUNIT_ASSERT_EQUAL(std::string("Hello"), encoded.substr(BUFSIZE - 3));
}
@@ -130,10 +128,10 @@
LogString::const_iterator iter = greeting.begin();
log4cxx_status_t stat = enc->encode(greeting, iter, out);
out.flip();
- CPPUNIT_ASSERT_EQUAL(true, CharsetEncoder::isError(stat));
- CPPUNIT_ASSERT_EQUAL((size_t) 1, out.limit());
- CPPUNIT_ASSERT_EQUAL(greet[1], *iter);
- CPPUNIT_ASSERT_EQUAL('A', out.data()[0]);
+ LOGUNIT_ASSERT_EQUAL(true, CharsetEncoder::isError(stat));
+ LOGUNIT_ASSERT_EQUAL((size_t) 1, out.limit());
+ LOGUNIT_ASSERT_EQUAL(greet[1], *iter);
+ LOGUNIT_ASSERT_EQUAL('A', out.data()[0]);
}
@@ -162,16 +160,16 @@
ByteBuffer out(buf, BUFSIZE);
LogString::const_iterator iter = greeting.begin();
log4cxx_status_t stat = enc->encode(greeting, iter, out);
- CPPUNIT_ASSERT_EQUAL(false, CharsetEncoder::isError(stat));
+ LOGUNIT_ASSERT_EQUAL(false, CharsetEncoder::isError(stat));
stat = enc->encode(greeting, iter, out);
- CPPUNIT_ASSERT_EQUAL(false, CharsetEncoder::isError(stat));
+ LOGUNIT_ASSERT_EQUAL(false, CharsetEncoder::isError(stat));
out.flip();
- CPPUNIT_ASSERT_EQUAL((size_t) 13, out.limit());
+ LOGUNIT_ASSERT_EQUAL((size_t) 13, out.limit());
for(size_t i = 0; i < out.limit(); i++) {
- CPPUNIT_ASSERT_EQUAL((int) utf8_greet[i], (int) out.data()[i]);
+ LOGUNIT_ASSERT_EQUAL((int) utf8_greet[i], (int) out.data()[i]);
}
- CPPUNIT_ASSERT(iter == greeting.end());
+ LOGUNIT_ASSERT(iter == greeting.end());
}
#if APR_HAS_THREADS
@@ -293,12 +291,12 @@
for(int i = 0; i < THREAD_COUNT; i++) {
threads[i].join();
}
- CPPUNIT_ASSERT_EQUAL((apr_uint32_t) 0, package->getFail());
- CPPUNIT_ASSERT_EQUAL((apr_uint32_t) THREAD_COUNT * THREAD_REPS, package->getPass());
+ LOGUNIT_ASSERT_EQUAL((apr_uint32_t) 0, package->getFail());
+ LOGUNIT_ASSERT_EQUAL((apr_uint32_t) THREAD_COUNT * THREAD_REPS, package->getPass());
delete package;
}
#endif
};
-CPPUNIT_TEST_SUITE_REGISTRATION(CharsetEncoderTestCase);
+LOGUNIT_TEST_SUITE_REGISTRATION(CharsetEncoderTestCase);
Modified: logging/log4cxx/trunk/src/test/cpp/helpers/cyclicbuffertestcase.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/helpers/cyclicbuffertestcase.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/helpers/cyclicbuffertestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/helpers/cyclicbuffertestcase.cpp Mon Jan 28 10:40:19 2008
@@ -15,12 +15,11 @@
* limitations under the License.
*/
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
+#include <log4cxx/helpers/cyclicbuffer.h>
+#include "../logunit.h"
#include <log4cxx/logmanager.h>
#include <log4cxx/logger.h>
-#include <log4cxx/helpers/cyclicbuffer.h>
#include <log4cxx/spi/loggingevent.h>
#include <log4cxx/spi/location/locationinfo.h>
#include "../testchar.h"
@@ -31,13 +30,13 @@
#define MAX 1000
-class CyclicBufferTestCase : public CppUnit::TestFixture
+LOGUNIT_CLASS(CyclicBufferTestCase)
{
- CPPUNIT_TEST_SUITE(CyclicBufferTestCase);
- CPPUNIT_TEST(test0);
- CPPUNIT_TEST(test1);
- CPPUNIT_TEST(testResize);
- CPPUNIT_TEST_SUITE_END();
+ LOGUNIT_TEST_SUITE(CyclicBufferTestCase);
+ LOGUNIT_TEST(test0);
+ LOGUNIT_TEST(test1);
+ LOGUNIT_TEST(testResize);
+ LOGUNIT_TEST_SUITE_END();
LoggerPtr logger;
std::vector<LoggingEventPtr> e;
@@ -66,25 +65,25 @@
int size = 2;
CyclicBuffer cb(size);
- CPPUNIT_ASSERT_EQUAL(size, cb.getMaxSize());
+ LOGUNIT_ASSERT_EQUAL(size, cb.getMaxSize());
cb.add(e[0]);
- CPPUNIT_ASSERT_EQUAL(1, cb.length());
- CPPUNIT_ASSERT_EQUAL(e[0], cb.get());
- CPPUNIT_ASSERT_EQUAL(0, cb.length());
- CPPUNIT_ASSERT(cb.get() == 0);
- CPPUNIT_ASSERT_EQUAL(0, cb.length());
+ LOGUNIT_ASSERT_EQUAL(1, cb.length());
+ LOGUNIT_ASSERT_EQUAL(e[0], cb.get());
+ LOGUNIT_ASSERT_EQUAL(0, cb.length());
+ LOGUNIT_ASSERT(cb.get() == 0);
+ LOGUNIT_ASSERT_EQUAL(0, cb.length());
CyclicBuffer cb2(size);
cb2.add(e[0]);
cb2.add(e[1]);
- CPPUNIT_ASSERT_EQUAL(2, cb2.length());
- CPPUNIT_ASSERT_EQUAL(e[0], cb2.get());
- CPPUNIT_ASSERT_EQUAL(1, cb2.length());
- CPPUNIT_ASSERT_EQUAL(e[1], cb2.get());
- CPPUNIT_ASSERT_EQUAL(0, cb2.length());
- CPPUNIT_ASSERT(cb2.get() == 0);
- CPPUNIT_ASSERT_EQUAL(0, cb2.length());
+ LOGUNIT_ASSERT_EQUAL(2, cb2.length());
+ LOGUNIT_ASSERT_EQUAL(e[0], cb2.get());
+ LOGUNIT_ASSERT_EQUAL(1, cb2.length());
+ LOGUNIT_ASSERT_EQUAL(e[1], cb2.get());
+ LOGUNIT_ASSERT_EQUAL(0, cb2.length());
+ LOGUNIT_ASSERT(cb2.get() == 0);
+ LOGUNIT_ASSERT_EQUAL(0, cb2.length());
}
void test1()
@@ -98,13 +97,13 @@
//System.out.println("Doing test with size = "+size);
CyclicBuffer cb(size);
- CPPUNIT_ASSERT_EQUAL(size, cb.getMaxSize());
+ LOGUNIT_ASSERT_EQUAL(size, cb.getMaxSize());
int i;
for (i = -(size + 10); i < (size + 10); i++)
{
- CPPUNIT_ASSERT(cb.get(i) == 0);
+ LOGUNIT_ASSERT(cb.get(i) == 0);
}
for (i = 0; i < MAX; i++)
@@ -117,11 +116,11 @@
for (int j = limit; j >= 0; j--)
{
//System.out.println("i= "+i+", j="+j);
- CPPUNIT_ASSERT_EQUAL(e[i - (limit - j)], cb.get(j));
+ LOGUNIT_ASSERT_EQUAL(e[i - (limit - j)], cb.get(j));
}
- CPPUNIT_ASSERT(cb.get(-1) == 0);
- CPPUNIT_ASSERT(cb.get(limit + 1) == 0);
+ LOGUNIT_ASSERT(cb.get(-1) == 0);
+ LOGUNIT_ASSERT(cb.get(limit + 1) == 0);
}
}
@@ -163,9 +162,9 @@
//System.out.println("Len = "+len+", offset="+offset);
for (int j = 0; j < len; j++)
{
- CPPUNIT_ASSERT_EQUAL(e[offset + j], cb.get(j));
+ LOGUNIT_ASSERT_EQUAL(e[offset + j], cb.get(j));
}
}
};
-CPPUNIT_TEST_SUITE_REGISTRATION(CyclicBufferTestCase);
+LOGUNIT_TEST_SUITE_REGISTRATION(CyclicBufferTestCase);
Modified: logging/log4cxx/trunk/src/test/cpp/helpers/datetimedateformattestcase.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/helpers/datetimedateformattestcase.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/helpers/datetimedateformattestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/helpers/datetimedateformattestcase.cpp Mon Jan 28 10:40:19 2008
@@ -18,7 +18,7 @@
#define __STDC_CONSTANT_MACROS
#include <log4cxx/logstring.h>
#include <log4cxx/helpers/datetimedateformat.h>
-#include <cppunit/extensions/HelperMacros.h>
+#include "../logunit.h"
#include <log4cxx/helpers/pool.h>
#include "../insertwide.h"
#include <apr.h>
@@ -57,20 +57,20 @@
@author Curt Arnold
@since 0.9.8
*/
-class DateTimeDateFormatTestCase : public CppUnit::TestFixture
+LOGUNIT_CLASS(DateTimeDateFormatTestCase)
{
- CPPUNIT_TEST_SUITE( DateTimeDateFormatTestCase );
- CPPUNIT_TEST( test1 );
- CPPUNIT_TEST( test2 );
- CPPUNIT_TEST( test3 );
- CPPUNIT_TEST( test4 );
- CPPUNIT_TEST( test5 );
- CPPUNIT_TEST( test6 );
+ LOGUNIT_TEST_SUITE( DateTimeDateFormatTestCase );
+ LOGUNIT_TEST( test1 );
+ LOGUNIT_TEST( test2 );
+ LOGUNIT_TEST( test3 );
+ LOGUNIT_TEST( test4 );
+ LOGUNIT_TEST( test5 );
+ LOGUNIT_TEST( test6 );
#if LOG4CXX_HAS_STD_LOCALE
- CPPUNIT_TEST( test7 );
- CPPUNIT_TEST( test8 );
+ LOGUNIT_TEST( test7 );
+ LOGUNIT_TEST( test8 );
#endif
- CPPUNIT_TEST_SUITE_END();
+ LOGUNIT_TEST_SUITE_END();
@@ -94,7 +94,7 @@
LogString actual;
Pool p;
formatter.format(actual, date, p);
- CPPUNIT_ASSERT_EQUAL( expected, actual );
+ LOGUNIT_ASSERT_EQUAL( expected, actual );
}
/** Convert 02 Jan 2004 00:00:00 GMT for GMT. */
@@ -205,7 +205,7 @@
struct tm avr11tm = { 0, 0, 0, 11, 03, 104 };
LogString expected(formatDate(localeFR, avr11tm, LOG4CXX_STR("%b")));
- CPPUNIT_ASSERT_EQUAL(expected, formatted);
+ LOGUNIT_ASSERT_EQUAL(expected, formatted);
}
}
@@ -225,12 +225,12 @@
struct tm apr11tm = { 0, 0, 0, 11, 03, 104 };
LogString expected(formatDate(localeUS, apr11tm, LOG4CXX_STR("%b")));
- CPPUNIT_ASSERT_EQUAL(expected, formatted);
+ LOGUNIT_ASSERT_EQUAL(expected, formatted);
}
}
#endif
};
-CPPUNIT_TEST_SUITE_REGISTRATION(DateTimeDateFormatTestCase);
+LOGUNIT_TEST_SUITE_REGISTRATION(DateTimeDateFormatTestCase);
Modified: logging/log4cxx/trunk/src/test/cpp/helpers/inetaddresstestcase.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/helpers/inetaddresstestcase.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/helpers/inetaddresstestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/helpers/inetaddresstestcase.cpp Mon Jan 28 10:40:19 2008
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/helpers/inetaddress.h>
+#include "../logunit.h"
using namespace log4cxx;
using namespace log4cxx::helpers;
@@ -24,13 +24,12 @@
class InetAddressTestCase : public CppUnit::TestFixture
{
- CPPUNIT_TEST_SUITE(InetAddressTestCase);
- CPPUNIT_TEST(testGetLocalHost);
- CPPUNIT_TEST(testByNameLocal);
- CPPUNIT_TEST(testAllByNameLocal);
- CPPUNIT_TEST_EXCEPTION(testUnknownHost, UnknownHostException);
- CPPUNIT_TEST(testUnreachable);
- CPPUNIT_TEST_SUITE_END();
+ LOGUNIT_TEST_SUITE(InetAddressTestCase);
+ LOGUNIT_TEST(testGetLocalHost);
+ LOGUNIT_TEST(testByNameLocal);
+ LOGUNIT_TEST(testAllByNameLocal);
+ LOGUNIT_TEST(testUnreachable);
+ LOGUNIT_TEST_SUITE_END();
public:
/**
@@ -39,8 +38,8 @@
void testGetLocalHost() {
InetAddressPtr addr = InetAddress::getLocalHost();
- CPPUNIT_ASSERT(addr->getHostAddress() == LOG4CXX_STR("127.0.0.1"));
- CPPUNIT_ASSERT(!addr->getHostName().empty());
+ LOGUNIT_ASSERT(addr->getHostAddress() == LOG4CXX_STR("127.0.0.1"));
+ LOGUNIT_ASSERT(!addr->getHostName().empty());
}
/**
@@ -50,8 +49,8 @@
void testByNameLocal() {
InetAddressPtr addr = InetAddress::getByName(LOG4CXX_STR("localhost"));
- CPPUNIT_ASSERT(addr->getHostAddress() == LOG4CXX_STR("127.0.0.1"));
- CPPUNIT_ASSERT(!addr->getHostName().empty());
+ LOGUNIT_ASSERT(addr->getHostAddress() == LOG4CXX_STR("127.0.0.1"));
+ LOGUNIT_ASSERT(!addr->getHostName().empty());
}
/**
@@ -61,7 +60,7 @@
void testAllByNameLocal() {
std::vector<InetAddressPtr> addr = InetAddress::getAllByName(LOG4CXX_STR("localhost"));
- CPPUNIT_ASSERT(addr.size() > 0);
+ LOGUNIT_ASSERT(addr.size() > 0);
}
/**
@@ -77,11 +76,11 @@
void testUnreachable() {
InetAddressPtr addr(InetAddress::getByName(LOG4CXX_STR("192.168.10.254")));
LogString addrStr(addr->toString());
- CPPUNIT_ASSERT_EQUAL(addrStr.size() - 15, addrStr.find(LOG4CXX_STR("/192.168.10.254")));
+ LOGUNIT_ASSERT_EQUAL(addrStr.size() - 15, addrStr.find(LOG4CXX_STR("/192.168.10.254")));
}
};
-CPPUNIT_TEST_SUITE_REGISTRATION(InetAddressTestCase);
+LOGUNIT_TEST_SUITE_REGISTRATION(InetAddressTestCase);
Modified: logging/log4cxx/trunk/src/test/cpp/helpers/iso8601dateformattestcase.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/helpers/iso8601dateformattestcase.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/helpers/iso8601dateformattestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/helpers/iso8601dateformattestcase.cpp Mon Jan 28 10:40:19 2008
@@ -16,7 +16,7 @@
*/
#include <log4cxx/logstring.h>
#include <log4cxx/helpers/iso8601dateformat.h>
-#include <cppunit/extensions/HelperMacros.h>
+#include "../logunit.h"
#define LOG4CXX_TEST
#include <log4cxx/private/log4cxx_private.h>
#if LOG4CXX_HAS_STD_LOCALE
@@ -35,17 +35,16 @@
Unit test {@link ISO8601DateFormat}.
@author Curt Arnold
@since 1.3.0 */
- class ISO8601DateFormatTestCase : public CppUnit::TestFixture
- {
- CPPUNIT_TEST_SUITE( ISO8601DateFormatTestCase );
- CPPUNIT_TEST( test1 );
- CPPUNIT_TEST( test2 );
- CPPUNIT_TEST( test3 );
- CPPUNIT_TEST( test4 );
- CPPUNIT_TEST( test5 );
- CPPUNIT_TEST( test6 );
- CPPUNIT_TEST( test7 );
- CPPUNIT_TEST_SUITE_END();
+LOGUNIT_CLASS(ISO8601DateFormatTestCase) {
+ LOGUNIT_TEST_SUITE( ISO8601DateFormatTestCase );
+ LOGUNIT_TEST( test1 );
+ LOGUNIT_TEST( test2 );
+ LOGUNIT_TEST( test3 );
+ LOGUNIT_TEST( test4 );
+ LOGUNIT_TEST( test5 );
+ LOGUNIT_TEST( test6 );
+ LOGUNIT_TEST( test7 );
+ LOGUNIT_TEST_SUITE_END();
/**
* Asserts that formatting the provided date results
@@ -63,7 +62,7 @@
LogString actual;
Pool p;
formatter.format(actual, date, p);
- CPPUNIT_ASSERT_EQUAL(expected, actual);
+ LOGUNIT_ASSERT_EQUAL(expected, actual);
}
@@ -151,7 +150,7 @@
ISO8601DateFormat formatter;
Pool p;
formatter.numberFormat(number, 87, p);
- CPPUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("87"), number);
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("87"), number);
}
@@ -159,4 +158,4 @@
};
-CPPUNIT_TEST_SUITE_REGISTRATION(ISO8601DateFormatTestCase);
+LOGUNIT_TEST_SUITE_REGISTRATION(ISO8601DateFormatTestCase);
Modified: logging/log4cxx/trunk/src/test/cpp/helpers/messagebuffertest.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/helpers/messagebuffertest.cpp?rev=615984&r1=615983&r2=615984&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/helpers/messagebuffertest.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/helpers/messagebuffertest.cpp Mon Jan 28 10:40:19 2008
@@ -15,11 +15,10 @@
* limitations under the License.
*/
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
#include <log4cxx/helpers/messagebuffer.h>
#include <iomanip>
#include "../insertwide.h"
+#include "../logunit.h"
#include <log4cxx/logstring.h>
#if LOG4CXX_CFSTRING_API
@@ -32,29 +31,29 @@
/**
* Test MessageBuffer.
*/
-class MessageBufferTest : public CppUnit::TestFixture
+LOGUNIT_CLASS(MessageBufferTest)
{
- CPPUNIT_TEST_SUITE(MessageBufferTest);
- CPPUNIT_TEST(testInsertChar);
- CPPUNIT_TEST(testInsertConstStr);
- CPPUNIT_TEST(testInsertStr);
- CPPUNIT_TEST(testInsertString);
- CPPUNIT_TEST(testInsertNull);
- CPPUNIT_TEST(testInsertInt);
- CPPUNIT_TEST(testInsertManipulator);
+ LOGUNIT_TEST_SUITE(MessageBufferTest);
+ LOGUNIT_TEST(testInsertChar);
+ LOGUNIT_TEST(testInsertConstStr);
+ LOGUNIT_TEST(testInsertStr);
+ LOGUNIT_TEST(testInsertString);
+ LOGUNIT_TEST(testInsertNull);
+ LOGUNIT_TEST(testInsertInt);
+ LOGUNIT_TEST(testInsertManipulator);
#if LOG4CXX_WCHAR_T_API
- CPPUNIT_TEST(testInsertConstWStr);
- CPPUNIT_TEST(testInsertWString);
- CPPUNIT_TEST(testInsertWStr);
+ LOGUNIT_TEST(testInsertConstWStr);
+ LOGUNIT_TEST(testInsertWString);
+ LOGUNIT_TEST(testInsertWStr);
#endif
#if LOG4CXX_UNICHAR_API
- CPPUNIT_TEST(testInsertConstUStr);
- CPPUNIT_TEST(testInsertUString);
+ LOGUNIT_TEST(testInsertConstUStr);
+ LOGUNIT_TEST(testInsertUString);
#endif
#if LOG4CXX_CFSTRING_API
- CPPUNIT_TEST(testInsertCFString);
+ LOGUNIT_TEST(testInsertCFString);
#endif
- CPPUNIT_TEST_SUITE_END();
+ LOGUNIT_TEST_SUITE_END();
public:
@@ -62,16 +61,16 @@
MessageBuffer buf;
std::string greeting("Hello, World");
CharMessageBuffer& retval = buf << "Hello, Worl" << 'd';
- CPPUNIT_ASSERT_EQUAL(greeting, buf.str(retval));
- CPPUNIT_ASSERT_EQUAL(false, buf.hasStream());
+ LOGUNIT_ASSERT_EQUAL(greeting, buf.str(retval));
+ LOGUNIT_ASSERT_EQUAL(false, buf.hasStream());
}
void testInsertConstStr() {
MessageBuffer buf;
std::string greeting("Hello, World");
CharMessageBuffer& retval = buf << "Hello" << ", World";
- CPPUNIT_ASSERT_EQUAL(greeting, buf.str(retval));
- CPPUNIT_ASSERT_EQUAL(false, buf.hasStream());
+ LOGUNIT_ASSERT_EQUAL(greeting, buf.str(retval));
+ LOGUNIT_ASSERT_EQUAL(false, buf.hasStream());
}
void testInsertStr() {
@@ -84,40 +83,40 @@
CharMessageBuffer& retval = buf << part1 << part2;
free(part1);
free(part2);
- CPPUNIT_ASSERT_EQUAL(greeting, buf.str(retval));
- CPPUNIT_ASSERT_EQUAL(false, buf.hasStream());
+ LOGUNIT_ASSERT_EQUAL(greeting, buf.str(retval));
+ LOGUNIT_ASSERT_EQUAL(false, buf.hasStream());
}
void testInsertString() {
MessageBuffer buf;
std::string greeting("Hello, World");
CharMessageBuffer& retval = buf << std::string("Hello") << std::string(", World");
- CPPUNIT_ASSERT_EQUAL(greeting, buf.str(retval));
- CPPUNIT_ASSERT_EQUAL(false, buf.hasStream());
+ LOGUNIT_ASSERT_EQUAL(greeting, buf.str(retval));
+ LOGUNIT_ASSERT_EQUAL(false, buf.hasStream());
}
void testInsertNull() {
MessageBuffer buf;
std::string greeting("Hello, null");
CharMessageBuffer& retval = buf << "Hello, " << (const char*) 0;
- CPPUNIT_ASSERT_EQUAL(greeting, buf.str(retval));
- CPPUNIT_ASSERT_EQUAL(false, buf.hasStream());
+ LOGUNIT_ASSERT_EQUAL(greeting, buf.str(retval));
+ LOGUNIT_ASSERT_EQUAL(false, buf.hasStream());
}
void testInsertInt() {
MessageBuffer buf;
std::string greeting("Hello, 5");
std::ostream& retval = buf << "Hello, " << 5;
- CPPUNIT_ASSERT_EQUAL(greeting, buf.str(retval));
- CPPUNIT_ASSERT_EQUAL(true, buf.hasStream());
+ LOGUNIT_ASSERT_EQUAL(greeting, buf.str(retval));
+ LOGUNIT_ASSERT_EQUAL(true, buf.hasStream());
}
void testInsertManipulator() {
MessageBuffer buf;
std::string greeting("pi=3.142");
std::ostream& retval = buf << "pi=" << std::setprecision(4) << 3.1415926;
- CPPUNIT_ASSERT_EQUAL(greeting, buf.str(retval));
- CPPUNIT_ASSERT_EQUAL(true, buf.hasStream());
+ LOGUNIT_ASSERT_EQUAL(greeting, buf.str(retval));
+ LOGUNIT_ASSERT_EQUAL(true, buf.hasStream());
}
#if LOG4CXX_WCHAR_T_API
@@ -125,16 +124,16 @@
MessageBuffer buf;
std::wstring greeting(L"Hello, World");
WideMessageBuffer& retval = buf << L"Hello" << L", World";
- CPPUNIT_ASSERT_EQUAL(greeting, buf.str(retval));
- CPPUNIT_ASSERT_EQUAL(false, buf.hasStream());
+ LOGUNIT_ASSERT_EQUAL(greeting, buf.str(retval));
+ LOGUNIT_ASSERT_EQUAL(false, buf.hasStream());
}
void testInsertWString() {
MessageBuffer buf;
std::wstring greeting(L"Hello, World");
WideMessageBuffer& retval = buf << std::wstring(L"Hello") << std::wstring(L", World");
- CPPUNIT_ASSERT_EQUAL(greeting, buf.str(retval));
- CPPUNIT_ASSERT_EQUAL(false, buf.hasStream());
+ LOGUNIT_ASSERT_EQUAL(greeting, buf.str(retval));
+ LOGUNIT_ASSERT_EQUAL(false, buf.hasStream());
}
void testInsertWStr() {
@@ -147,8 +146,8 @@
WideMessageBuffer& retval = buf << part1 << part2;
free(part1);
free(part2);
- CPPUNIT_ASSERT_EQUAL(greeting, buf.str(retval));
- CPPUNIT_ASSERT_EQUAL(false, buf.hasStream());
+ LOGUNIT_ASSERT_EQUAL(greeting, buf.str(retval));
+ LOGUNIT_ASSERT_EQUAL(false, buf.hasStream());
}
#endif
@@ -160,8 +159,8 @@
const UniChar greeting[] = { 'H', 'e', 'l', 'l', 'o',
',', ' ', 'W', 'o', 'r', 'l', 'd', 0 };
UniCharMessageBuffer& retval = buf << hello << world;
- CPPUNIT_ASSERT_EQUAL(std::basic_string<UniChar>(greeting), buf.str(retval));
- CPPUNIT_ASSERT_EQUAL(false, buf.hasStream());
+ LOGUNIT_ASSERT_EQUAL(std::basic_string<UniChar>(greeting), buf.str(retval));
+ LOGUNIT_ASSERT_EQUAL(false, buf.hasStream());
}
void testInsertUString() {
@@ -172,8 +171,8 @@
',', ' ', 'W', 'o', 'r', 'l', 'd', 0 };
UniCharMessageBuffer& retval = buf << std::basic_string<UniChar>(hello)
<< std::basic_string<UniChar>(world);
- CPPUNIT_ASSERT_EQUAL(std::basic_string<UniChar>(greeting), buf.str(retval));
- CPPUNIT_ASSERT_EQUAL(false, buf.hasStream());
+ LOGUNIT_ASSERT_EQUAL(std::basic_string<UniChar>(greeting), buf.str(retval));
+ LOGUNIT_ASSERT_EQUAL(false, buf.hasStream());
}
#endif
@@ -185,13 +184,13 @@
',', ' ', 'W', 'o', 'r', 'l', 'd', 0 };
UniCharMessageBuffer& retval = buf << CFSTR("Hello")
<< CFSTR(", World");
- CPPUNIT_ASSERT_EQUAL(std::basic_string<log4cxx::UniChar>(greeting), buf.str(retval));
- CPPUNIT_ASSERT_EQUAL(false, buf.hasStream());
+ LOGUNIT_ASSERT_EQUAL(std::basic_string<log4cxx::UniChar>(greeting), buf.str(retval));
+ LOGUNIT_ASSERT_EQUAL(false, buf.hasStream());
}
#endif
};
-CPPUNIT_TEST_SUITE_REGISTRATION(MessageBufferTest);
+LOGUNIT_TEST_SUITE_REGISTRATION(MessageBufferTest);