Added the test to CMakeLists.txt, all tests OK.
This commit is contained in:
parent
cb0ef0b130
commit
4c658d7811
12 changed files with 34 additions and 80 deletions
|
|
@ -59,6 +59,9 @@ include_directories( ${fmt_INCLUDE_DIRS} )
|
||||||
find_package(Boost 1.63 COMPONENTS system REQUIRED )
|
find_package(Boost 1.63 COMPONENTS system REQUIRED )
|
||||||
include_directories( ${Boost_INCLUDE_DIRS} )
|
include_directories( ${Boost_INCLUDE_DIRS} )
|
||||||
|
|
||||||
|
find_package(GTest REQUIRED)
|
||||||
|
|
||||||
|
|
||||||
add_library(core STATIC
|
add_library(core STATIC
|
||||||
core/BackupFormatModel.cpp
|
core/BackupFormatModel.cpp
|
||||||
core/CsvWriter.cpp
|
core/CsvWriter.cpp
|
||||||
|
|
@ -118,7 +121,7 @@ add_executable(pglab
|
||||||
pglab/resources.qrc
|
pglab/resources.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(pglab PUBLIC
|
target_include_directories(pglab PRIVATE
|
||||||
./core
|
./core
|
||||||
./pgsql
|
./pgsql
|
||||||
)
|
)
|
||||||
|
|
@ -132,3 +135,25 @@ target_link_libraries( pglab
|
||||||
${Botan_LIBRARIES}
|
${Botan_LIBRARIES}
|
||||||
pthread
|
pthread
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_executable(runtests
|
||||||
|
tests/main.cpp
|
||||||
|
tests/tst_CsvWriter.cpp
|
||||||
|
tests/tst_expected.cpp
|
||||||
|
tests/tst_PasswordManager.cpp
|
||||||
|
tests/tst_scopeguard.cpp
|
||||||
|
tests/tst_SqlLexer.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(runtests PRIVATE ./core ${GTEST_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(runtests
|
||||||
|
core
|
||||||
|
${GTEST_LIBRARIES}
|
||||||
|
${Botan_LIBRARIES}
|
||||||
|
Qt5::Widgets
|
||||||
|
pthread
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
add_test(tests runtests)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
TEMPLATE = subdirs
|
|
||||||
|
|
||||||
SUBDIRS += mycase
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
isEmpty(GOOGLETEST_DIR):GOOGLETEST_DIR=$$(GOOGLETEST_DIR)
|
|
||||||
|
|
||||||
isEmpty(GOOGLETEST_DIR) {
|
|
||||||
warning("Using googletest src dir specified at Qt Creator wizard")
|
|
||||||
message("set GOOGLETEST_DIR as environment variable or qmake variable to get rid of this message")
|
|
||||||
GOOGLETEST_DIR = C:/Prog/googletest
|
|
||||||
}
|
|
||||||
|
|
||||||
!isEmpty(GOOGLETEST_DIR): {
|
|
||||||
GTEST_SRCDIR = $$GOOGLETEST_DIR/googletest
|
|
||||||
GMOCK_SRCDIR = $$GOOGLETEST_DIR/googlemock
|
|
||||||
}
|
|
||||||
|
|
||||||
requires(exists($$GTEST_SRCDIR):exists($$GMOCK_SRCDIR))
|
|
||||||
|
|
||||||
!exists($$GOOGLETEST_DIR):message("No googletest src dir found - set GOOGLETEST_DIR to enable.")
|
|
||||||
|
|
||||||
DEFINES += \
|
|
||||||
GTEST_LANG_CXX11
|
|
||||||
|
|
||||||
INCLUDEPATH *= \
|
|
||||||
$$GTEST_SRCDIR \
|
|
||||||
$$GTEST_SRCDIR/include \
|
|
||||||
$$GMOCK_SRCDIR \
|
|
||||||
$$GMOCK_SRCDIR/include
|
|
||||||
|
|
||||||
SOURCES += \
|
|
||||||
$$GTEST_SRCDIR/src/gtest-all.cc \
|
|
||||||
$$GMOCK_SRCDIR/src/gmock-all.cc
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
#include "tst_CsvWriter.h"
|
|
||||||
#include "tst_expected.h"
|
|
||||||
#include "tst_PasswordManager.h"
|
|
||||||
#include "tst_scopeguard.h"
|
|
||||||
#include "tst_SqlLexer.h"
|
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
|
||||||
return RUN_ALL_TESTS();
|
|
||||||
}
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
include(../gtest_dependency.pri)
|
|
||||||
|
|
||||||
TEMPLATE = app
|
|
||||||
CONFIG += console c++11
|
|
||||||
CONFIG -= app_bundle
|
|
||||||
CONFIG += thread
|
|
||||||
CONFIG += qt
|
|
||||||
|
|
||||||
QT += core
|
|
||||||
|
|
||||||
HEADERS += \
|
|
||||||
tst_expected.h \
|
|
||||||
tst_SqlLexer.h \
|
|
||||||
tst_scopeguard.h \
|
|
||||||
tst_CsvWriter.h \
|
|
||||||
tst_PasswordManager.h
|
|
||||||
|
|
||||||
SOURCES += main.cpp
|
|
||||||
|
|
||||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../../../core/release/ -lcore
|
|
||||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../../../core/debug/ -lcore
|
|
||||||
|
|
||||||
INCLUDEPATH += C:\prog\include C:\VSproj\boost_1_63_0
|
|
||||||
INCLUDEPATH += $$PWD/../../../core
|
|
||||||
DEPENDPATH += $$PWD/../../../core
|
|
||||||
LIBS += c:\prog\lib\botand_imp.lib
|
|
||||||
|
|
||||||
win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../../../core/release/libcore.a
|
|
||||||
else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../../../core/debug/libcore.a
|
|
||||||
else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../../../core/release/core.lib
|
|
||||||
else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../../../core/debug/core.lib
|
|
||||||
8
tests/main.cpp
Normal file
8
tests/main.cpp
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
|
||||||
|
return RUN_ALL_TESTS();
|
||||||
|
}
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
TEMPLATE = subdirs
|
|
||||||
|
|
||||||
SUBDIRS += auto
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue