Skip to content

Commit

Permalink
Test: Added the "log" test for testing libdeng2 log output
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Nov 22, 2012
1 parent 73ac29a commit 3540ff4
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doomsday/tests/log/log.pro
@@ -0,0 +1,8 @@
include(../config_test.pri)

TEMPLATE = app
TARGET = test_log

SOURCES += main.cpp

deployTest($$TARGET)
57 changes: 57 additions & 0 deletions doomsday/tests/log/main.cpp
@@ -0,0 +1,57 @@
/*
* The Doomsday Engine Project
*
* Copyright (c) 2012 Jaakko Keränen <jaakko.keranen@iki.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/

#include <de/App>
#include <de/Log>

#include <QDebug>

using namespace de;

int main(int argc, char** argv)
{
try
{
App app(argc, argv, App::GUIDisabled);
app.initSubsystems(App::DisablePlugins);

for(int i = 0; i < Log::MAX_LOG_LEVELS; ++i)
{
Log::LogLevel level = Log::LogLevel(i);
LogBuffer::appBuffer().enable(level);
LOG().enter(level, "Enabled level ") << Log::levelToText(level);

for(int k = 0; k < Log::MAX_LOG_LEVELS; ++k)
{
Log::LogLevel other = Log::LogLevel(k);
LOG().enter(other, "- entry at level %s (currently enabled %s): visible: %b")
<< Log::levelToText(other)
<< Log::levelToText(level)
<< LogBuffer::appBuffer().isEnabled(other);
}
}
}
catch(const Error& err)
{
qWarning() << err.asText();
}

qDebug() << "Exiting main()...";
return 0;
}
1 change: 1 addition & 0 deletions doomsday/tests/tests.pro
Expand Up @@ -7,6 +7,7 @@ TEMPLATE = subdirs

deng_tests: SUBDIRS += \
archive \
log \
record \
script \
stringpool \
Expand Down

0 comments on commit 3540ff4

Please sign in to comment.