App for running tests for QmuParser library.

--HG--
branch : feature
This commit is contained in:
dismine 2014-05-22 11:08:12 +03:00
parent 2896d7feeb
commit 1bbee62a79
4 changed files with 149 additions and 7 deletions

View file

@ -48,7 +48,7 @@ SOURCES += \
tablewindow.cpp \
stable.cpp \
version.cpp \
options.cpp
options.cpp
HEADERS += \
mainwindow.h \

View file

@ -1,17 +1,16 @@
TEMPLATE = subdirs
#SUBDIRS = sub_lib sub_tests sub_app
SUBDIRS = \
sub_app \
sub_lib_qmuparser
sub_lib_qmuparser \
test/ParserTest
#sub_lib_qmuparser.subdir = libs/qmuparser
sub_lib_qmuparser.file = libs/qmuparser/qmuparser.pro
#sub_tests.file = tests/proj.pro
#sub_tests.depends = sub_lib
#sub_app.subdir = app
sub_parser_tests.file = test/ParserTest/ParserTest.pro
sub_parser_tests.depends = sub_lib_qmuparser
sub_app.file = app/app.pro
sub_app.depends = sub_lib_qmuparser
#This makes it possible to use make -j 4 on your fancy quad-core system with a project that consists of several
#components that depend on each other. To simplify the process a bit, the following test function can be defined:

View file

@ -0,0 +1,66 @@
#-------------------------------------------------
#
# Project created by QtCreator 2014-05-21T20:43:38
#
#-------------------------------------------------
QT += core
QT -= gui
TARGET = ParserTest
CONFIG += console c++11
CONFIG -= app_bundle debug_and_release debug_and_release_target
TEMPLATE = app
# directory for executable file
DESTDIR = bin
# objecs files
OBJECTS_DIR = obj
SOURCES += main.cpp
unix {
QMAKE_CXX = ccache g++
}
CONFIG(debug, debug|release){
# Debug
unix {
*-g++{
QMAKE_CXXFLAGS += -isystem "/usr/include/qt5" -isystem "/usr/include/qt5/QtCore" \
-O0 -Wall -Wextra -pedantic -Weffc++ -Woverloaded-virtual -Wctor-dtor-privacy \
-Wnon-virtual-dtor -Wold-style-cast -Wconversion -Winit-self -Wstack-protector \
-Wunreachable-code -Wcast-align -Wcast-qual -Wdisabled-optimization -Wfloat-equal \
-Wformat=2 -Wimport \
-Winvalid-pch -Wunsafe-loop-optimizations -Wlong-long -Wmissing-format-attribute \
-Wmissing-include-dirs -Wpacked -Wredundant-decls -Winline \
-Wswitch-default -Wswitch-enum -Wuninitialized -Wvariadic-macros \
-Wlogical-op -Wnoexcept -Wmissing-noreturn -Wpointer-arith\
-Wstrict-null-sentinel -Wstrict-overflow=5 -Wundef -Wno-unused -gdwarf-3 \
-ftrapv
}
} else {
*-g++{#Don't use additional GCC keys on Windows system.
QMAKE_CXXFLAGS += -O0 -Wall -Wextra -pedantic
}
}
}else{
# Release
*-g++{
QMAKE_CXXFLAGS += -O2
}
}
# Remove generated files at cleaning
QMAKE_DISTCLEAN += $${DESTDIR}/* \
$${OBJECTS_DIR}/*
win32:CONFIG(release, debug|release): LIBS += -L../../libs/qmuparser/bin -lqmuparser2
else:win32:CONFIG(debug, debug|release): LIBS += -L../../libs/qmuparser/bin -lqmuparser2
else:unix: LIBS += -L../../libs/qmuparser/bin -lqmuparser
INCLUDEPATH += ../../libs/qmuparser
DEPENDPATH += ../../libs/qmuparser

View file

@ -0,0 +1,77 @@
/************************************************************************
**
** @file main.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 21 5, 2014
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina 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 3 of the License, or
** (at your option) any later version.
**
** Valentina 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 Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include <QCoreApplication>
#include <QDebug>
#include <QtGlobal>
#include "../../libs/qmuparser/qmuparsertest.h"
using namespace qmu;
//---------------------------------------------------------------------------------------------------------------------
void testMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
QByteArray localMsg = msg.toLocal8Bit();
switch (type)
{
case QtDebugMsg:
fprintf(stderr, "%s\n", localMsg.constData());
break;
case QtWarningMsg:
fprintf(stderr, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line,
context.function);
break;
case QtCriticalMsg:
fprintf(stderr, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line,
context.function);
break;
case QtFatalMsg:
fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line,
context.function);
abort();
default:
break;
}
}
//---------------------------------------------------------------------------------------------------------------------
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
qInstallMessageHandler(testMessageOutput);
qDebug() << "-----------------------------------------------------------";
qDebug() << "Running test suite:\n";
qmu::Test::QmuParserTester pt;
pt.Run();
return a.exec();
}