mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-02-12 07:47:12 +01:00
Switched to POCO library for unified platform/library interface. Deprecated the external module API. It was creating more problems than solving. Removed most built-in libraries in favor of system libraries for easier maintenance. Cleaned and secured code with help from static analyzers.
75 lines
1.4 KiB
C++
75 lines
1.4 KiB
C++
//
|
|
// LogStreamTest.cpp
|
|
//
|
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
|
// All rights reserved.
|
|
//
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
//
|
|
|
|
|
|
#include "LogStreamTest.h"
|
|
#include "CppUnit/TestCaller.h"
|
|
#include "CppUnit/TestSuite.h"
|
|
#include "Poco/Logger.h"
|
|
#include "Poco/LogStream.h"
|
|
#include "Poco/AutoPtr.h"
|
|
#include "TestChannel.h"
|
|
|
|
|
|
using Poco::Logger;
|
|
using Poco::LogStream;
|
|
using Poco::Channel;
|
|
using Poco::Message;
|
|
using Poco::AutoPtr;
|
|
|
|
|
|
LogStreamTest::LogStreamTest(const std::string& name): CppUnit::TestCase(name)
|
|
{
|
|
}
|
|
|
|
|
|
LogStreamTest::~LogStreamTest()
|
|
{
|
|
}
|
|
|
|
|
|
void LogStreamTest::testLogStream()
|
|
{
|
|
AutoPtr<TestChannel> pChannel = new TestChannel;
|
|
Logger& root = Logger::root();
|
|
root.setChannel(pChannel);
|
|
|
|
LogStream ls(root);
|
|
|
|
ls << "information" << ' ' << 1 << std::endl;
|
|
assertTrue (pChannel->list().begin()->getPriority() == Message::PRIO_INFORMATION);
|
|
assertTrue (pChannel->list().begin()->getText() == "information 1");
|
|
pChannel->list().clear();
|
|
|
|
ls.error() << "error" << std::endl;
|
|
assertTrue (pChannel->list().begin()->getPriority() == Message::PRIO_ERROR);
|
|
assertTrue (pChannel->list().begin()->getText() == "error");
|
|
pChannel->list().clear();
|
|
}
|
|
|
|
|
|
void LogStreamTest::setUp()
|
|
{
|
|
}
|
|
|
|
|
|
void LogStreamTest::tearDown()
|
|
{
|
|
}
|
|
|
|
|
|
CppUnit::Test* LogStreamTest::suite()
|
|
{
|
|
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("LogStreamTest");
|
|
|
|
CppUnit_addTest(pSuite, LogStreamTest, testLogStream);
|
|
|
|
return pSuite;
|
|
}
|