mirror of
https://github.com/simonbrunel/qtpromise.git
synced 2024-10-30 07:47:38 +08:00
Migrate to CMake to build the entire project
This commit is contained in:
parent
7f9013a878
commit
6639ea52db
@ -19,9 +19,9 @@ environment:
|
||||
ARCH: x64
|
||||
|
||||
build_script:
|
||||
- cmd: qmake qtpromise.pro
|
||||
- cmd: nmake
|
||||
- cmd: cmake -G "NMake Makefiles"
|
||||
- cmd: cmake --build .
|
||||
|
||||
test_script:
|
||||
- cmd: nmake check
|
||||
- cmd: cmake --build . --target test
|
||||
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
||||
/build
|
||||
/dist
|
||||
/node_modules
|
||||
*.autosave
|
||||
*.gcno
|
||||
*.gcda
|
||||
*.info
|
||||
|
@ -22,14 +22,15 @@ install:
|
||||
- cd ..
|
||||
|
||||
before_script:
|
||||
- cmake --version
|
||||
- qmake --version
|
||||
- lcov --version && gcov --version
|
||||
- gcc --version && g++ --version
|
||||
- lcov --version && gcov --version
|
||||
|
||||
script:
|
||||
- qmake qtpromise.pro CONFIG+=coverage
|
||||
- make -j4
|
||||
- make check --quiet
|
||||
- cmake -G "Unix Makefiles"
|
||||
- cmake --build . -- -j12
|
||||
- cmake --build . --target test
|
||||
- lcov -capture --directory . --o coverage.info
|
||||
- lcov -e coverage.info '**/src/**/*' -o coverage.info
|
||||
|
||||
|
@ -1,15 +1,52 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
if(DEFINED PROJECT_NAME)
|
||||
set(SUBPROJECT ON)
|
||||
endif()
|
||||
|
||||
project(qtpromise VERSION 0.5.0 LANGUAGES CXX)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||
|
||||
find_package(Qt5 5.6.0 REQUIRED COMPONENTS Core)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED on)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
add_library(qtpromise INTERFACE)
|
||||
add_library(qtpromise::qtpromise ALIAS qtpromise)
|
||||
|
||||
target_link_libraries(qtpromise INTERFACE Qt5::Core)
|
||||
|
||||
target_include_directories(qtpromise INTERFACE "${CMAKE_CURRENT_LIST_DIR}/include")
|
||||
|
||||
add_definitions(
|
||||
-DQT_DEPRECATED_WARNINGS
|
||||
-DQT_NO_KEYWORDS
|
||||
)
|
||||
|
||||
# https://github.com/simonbrunel/qtpromise/issues/10
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
# https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
|
||||
add_compile_options(
|
||||
-Werror
|
||||
-Wpedantic
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wconversion
|
||||
-Wsign-conversion
|
||||
-Wold-style-cast
|
||||
-Wunused-local-typedefs
|
||||
-pedantic-errors
|
||||
)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
# https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level
|
||||
add_compile_options(
|
||||
/WX
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT SUBPROJECT)
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
30
cmake/QtPromiseAddTest.cmake
Normal file
30
cmake/QtPromiseAddTest.cmake
Normal file
@ -0,0 +1,30 @@
|
||||
function(qtpromise_add_test NAME)
|
||||
cmake_parse_arguments(_ARG "" "" "SOURCES;LIBRARIES" ${ARGN})
|
||||
|
||||
set(_TARGET qtpromise.tests.auto.${NAME})
|
||||
|
||||
add_executable(${_TARGET} ${_ARG_SOURCES})
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
target_link_libraries(${_TARGET} gcov)
|
||||
target_compile_options(${_TARGET}
|
||||
PRIVATE
|
||||
-fprofile-arcs
|
||||
-ftest-coverage
|
||||
-O0
|
||||
-g
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${_TARGET}
|
||||
Qt5::Test
|
||||
qtpromise
|
||||
qtpromise.tests.utils
|
||||
${_ARG_LIBRARIES}
|
||||
)
|
||||
|
||||
add_test(NAME ${_TARGET}
|
||||
COMMAND ${_TARGET}
|
||||
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
||||
)
|
||||
endfunction()
|
@ -1,12 +0,0 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS = \
|
||||
tests
|
||||
|
||||
_qt_creator_ {
|
||||
SUBDIRS += src
|
||||
}
|
||||
|
||||
OTHER_FILES = \
|
||||
package/features/*.prf \
|
||||
include/* \
|
||||
qtpromise.pri
|
@ -1,11 +0,0 @@
|
||||
HEADERS += \
|
||||
$$PWD/qpromise.h \
|
||||
$$PWD/qpromise.inl \
|
||||
$$PWD/qpromise_p.h \
|
||||
$$PWD/qpromiseconnections.h \
|
||||
$$PWD/qpromiseexceptions.h \
|
||||
$$PWD/qpromisefuture.h \
|
||||
$$PWD/qpromiseglobal.h \
|
||||
$$PWD/qpromisehelpers.h \
|
||||
$$PWD/qpromisehelpers_p.h \
|
||||
$$PWD/qpromiseresolver.h
|
@ -1,5 +0,0 @@
|
||||
TEMPLATE = lib
|
||||
CONFIG += c++11 qt thread warn_on
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
include(qtpromise.pri)
|
@ -1,2 +0,0 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS = qtpromise
|
9
tests/CMakeLists.txt
Normal file
9
tests/CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
||||
find_package(Qt5 5.6.0 REQUIRED
|
||||
COMPONENTS
|
||||
Concurrent
|
||||
Test
|
||||
)
|
||||
|
||||
include(QtPromiseAddTest)
|
||||
|
||||
add_subdirectory(auto)
|
1
tests/auto/CMakeLists.txt
Normal file
1
tests/auto/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
add_subdirectory(qtpromise)
|
@ -1,2 +0,0 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS += qtpromise
|
11
tests/auto/qtpromise/CMakeLists.txt
Normal file
11
tests/auto/qtpromise/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
||||
add_subdirectory(shared)
|
||||
|
||||
add_subdirectory(benchmark)
|
||||
add_subdirectory(deprecations)
|
||||
add_subdirectory(exceptions)
|
||||
add_subdirectory(future)
|
||||
add_subdirectory(helpers)
|
||||
add_subdirectory(qpromise)
|
||||
add_subdirectory(qpromiseconnections)
|
||||
add_subdirectory(requirements)
|
||||
add_subdirectory(thread)
|
4
tests/auto/qtpromise/benchmark/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/benchmark/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(benchmark
|
||||
SOURCES
|
||||
tst_benchmark.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_benchmark
|
||||
SOURCES += $$PWD/tst_benchmark.cpp
|
||||
|
||||
include(../qtpromise.pri)
|
9
tests/auto/qtpromise/deprecations/CMakeLists.txt
Normal file
9
tests/auto/qtpromise/deprecations/CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
||||
# Disable deprecation warnings since we are testing deprecated features.
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
add_compile_options(-Wno-deprecated-declarations)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
add_compile_options(/wd4996)
|
||||
endif()
|
||||
|
||||
add_subdirectory(helpers)
|
||||
add_subdirectory(qpromise)
|
@ -1,5 +0,0 @@
|
||||
include(../qtpromise.pri)
|
||||
|
||||
DEFINES -= QT_DEPRECATED_WARNINGS
|
||||
gcc:QMAKE_CXXFLAGS += -Wno-deprecated-declarations
|
||||
msvc:QMAKE_CXXFLAGS -= -wd4996
|
@ -1,3 +0,0 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS += \
|
||||
helpers
|
2
tests/auto/qtpromise/deprecations/helpers/CMakeLists.txt
Normal file
2
tests/auto/qtpromise/deprecations/helpers/CMakeLists.txt
Normal file
@ -0,0 +1,2 @@
|
||||
add_subdirectory(qpromise)
|
||||
add_subdirectory(qpromiseall)
|
@ -1,4 +0,0 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS += \
|
||||
qpromise \
|
||||
qpromiseall
|
@ -0,0 +1,6 @@
|
||||
qtpromise_add_test(deprecations.helpers.qpromise
|
||||
SOURCES
|
||||
tst_qpromise.cpp
|
||||
LIBRARIES
|
||||
Qt5::Concurrent
|
||||
)
|
@ -1,5 +0,0 @@
|
||||
QT += concurrent
|
||||
TARGET = tst_deprecations_helpers_qpromise
|
||||
SOURCES += $$PWD/tst_qpromise.cpp
|
||||
|
||||
include(../../deprecations.pri)
|
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(deprecations.helpers.qpromiseall
|
||||
SOURCES
|
||||
tst_qpromiseall.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_deprecations_helpers_qpromiseall
|
||||
SOURCES += $$PWD/tst_qpromiseall.cpp
|
||||
|
||||
include(../../deprecations.pri)
|
@ -0,0 +1 @@
|
||||
add_subdirectory(all)
|
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(deprecations.qpromise.all
|
||||
SOURCES
|
||||
tst_all.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_deprecations_qpromise_all
|
||||
SOURCES += $$PWD/tst_all.cpp
|
||||
|
||||
include(../../deprecations.pri)
|
@ -104,7 +104,7 @@ struct SequenceTester<Sequence<QPromise<void>, Args...>>
|
||||
|
||||
void tst_deprecations_qpromise_all::emptySequence()
|
||||
{
|
||||
auto p = QPromise<int>::all({});
|
||||
auto p = QPromise<int>::all(QVector<QPromise<int>>{});
|
||||
|
||||
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<QVector<int>>>::value));
|
||||
|
||||
@ -114,7 +114,7 @@ void tst_deprecations_qpromise_all::emptySequence()
|
||||
|
||||
void tst_deprecations_qpromise_all::emptySequence_void()
|
||||
{
|
||||
auto p = QPromise<void>::all({});
|
||||
auto p = QPromise<void>::all(QVector<QPromise<void>>{});
|
||||
|
||||
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void>>::value));
|
||||
|
||||
@ -132,7 +132,7 @@ void tst_deprecations_qpromise_all::allPromisesSucceed()
|
||||
});
|
||||
});
|
||||
|
||||
auto p = QPromise<int>::all({p0, p2, p1});
|
||||
auto p = QPromise<int>::all(QVector<QPromise<int>>{p0, p2, p1});
|
||||
|
||||
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<QVector<int>>>::value));
|
||||
|
||||
@ -154,7 +154,7 @@ void tst_deprecations_qpromise_all::allPromisesSucceed_void()
|
||||
});
|
||||
});
|
||||
|
||||
auto p = QPromise<void>::all({p0, p2, p1});
|
||||
auto p = QPromise<void>::all(QVector<QPromise<void>>{p0, p2, p1});
|
||||
|
||||
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void>>::value));
|
||||
|
||||
@ -176,7 +176,7 @@ void tst_deprecations_qpromise_all::atLeastOnePromiseReject()
|
||||
});
|
||||
});
|
||||
|
||||
auto p = QPromise<int>::all({p0, p2, p1});
|
||||
auto p = QPromise<int>::all(QVector<QPromise<int>>{p0, p2, p1});
|
||||
|
||||
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<QVector<int>>>::value));
|
||||
|
||||
@ -198,7 +198,7 @@ void tst_deprecations_qpromise_all::atLeastOnePromiseReject_void()
|
||||
});
|
||||
});
|
||||
|
||||
auto p = QPromise<void>::all({p0, p2, p1});
|
||||
auto p = QPromise<void>::all(QVector<QPromise<void>>{p0, p2, p1});
|
||||
|
||||
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<void>>::value));
|
||||
|
||||
@ -216,7 +216,7 @@ void tst_deprecations_qpromise_all::preserveOrder()
|
||||
auto p1 = QtPromise::resolve(43).delay(100);
|
||||
auto p2 = QtPromise::resolve(44).delay(250);
|
||||
|
||||
auto p = QPromise<int>::all({p0, p1, p2});
|
||||
auto p = QPromise<int>::all(QVector<QPromise<int>>{p0, p1, p2});
|
||||
|
||||
Q_STATIC_ASSERT((std::is_same<decltype(p), QPromise<QVector<int>>>::value));
|
||||
|
||||
|
@ -1,3 +0,0 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS += \
|
||||
all
|
6
tests/auto/qtpromise/exceptions/CMakeLists.txt
Normal file
6
tests/auto/qtpromise/exceptions/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
qtpromise_add_test(exceptions
|
||||
SOURCES
|
||||
tst_exceptions.cpp
|
||||
LIBRARIES
|
||||
Qt5::Concurrent
|
||||
)
|
@ -1,5 +0,0 @@
|
||||
QT += concurrent
|
||||
TARGET = tst_exceptions
|
||||
SOURCES += $$PWD/tst_exceptions.cpp
|
||||
|
||||
include(../qtpromise.pri)
|
6
tests/auto/qtpromise/future/CMakeLists.txt
Normal file
6
tests/auto/qtpromise/future/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
qtpromise_add_test(future
|
||||
SOURCES
|
||||
tst_future.cpp
|
||||
LIBRARIES
|
||||
Qt5::Concurrent
|
||||
)
|
@ -1,5 +0,0 @@
|
||||
QT += concurrent
|
||||
TARGET = tst_future
|
||||
SOURCES += $$PWD/tst_future.cpp
|
||||
|
||||
include(../qtpromise.pri)
|
9
tests/auto/qtpromise/helpers/CMakeLists.txt
Normal file
9
tests/auto/qtpromise/helpers/CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
||||
add_subdirectory(all)
|
||||
add_subdirectory(attempt)
|
||||
add_subdirectory(connect)
|
||||
add_subdirectory(each)
|
||||
add_subdirectory(filter)
|
||||
add_subdirectory(map)
|
||||
add_subdirectory(reduce)
|
||||
add_subdirectory(reject)
|
||||
add_subdirectory(resolve)
|
4
tests/auto/qtpromise/helpers/all/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/helpers/all/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(helpers.all
|
||||
SOURCES
|
||||
tst_all.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_helpers_all
|
||||
SOURCES += $$PWD/tst_all.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
6
tests/auto/qtpromise/helpers/attempt/CMakeLists.txt
Normal file
6
tests/auto/qtpromise/helpers/attempt/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
qtpromise_add_test(helpers.attempt
|
||||
SOURCES
|
||||
tst_attempt.cpp
|
||||
LIBRARIES
|
||||
Qt5::Concurrent
|
||||
)
|
@ -1,5 +0,0 @@
|
||||
QT += concurrent
|
||||
TARGET = tst_helpers_attempt
|
||||
SOURCES += $$PWD/tst_attempt.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
4
tests/auto/qtpromise/helpers/connect/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/helpers/connect/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(helpers.connect
|
||||
SOURCES
|
||||
tst_connect.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_helpers_connect
|
||||
SOURCES += $$PWD/tst_connect.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
4
tests/auto/qtpromise/helpers/each/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/helpers/each/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(helpers.each
|
||||
SOURCES
|
||||
tst_each.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_qpromise_each
|
||||
SOURCES += $$PWD/tst_each.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
4
tests/auto/qtpromise/helpers/filter/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/helpers/filter/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(helpers.filter
|
||||
SOURCES
|
||||
tst_filter.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_helpers_filter
|
||||
SOURCES += $$PWD/tst_filter.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
@ -1,11 +0,0 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS += \
|
||||
all \
|
||||
attempt \
|
||||
connect \
|
||||
each \
|
||||
filter \
|
||||
map \
|
||||
reduce \
|
||||
reject \
|
||||
resolve
|
4
tests/auto/qtpromise/helpers/map/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/helpers/map/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(helpers.map
|
||||
SOURCES
|
||||
tst_map.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_helpers_map
|
||||
SOURCES += $$PWD/tst_map.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
4
tests/auto/qtpromise/helpers/reduce/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/helpers/reduce/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(helpers.reduce
|
||||
SOURCES
|
||||
tst_reduce.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_helpers_reduce
|
||||
SOURCES += $$PWD/tst_reduce.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
4
tests/auto/qtpromise/helpers/reject/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/helpers/reject/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(helpers.reject
|
||||
SOURCES
|
||||
tst_reject.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_helpers_reject
|
||||
SOURCES += $$PWD/tst_reject.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
6
tests/auto/qtpromise/helpers/resolve/CMakeLists.txt
Normal file
6
tests/auto/qtpromise/helpers/resolve/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
qtpromise_add_test(helpers.resolve
|
||||
SOURCES
|
||||
tst_resolve.cpp
|
||||
LIBRARIES
|
||||
Qt5::Concurrent
|
||||
)
|
@ -1,5 +0,0 @@
|
||||
QT += concurrent
|
||||
TARGET = tst_helpers_resolve
|
||||
SOURCES += $$PWD/tst_resolve.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
14
tests/auto/qtpromise/qpromise/CMakeLists.txt
Normal file
14
tests/auto/qtpromise/qpromise/CMakeLists.txt
Normal file
@ -0,0 +1,14 @@
|
||||
add_subdirectory(construct)
|
||||
add_subdirectory(delay)
|
||||
add_subdirectory(each)
|
||||
add_subdirectory(fail)
|
||||
add_subdirectory(filter)
|
||||
add_subdirectory(finally)
|
||||
add_subdirectory(map)
|
||||
add_subdirectory(operators)
|
||||
add_subdirectory(reduce)
|
||||
add_subdirectory(resolve)
|
||||
add_subdirectory(tap)
|
||||
add_subdirectory(tapfail)
|
||||
add_subdirectory(then)
|
||||
add_subdirectory(timeout)
|
4
tests/auto/qtpromise/qpromise/construct/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/qpromise/construct/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(qpromise.construct
|
||||
SOURCES
|
||||
tst_construct.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_qpromise_construct
|
||||
SOURCES += $$PWD/tst_construct.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
4
tests/auto/qtpromise/qpromise/delay/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/qpromise/delay/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(qpromise.delay
|
||||
SOURCES
|
||||
tst_delay.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_qpromise_delay
|
||||
SOURCES += $$PWD/tst_delay.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
@ -58,8 +58,8 @@ void tst_qpromise_delay::fulfilled()
|
||||
// Qt::CoarseTimer (default) Coarse timers try to
|
||||
// keep accuracy within 5% of the desired interval.
|
||||
// Require accuracy within 6% for passing the test.
|
||||
QVERIFY(elapsed >= 1000 * 0.94);
|
||||
QVERIFY(elapsed <= 1000 * 1.06);
|
||||
QVERIFY(elapsed >= static_cast<qint64>(1000 * 0.94));
|
||||
QVERIFY(elapsed <= static_cast<qint64>(1000 * 1.06));
|
||||
}
|
||||
|
||||
void tst_qpromise_delay::rejected()
|
||||
|
4
tests/auto/qtpromise/qpromise/each/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/qpromise/each/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(qpromise.each
|
||||
SOURCES
|
||||
tst_each.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_qpromise_each
|
||||
SOURCES += $$PWD/tst_each.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
4
tests/auto/qtpromise/qpromise/fail/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/qpromise/fail/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(qpromise.fail
|
||||
SOURCES
|
||||
tst_fail.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_qpromise_fail
|
||||
SOURCES += $$PWD/tst_fail.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
4
tests/auto/qtpromise/qpromise/filter/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/qpromise/filter/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(qpromise.filter
|
||||
SOURCES
|
||||
tst_filter.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_qpromise_filter
|
||||
SOURCES += $$PWD/tst_filter.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
4
tests/auto/qtpromise/qpromise/finally/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/qpromise/finally/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(qpromise.finally
|
||||
SOURCES
|
||||
tst_finally.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_qpromise_finally
|
||||
SOURCES += $$PWD/tst_finally.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
4
tests/auto/qtpromise/qpromise/map/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/qpromise/map/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(qpromise.map
|
||||
SOURCES
|
||||
tst_map.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_qpromise_map
|
||||
SOURCES += $$PWD/tst_map.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
4
tests/auto/qtpromise/qpromise/operators/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/qpromise/operators/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(qpromise.operators
|
||||
SOURCES
|
||||
tst_operators.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_qpromise_operators
|
||||
SOURCES += $$PWD/tst_operators.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
@ -1,16 +0,0 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS += \
|
||||
construct \
|
||||
delay \
|
||||
each \
|
||||
fail \
|
||||
filter \
|
||||
finally \
|
||||
map \
|
||||
operators \
|
||||
reduce \
|
||||
resolve \
|
||||
tap \
|
||||
tapfail \
|
||||
then \
|
||||
timeout
|
4
tests/auto/qtpromise/qpromise/reduce/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/qpromise/reduce/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(qpromise.reduce
|
||||
SOURCES
|
||||
tst_reduce.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_qpromise_reduce
|
||||
SOURCES += $$PWD/tst_reduce.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
4
tests/auto/qtpromise/qpromise/resolve/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/qpromise/resolve/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(qpromise.resolve
|
||||
SOURCES
|
||||
tst_resolve.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_qpromise_resolve
|
||||
SOURCES += $$PWD/tst_resolve.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
4
tests/auto/qtpromise/qpromise/tap/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/qpromise/tap/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(qpromise.tap
|
||||
SOURCES
|
||||
tst_tap.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_qpromise_tap
|
||||
SOURCES += $$PWD/tst_tap.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
4
tests/auto/qtpromise/qpromise/tapfail/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/qpromise/tapfail/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(qpromise.tapfail
|
||||
SOURCES
|
||||
tst_tapfail.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_qpromise_tapfail
|
||||
SOURCES += $$PWD/tst_tapfail.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
4
tests/auto/qtpromise/qpromise/then/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/qpromise/then/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(qpromise.then
|
||||
SOURCES
|
||||
tst_then.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_qpromise_then
|
||||
SOURCES += $$PWD/tst_then.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
4
tests/auto/qtpromise/qpromise/timeout/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/qpromise/timeout/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(qpromise.timeout
|
||||
SOURCES
|
||||
tst_timeout.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_qpromise_timeout
|
||||
SOURCES += $$PWD/tst_timeout.cpp
|
||||
|
||||
include(../../qtpromise.pri)
|
@ -111,6 +111,6 @@ void tst_qpromise_timeout::timeout()
|
||||
// Qt::CoarseTimer (default) Coarse timers try to
|
||||
// keep accuracy within 5% of the desired interval.
|
||||
// Require accuracy within 6% for passing the test.
|
||||
QVERIFY(elapsed >= 2000 * 0.94);
|
||||
QVERIFY(elapsed <= 2000 * 1.06);
|
||||
QVERIFY(elapsed >= static_cast<qint64>(2000 * 0.94));
|
||||
QVERIFY(elapsed <= static_cast<qint64>(2000 * 1.06));
|
||||
}
|
||||
|
4
tests/auto/qtpromise/qpromiseconnections/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/qpromiseconnections/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(qpromiseconnections
|
||||
SOURCES
|
||||
tst_qpromiseconnections.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_qpromiseconnections
|
||||
SOURCES += $$PWD/tst_qpromiseconnections.cpp
|
||||
|
||||
include(../qtpromise.pri)
|
@ -1,28 +0,0 @@
|
||||
TEMPLATE = app
|
||||
CONFIG += testcase warn_on
|
||||
QT += testlib
|
||||
QT -= gui
|
||||
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# Additional warnings and make all warnings into errors
|
||||
# https://github.com/simonbrunel/qtpromise/issues/10
|
||||
gcc:QMAKE_CXXFLAGS += -Werror -Wold-style-cast
|
||||
msvc:QMAKE_CXXFLAGS += -WX
|
||||
|
||||
coverage {
|
||||
gcc {
|
||||
message("Code coverage enabled (gcov)")
|
||||
QMAKE_CXXFLAGS += --coverage -O0 -g
|
||||
QMAKE_LFLAGS += --coverage -O0 -g
|
||||
} else {
|
||||
message("Code coverage only available when compiling with GCC")
|
||||
}
|
||||
}
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/shared/data.h \
|
||||
$$PWD/shared/object.h \
|
||||
$$PWD/shared/utils.h
|
||||
|
||||
include(../../../qtpromise.pri)
|
@ -1,11 +0,0 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS += \
|
||||
benchmark \
|
||||
deprecations \
|
||||
exceptions \
|
||||
future \
|
||||
helpers \
|
||||
qpromise \
|
||||
qpromiseconnections \
|
||||
requirements \
|
||||
thread
|
4
tests/auto/qtpromise/requirements/CMakeLists.txt
Normal file
4
tests/auto/qtpromise/requirements/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
qtpromise_add_test(requirements
|
||||
SOURCES
|
||||
tst_requirements.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
TARGET = tst_requirements
|
||||
SOURCES += $$PWD/tst_requirements.cpp
|
||||
|
||||
include(../qtpromise.pri)
|
12
tests/auto/qtpromise/shared/CMakeLists.txt
Normal file
12
tests/auto/qtpromise/shared/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
project(qtpromise.tests.utils)
|
||||
|
||||
add_library(${PROJECT_NAME} STATIC
|
||||
data.h
|
||||
object.h
|
||||
utils.h
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC
|
||||
Qt5::Core
|
||||
qtpromise
|
||||
)
|
6
tests/auto/qtpromise/thread/CMakeLists.txt
Normal file
6
tests/auto/qtpromise/thread/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
qtpromise_add_test(thread
|
||||
SOURCES
|
||||
tst_thread.cpp
|
||||
LIBRARIES
|
||||
Qt5::Concurrent
|
||||
)
|
@ -1,5 +0,0 @@
|
||||
QT += concurrent
|
||||
TARGET = tst_thread
|
||||
SOURCES += $$PWD/tst_thread.cpp
|
||||
|
||||
include(../qtpromise.pri)
|
@ -1,2 +0,0 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS += auto
|
Loading…
Reference in New Issue
Block a user