From: tho Date: Thu, 14 Jul 2011 14:25:25 +0000 (+0000) Subject: Logger: fixed SyslogUDPTarget unit test X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=155af7f1e42a94e986378b8a7a129a00601c048c;p=senf.git Logger: fixed SyslogUDPTarget unit test git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1796 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/Utils/Logger/SyslogUDPTarget.test.cc b/senf/Utils/Logger/SyslogUDPTarget.test.cc index 8278eaa..e496935 100644 --- a/senf/Utils/Logger/SyslogUDPTarget.test.cc +++ b/senf/Utils/Logger/SyslogUDPTarget.test.cc @@ -35,6 +35,7 @@ #include "SyslogUDPTarget.hh" #include #include +#include "boost/date_time/gregorian/gregorian.hpp" #include "Logger.hh" #include @@ -68,6 +69,8 @@ namespace { SENF_AUTO_UNIT_TEST(syslogUDPTarget) { + using namespace boost::gregorian; + senf::log::SyslogUDPTarget udplog ( senf::INet4SocketAddress(senf::INet4Address::Loopback, port(0))); senf::UDPv4ClientSocketHandle server ( @@ -85,12 +88,13 @@ SENF_AUTO_UNIT_TEST(syslogUDPTarget) BOOST_CHECK_EQUAL( server.read(), "<13> Test message" ); BOOST_CHECK_EQUAL( server.read(), "<13> Line 2" ); - udplog.timeFormat(""); + udplog.timeFormat("%Y-%m-%d"); udplog.showTime(); - SENF_LOG(("Very long message: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ); - BOOST_CHECK_EQUAL( server.read(), "<13> 0000000000.000000000 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ); + date d (day_clock::local_day()); + BOOST_CHECK_EQUAL( server.read(), "<13> " + to_iso_extended_string(d) + " Very long message: " + std::string(896-5-10-19-1, 'x') ); + BOOST_CHECK_EQUAL( server.read(), "<13> " + to_iso_extended_string(d) + " " + std::string(5+10+19+1, 'x')); } //-/////////////////////////////////////////////////////////////////////////////////////////////////