Add a testing framework
This commit is contained in:
@@ -434,6 +434,7 @@ ENDIF(WIN32)
|
||||
# make sub-directories
|
||||
ADD_SUBDIRECTORY(src)
|
||||
ADD_SUBDIRECTORY(plugins)
|
||||
ADD_SUBDIRECTORY(tests)
|
||||
ADD_SUBDIRECTORY(data)
|
||||
ADD_SUBDIRECTORY(doc)
|
||||
|
||||
|
||||
@@ -64,13 +64,17 @@ ENDIF()
|
||||
# Enable C++11
|
||||
ADD_DEFINITIONS("-std=c++0x")
|
||||
|
||||
ADD_EXECUTABLE(lmms
|
||||
ADD_LIBRARY(lmmslib STATIC
|
||||
${LMMS_SRCS}
|
||||
${LMMS_INCLUDES}
|
||||
${LMMS_UI_OUT}
|
||||
${LMMS_ER_H}
|
||||
)
|
||||
ADD_EXECUTABLE(lmms
|
||||
core/main.cpp
|
||||
"${WINRC}"
|
||||
)
|
||||
TARGET_LINK_LIBRARIES(lmms lmmslib)
|
||||
|
||||
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${LMMS_ER_H} ${LMMS_UI_OUT} lmmsconfig.h lmms.1.gz")
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ set(LMMS_SRCS
|
||||
core/LadspaControl.cpp
|
||||
core/LadspaManager.cpp
|
||||
core/LfoController.cpp
|
||||
core/main.cpp
|
||||
core/MemoryHelper.cpp
|
||||
core/MemoryManager.cpp
|
||||
core/MeterModel.cpp
|
||||
|
||||
15
tests/CMakeLists.txt
Normal file
15
tests/CMakeLists.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}")
|
||||
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/include")
|
||||
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11")
|
||||
|
||||
SET(CMAKE_AUTOMOC ON)
|
||||
|
||||
ADD_EXECUTABLE(tests
|
||||
EXCLUDE_FROM_ALL
|
||||
main.cpp
|
||||
QTestSuite
|
||||
)
|
||||
TARGET_LINK_LIBRARIES(tests ${QT_LIBRARIES} ${QT_QTTEST_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(tests lmmslib)
|
||||
19
tests/QTestSuite.cpp
Normal file
19
tests/QTestSuite.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "QTestSuite.h"
|
||||
|
||||
QList<QTestSuite*> QTestSuite::m_suites;
|
||||
|
||||
QTestSuite::QTestSuite(QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_suites << this;
|
||||
}
|
||||
|
||||
QTestSuite::~QTestSuite()
|
||||
{
|
||||
m_suites.removeAll(this);
|
||||
}
|
||||
|
||||
QList<QTestSuite*> QTestSuite::suites()
|
||||
{
|
||||
return m_suites;
|
||||
}
|
||||
|
||||
21
tests/QTestSuite.h
Normal file
21
tests/QTestSuite.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef QTESTSUITE_H
|
||||
#define QTESTSUITE_H
|
||||
|
||||
#include <QtTest/QTest>
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
|
||||
class QTestSuite : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QTestSuite(QObject *parent = 0);
|
||||
~QTestSuite();
|
||||
|
||||
static QList<QTestSuite*> suites();
|
||||
|
||||
private:
|
||||
static QList<QTestSuite*> m_suites;
|
||||
};
|
||||
|
||||
#endif // QTESTSUITE_H
|
||||
13
tests/main.cpp
Normal file
13
tests/main.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include "QTestSuite.h"
|
||||
|
||||
#include <QtTest/QTest>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
for (QTestSuite*& suite : QTestSuite::suites())
|
||||
{
|
||||
QTest::qExec(suite, argc, argv);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user