diff --git a/.appveyor.yml b/.appveyor.yml index a4f9e12..da83ffc 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -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 diff --git a/.gitignore b/.gitignore index 459eed4..c7a1511 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /build /dist /node_modules +*.autosave *.gcno *.gcda *.info diff --git a/.travis.yml b/.travis.yml index b8e042b..4443688 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bcc3d8..17548a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/cmake/QtPromiseAddTest.cmake b/cmake/QtPromiseAddTest.cmake new file mode 100644 index 0000000..737e984 --- /dev/null +++ b/cmake/QtPromiseAddTest.cmake @@ -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() diff --git a/qtpromise.pro b/qtpromise.pro deleted file mode 100644 index 2475104..0000000 --- a/qtpromise.pro +++ /dev/null @@ -1,12 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = \ - tests - -_qt_creator_ { - SUBDIRS += src -} - -OTHER_FILES = \ - package/features/*.prf \ - include/* \ - qtpromise.pri diff --git a/src/qtpromise/qtpromise.pri b/src/qtpromise/qtpromise.pri deleted file mode 100644 index 8ed377f..0000000 --- a/src/qtpromise/qtpromise.pri +++ /dev/null @@ -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 diff --git a/src/qtpromise/qtpromise.pro b/src/qtpromise/qtpromise.pro deleted file mode 100644 index 71afe76..0000000 --- a/src/qtpromise/qtpromise.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE = lib -CONFIG += c++11 qt thread warn_on -DEFINES += QT_DEPRECATED_WARNINGS - -include(qtpromise.pri) diff --git a/src/src.pro b/src/src.pro deleted file mode 100644 index 720a606..0000000 --- a/src/src.pro +++ /dev/null @@ -1,2 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = qtpromise diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..a6911a5 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,9 @@ +find_package(Qt5 5.6.0 REQUIRED + COMPONENTS + Concurrent + Test +) + +include(QtPromiseAddTest) + +add_subdirectory(auto) diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt new file mode 100644 index 0000000..b7c2b39 --- /dev/null +++ b/tests/auto/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(qtpromise) diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro deleted file mode 100644 index bfff61e..0000000 --- a/tests/auto/auto.pro +++ /dev/null @@ -1,2 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += qtpromise diff --git a/tests/auto/qtpromise/CMakeLists.txt b/tests/auto/qtpromise/CMakeLists.txt new file mode 100644 index 0000000..bef7671 --- /dev/null +++ b/tests/auto/qtpromise/CMakeLists.txt @@ -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) diff --git a/tests/auto/qtpromise/benchmark/CMakeLists.txt b/tests/auto/qtpromise/benchmark/CMakeLists.txt new file mode 100644 index 0000000..b172e0c --- /dev/null +++ b/tests/auto/qtpromise/benchmark/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(benchmark + SOURCES + tst_benchmark.cpp +) diff --git a/tests/auto/qtpromise/benchmark/benchmark.pro b/tests/auto/qtpromise/benchmark/benchmark.pro deleted file mode 100644 index 48df01f..0000000 --- a/tests/auto/qtpromise/benchmark/benchmark.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_benchmark -SOURCES += $$PWD/tst_benchmark.cpp - -include(../qtpromise.pri) diff --git a/tests/auto/qtpromise/deprecations/CMakeLists.txt b/tests/auto/qtpromise/deprecations/CMakeLists.txt new file mode 100644 index 0000000..095aebc --- /dev/null +++ b/tests/auto/qtpromise/deprecations/CMakeLists.txt @@ -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) diff --git a/tests/auto/qtpromise/deprecations/deprecations.pri b/tests/auto/qtpromise/deprecations/deprecations.pri deleted file mode 100644 index 671915f..0000000 --- a/tests/auto/qtpromise/deprecations/deprecations.pri +++ /dev/null @@ -1,5 +0,0 @@ -include(../qtpromise.pri) - -DEFINES -= QT_DEPRECATED_WARNINGS -gcc:QMAKE_CXXFLAGS += -Wno-deprecated-declarations -msvc:QMAKE_CXXFLAGS -= -wd4996 diff --git a/tests/auto/qtpromise/deprecations/deprecations.pro b/tests/auto/qtpromise/deprecations/deprecations.pro deleted file mode 100644 index 8c4a60e..0000000 --- a/tests/auto/qtpromise/deprecations/deprecations.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += \ - helpers diff --git a/tests/auto/qtpromise/deprecations/helpers/CMakeLists.txt b/tests/auto/qtpromise/deprecations/helpers/CMakeLists.txt new file mode 100644 index 0000000..ce53777 --- /dev/null +++ b/tests/auto/qtpromise/deprecations/helpers/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(qpromise) +add_subdirectory(qpromiseall) diff --git a/tests/auto/qtpromise/deprecations/helpers/helpers.pro b/tests/auto/qtpromise/deprecations/helpers/helpers.pro deleted file mode 100644 index 3014d7b..0000000 --- a/tests/auto/qtpromise/deprecations/helpers/helpers.pro +++ /dev/null @@ -1,4 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += \ - qpromise \ - qpromiseall diff --git a/tests/auto/qtpromise/deprecations/helpers/qpromise/CMakeLists.txt b/tests/auto/qtpromise/deprecations/helpers/qpromise/CMakeLists.txt new file mode 100644 index 0000000..144a480 --- /dev/null +++ b/tests/auto/qtpromise/deprecations/helpers/qpromise/CMakeLists.txt @@ -0,0 +1,6 @@ +qtpromise_add_test(deprecations.helpers.qpromise + SOURCES + tst_qpromise.cpp + LIBRARIES + Qt5::Concurrent +) diff --git a/tests/auto/qtpromise/deprecations/helpers/qpromise/qpromise.pro b/tests/auto/qtpromise/deprecations/helpers/qpromise/qpromise.pro deleted file mode 100644 index 33e0374..0000000 --- a/tests/auto/qtpromise/deprecations/helpers/qpromise/qpromise.pro +++ /dev/null @@ -1,5 +0,0 @@ -QT += concurrent -TARGET = tst_deprecations_helpers_qpromise -SOURCES += $$PWD/tst_qpromise.cpp - -include(../../deprecations.pri) diff --git a/tests/auto/qtpromise/deprecations/helpers/qpromiseall/CMakeLists.txt b/tests/auto/qtpromise/deprecations/helpers/qpromiseall/CMakeLists.txt new file mode 100644 index 0000000..5248863 --- /dev/null +++ b/tests/auto/qtpromise/deprecations/helpers/qpromiseall/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(deprecations.helpers.qpromiseall + SOURCES + tst_qpromiseall.cpp +) diff --git a/tests/auto/qtpromise/deprecations/helpers/qpromiseall/qpromiseall.pro b/tests/auto/qtpromise/deprecations/helpers/qpromiseall/qpromiseall.pro deleted file mode 100644 index b8b3c20..0000000 --- a/tests/auto/qtpromise/deprecations/helpers/qpromiseall/qpromiseall.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_deprecations_helpers_qpromiseall -SOURCES += $$PWD/tst_qpromiseall.cpp - -include(../../deprecations.pri) diff --git a/tests/auto/qtpromise/deprecations/qpromise/CMakeLists.txt b/tests/auto/qtpromise/deprecations/qpromise/CMakeLists.txt new file mode 100644 index 0000000..fd51d76 --- /dev/null +++ b/tests/auto/qtpromise/deprecations/qpromise/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(all) diff --git a/tests/auto/qtpromise/deprecations/qpromise/all/CMakeLists.txt b/tests/auto/qtpromise/deprecations/qpromise/all/CMakeLists.txt new file mode 100644 index 0000000..276f55f --- /dev/null +++ b/tests/auto/qtpromise/deprecations/qpromise/all/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(deprecations.qpromise.all + SOURCES + tst_all.cpp +) diff --git a/tests/auto/qtpromise/deprecations/qpromise/all/all.pro b/tests/auto/qtpromise/deprecations/qpromise/all/all.pro deleted file mode 100644 index d781188..0000000 --- a/tests/auto/qtpromise/deprecations/qpromise/all/all.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_deprecations_qpromise_all -SOURCES += $$PWD/tst_all.cpp - -include(../../deprecations.pri) diff --git a/tests/auto/qtpromise/deprecations/qpromise/all/tst_all.cpp b/tests/auto/qtpromise/deprecations/qpromise/all/tst_all.cpp index 083612f..784352e 100644 --- a/tests/auto/qtpromise/deprecations/qpromise/all/tst_all.cpp +++ b/tests/auto/qtpromise/deprecations/qpromise/all/tst_all.cpp @@ -104,7 +104,7 @@ struct SequenceTester, Args...>> void tst_deprecations_qpromise_all::emptySequence() { - auto p = QPromise::all({}); + auto p = QPromise::all(QVector>{}); Q_STATIC_ASSERT((std::is_same>>::value)); @@ -114,7 +114,7 @@ void tst_deprecations_qpromise_all::emptySequence() void tst_deprecations_qpromise_all::emptySequence_void() { - auto p = QPromise::all({}); + auto p = QPromise::all(QVector>{}); Q_STATIC_ASSERT((std::is_same>::value)); @@ -132,7 +132,7 @@ void tst_deprecations_qpromise_all::allPromisesSucceed() }); }); - auto p = QPromise::all({p0, p2, p1}); + auto p = QPromise::all(QVector>{p0, p2, p1}); Q_STATIC_ASSERT((std::is_same>>::value)); @@ -154,7 +154,7 @@ void tst_deprecations_qpromise_all::allPromisesSucceed_void() }); }); - auto p = QPromise::all({p0, p2, p1}); + auto p = QPromise::all(QVector>{p0, p2, p1}); Q_STATIC_ASSERT((std::is_same>::value)); @@ -176,7 +176,7 @@ void tst_deprecations_qpromise_all::atLeastOnePromiseReject() }); }); - auto p = QPromise::all({p0, p2, p1}); + auto p = QPromise::all(QVector>{p0, p2, p1}); Q_STATIC_ASSERT((std::is_same>>::value)); @@ -198,7 +198,7 @@ void tst_deprecations_qpromise_all::atLeastOnePromiseReject_void() }); }); - auto p = QPromise::all({p0, p2, p1}); + auto p = QPromise::all(QVector>{p0, p2, p1}); Q_STATIC_ASSERT((std::is_same>::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::all({p0, p1, p2}); + auto p = QPromise::all(QVector>{p0, p1, p2}); Q_STATIC_ASSERT((std::is_same>>::value)); diff --git a/tests/auto/qtpromise/deprecations/qpromise/qpromise.pro b/tests/auto/qtpromise/deprecations/qpromise/qpromise.pro deleted file mode 100644 index 17d24f9..0000000 --- a/tests/auto/qtpromise/deprecations/qpromise/qpromise.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += \ - all diff --git a/tests/auto/qtpromise/exceptions/CMakeLists.txt b/tests/auto/qtpromise/exceptions/CMakeLists.txt new file mode 100644 index 0000000..47eb69d --- /dev/null +++ b/tests/auto/qtpromise/exceptions/CMakeLists.txt @@ -0,0 +1,6 @@ +qtpromise_add_test(exceptions + SOURCES + tst_exceptions.cpp + LIBRARIES + Qt5::Concurrent +) diff --git a/tests/auto/qtpromise/exceptions/exceptions.pro b/tests/auto/qtpromise/exceptions/exceptions.pro deleted file mode 100644 index 47c54b2..0000000 --- a/tests/auto/qtpromise/exceptions/exceptions.pro +++ /dev/null @@ -1,5 +0,0 @@ -QT += concurrent -TARGET = tst_exceptions -SOURCES += $$PWD/tst_exceptions.cpp - -include(../qtpromise.pri) diff --git a/tests/auto/qtpromise/future/CMakeLists.txt b/tests/auto/qtpromise/future/CMakeLists.txt new file mode 100644 index 0000000..861b9e5 --- /dev/null +++ b/tests/auto/qtpromise/future/CMakeLists.txt @@ -0,0 +1,6 @@ +qtpromise_add_test(future + SOURCES + tst_future.cpp + LIBRARIES + Qt5::Concurrent +) diff --git a/tests/auto/qtpromise/future/future.pro b/tests/auto/qtpromise/future/future.pro deleted file mode 100644 index 8857945..0000000 --- a/tests/auto/qtpromise/future/future.pro +++ /dev/null @@ -1,5 +0,0 @@ -QT += concurrent -TARGET = tst_future -SOURCES += $$PWD/tst_future.cpp - -include(../qtpromise.pri) diff --git a/tests/auto/qtpromise/helpers/CMakeLists.txt b/tests/auto/qtpromise/helpers/CMakeLists.txt new file mode 100644 index 0000000..0c91913 --- /dev/null +++ b/tests/auto/qtpromise/helpers/CMakeLists.txt @@ -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) diff --git a/tests/auto/qtpromise/helpers/all/CMakeLists.txt b/tests/auto/qtpromise/helpers/all/CMakeLists.txt new file mode 100644 index 0000000..47fc9bb --- /dev/null +++ b/tests/auto/qtpromise/helpers/all/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(helpers.all + SOURCES + tst_all.cpp +) diff --git a/tests/auto/qtpromise/helpers/all/all.pro b/tests/auto/qtpromise/helpers/all/all.pro deleted file mode 100644 index f098dfe..0000000 --- a/tests/auto/qtpromise/helpers/all/all.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_helpers_all -SOURCES += $$PWD/tst_all.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/helpers/attempt/CMakeLists.txt b/tests/auto/qtpromise/helpers/attempt/CMakeLists.txt new file mode 100644 index 0000000..61b27ac --- /dev/null +++ b/tests/auto/qtpromise/helpers/attempt/CMakeLists.txt @@ -0,0 +1,6 @@ +qtpromise_add_test(helpers.attempt + SOURCES + tst_attempt.cpp + LIBRARIES + Qt5::Concurrent +) diff --git a/tests/auto/qtpromise/helpers/attempt/attempt.pro b/tests/auto/qtpromise/helpers/attempt/attempt.pro deleted file mode 100644 index b7c9ac8..0000000 --- a/tests/auto/qtpromise/helpers/attempt/attempt.pro +++ /dev/null @@ -1,5 +0,0 @@ -QT += concurrent -TARGET = tst_helpers_attempt -SOURCES += $$PWD/tst_attempt.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/helpers/connect/CMakeLists.txt b/tests/auto/qtpromise/helpers/connect/CMakeLists.txt new file mode 100644 index 0000000..b87bed3 --- /dev/null +++ b/tests/auto/qtpromise/helpers/connect/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(helpers.connect + SOURCES + tst_connect.cpp +) diff --git a/tests/auto/qtpromise/helpers/connect/connect.pro b/tests/auto/qtpromise/helpers/connect/connect.pro deleted file mode 100644 index 74bae78..0000000 --- a/tests/auto/qtpromise/helpers/connect/connect.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_helpers_connect -SOURCES += $$PWD/tst_connect.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/helpers/each/CMakeLists.txt b/tests/auto/qtpromise/helpers/each/CMakeLists.txt new file mode 100644 index 0000000..07f87e1 --- /dev/null +++ b/tests/auto/qtpromise/helpers/each/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(helpers.each + SOURCES + tst_each.cpp +) diff --git a/tests/auto/qtpromise/helpers/each/each.pro b/tests/auto/qtpromise/helpers/each/each.pro deleted file mode 100644 index f823d0e..0000000 --- a/tests/auto/qtpromise/helpers/each/each.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_qpromise_each -SOURCES += $$PWD/tst_each.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/helpers/filter/CMakeLists.txt b/tests/auto/qtpromise/helpers/filter/CMakeLists.txt new file mode 100644 index 0000000..bdf7f5b --- /dev/null +++ b/tests/auto/qtpromise/helpers/filter/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(helpers.filter + SOURCES + tst_filter.cpp +) diff --git a/tests/auto/qtpromise/helpers/filter/filter.pro b/tests/auto/qtpromise/helpers/filter/filter.pro deleted file mode 100644 index e006799..0000000 --- a/tests/auto/qtpromise/helpers/filter/filter.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_helpers_filter -SOURCES += $$PWD/tst_filter.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/helpers/helpers.pro b/tests/auto/qtpromise/helpers/helpers.pro deleted file mode 100644 index 7c46dd7..0000000 --- a/tests/auto/qtpromise/helpers/helpers.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += \ - all \ - attempt \ - connect \ - each \ - filter \ - map \ - reduce \ - reject \ - resolve diff --git a/tests/auto/qtpromise/helpers/map/CMakeLists.txt b/tests/auto/qtpromise/helpers/map/CMakeLists.txt new file mode 100644 index 0000000..11450e3 --- /dev/null +++ b/tests/auto/qtpromise/helpers/map/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(helpers.map + SOURCES + tst_map.cpp +) diff --git a/tests/auto/qtpromise/helpers/map/map.pro b/tests/auto/qtpromise/helpers/map/map.pro deleted file mode 100644 index 839ccf9..0000000 --- a/tests/auto/qtpromise/helpers/map/map.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_helpers_map -SOURCES += $$PWD/tst_map.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/helpers/reduce/CMakeLists.txt b/tests/auto/qtpromise/helpers/reduce/CMakeLists.txt new file mode 100644 index 0000000..9e635e1 --- /dev/null +++ b/tests/auto/qtpromise/helpers/reduce/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(helpers.reduce + SOURCES + tst_reduce.cpp +) diff --git a/tests/auto/qtpromise/helpers/reduce/reduce.pro b/tests/auto/qtpromise/helpers/reduce/reduce.pro deleted file mode 100644 index ac34f12..0000000 --- a/tests/auto/qtpromise/helpers/reduce/reduce.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_helpers_reduce -SOURCES += $$PWD/tst_reduce.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/helpers/reject/CMakeLists.txt b/tests/auto/qtpromise/helpers/reject/CMakeLists.txt new file mode 100644 index 0000000..5df28dc --- /dev/null +++ b/tests/auto/qtpromise/helpers/reject/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(helpers.reject + SOURCES + tst_reject.cpp +) diff --git a/tests/auto/qtpromise/helpers/reject/reject.pro b/tests/auto/qtpromise/helpers/reject/reject.pro deleted file mode 100644 index 59e0f35..0000000 --- a/tests/auto/qtpromise/helpers/reject/reject.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_helpers_reject -SOURCES += $$PWD/tst_reject.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/helpers/resolve/CMakeLists.txt b/tests/auto/qtpromise/helpers/resolve/CMakeLists.txt new file mode 100644 index 0000000..582b86b --- /dev/null +++ b/tests/auto/qtpromise/helpers/resolve/CMakeLists.txt @@ -0,0 +1,6 @@ +qtpromise_add_test(helpers.resolve + SOURCES + tst_resolve.cpp + LIBRARIES + Qt5::Concurrent +) diff --git a/tests/auto/qtpromise/helpers/resolve/resolve.pro b/tests/auto/qtpromise/helpers/resolve/resolve.pro deleted file mode 100644 index dc32edd..0000000 --- a/tests/auto/qtpromise/helpers/resolve/resolve.pro +++ /dev/null @@ -1,5 +0,0 @@ -QT += concurrent -TARGET = tst_helpers_resolve -SOURCES += $$PWD/tst_resolve.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/qpromise/CMakeLists.txt b/tests/auto/qtpromise/qpromise/CMakeLists.txt new file mode 100644 index 0000000..6a8779a --- /dev/null +++ b/tests/auto/qtpromise/qpromise/CMakeLists.txt @@ -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) diff --git a/tests/auto/qtpromise/qpromise/construct/CMakeLists.txt b/tests/auto/qtpromise/qpromise/construct/CMakeLists.txt new file mode 100644 index 0000000..7f0e105 --- /dev/null +++ b/tests/auto/qtpromise/qpromise/construct/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(qpromise.construct + SOURCES + tst_construct.cpp +) diff --git a/tests/auto/qtpromise/qpromise/construct/construct.pro b/tests/auto/qtpromise/qpromise/construct/construct.pro deleted file mode 100644 index 83b8095..0000000 --- a/tests/auto/qtpromise/qpromise/construct/construct.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_qpromise_construct -SOURCES += $$PWD/tst_construct.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/qpromise/delay/CMakeLists.txt b/tests/auto/qtpromise/qpromise/delay/CMakeLists.txt new file mode 100644 index 0000000..bb4a3fa --- /dev/null +++ b/tests/auto/qtpromise/qpromise/delay/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(qpromise.delay + SOURCES + tst_delay.cpp +) diff --git a/tests/auto/qtpromise/qpromise/delay/delay.pro b/tests/auto/qtpromise/qpromise/delay/delay.pro deleted file mode 100644 index bc905c8..0000000 --- a/tests/auto/qtpromise/qpromise/delay/delay.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_qpromise_delay -SOURCES += $$PWD/tst_delay.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/qpromise/delay/tst_delay.cpp b/tests/auto/qtpromise/qpromise/delay/tst_delay.cpp index 2b2fd82..92d38ac 100644 --- a/tests/auto/qtpromise/qpromise/delay/tst_delay.cpp +++ b/tests/auto/qtpromise/qpromise/delay/tst_delay.cpp @@ -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(1000 * 0.94)); + QVERIFY(elapsed <= static_cast(1000 * 1.06)); } void tst_qpromise_delay::rejected() diff --git a/tests/auto/qtpromise/qpromise/each/CMakeLists.txt b/tests/auto/qtpromise/qpromise/each/CMakeLists.txt new file mode 100644 index 0000000..3e7468f --- /dev/null +++ b/tests/auto/qtpromise/qpromise/each/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(qpromise.each + SOURCES + tst_each.cpp +) diff --git a/tests/auto/qtpromise/qpromise/each/each.pro b/tests/auto/qtpromise/qpromise/each/each.pro deleted file mode 100644 index f823d0e..0000000 --- a/tests/auto/qtpromise/qpromise/each/each.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_qpromise_each -SOURCES += $$PWD/tst_each.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/qpromise/fail/CMakeLists.txt b/tests/auto/qtpromise/qpromise/fail/CMakeLists.txt new file mode 100644 index 0000000..28b885a --- /dev/null +++ b/tests/auto/qtpromise/qpromise/fail/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(qpromise.fail + SOURCES + tst_fail.cpp +) diff --git a/tests/auto/qtpromise/qpromise/fail/fail.pro b/tests/auto/qtpromise/qpromise/fail/fail.pro deleted file mode 100644 index db8fea3..0000000 --- a/tests/auto/qtpromise/qpromise/fail/fail.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_qpromise_fail -SOURCES += $$PWD/tst_fail.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/qpromise/filter/CMakeLists.txt b/tests/auto/qtpromise/qpromise/filter/CMakeLists.txt new file mode 100644 index 0000000..084ef1c --- /dev/null +++ b/tests/auto/qtpromise/qpromise/filter/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(qpromise.filter + SOURCES + tst_filter.cpp +) diff --git a/tests/auto/qtpromise/qpromise/filter/filter.pro b/tests/auto/qtpromise/qpromise/filter/filter.pro deleted file mode 100644 index 6d55b0f..0000000 --- a/tests/auto/qtpromise/qpromise/filter/filter.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_qpromise_filter -SOURCES += $$PWD/tst_filter.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/qpromise/finally/CMakeLists.txt b/tests/auto/qtpromise/qpromise/finally/CMakeLists.txt new file mode 100644 index 0000000..3d1e7b1 --- /dev/null +++ b/tests/auto/qtpromise/qpromise/finally/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(qpromise.finally + SOURCES + tst_finally.cpp +) diff --git a/tests/auto/qtpromise/qpromise/finally/finally.pro b/tests/auto/qtpromise/qpromise/finally/finally.pro deleted file mode 100644 index 6cd4893..0000000 --- a/tests/auto/qtpromise/qpromise/finally/finally.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_qpromise_finally -SOURCES += $$PWD/tst_finally.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/qpromise/map/CMakeLists.txt b/tests/auto/qtpromise/qpromise/map/CMakeLists.txt new file mode 100644 index 0000000..34bdc53 --- /dev/null +++ b/tests/auto/qtpromise/qpromise/map/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(qpromise.map + SOURCES + tst_map.cpp +) diff --git a/tests/auto/qtpromise/qpromise/map/map.pro b/tests/auto/qtpromise/qpromise/map/map.pro deleted file mode 100644 index 0e600ee..0000000 --- a/tests/auto/qtpromise/qpromise/map/map.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_qpromise_map -SOURCES += $$PWD/tst_map.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/qpromise/operators/CMakeLists.txt b/tests/auto/qtpromise/qpromise/operators/CMakeLists.txt new file mode 100644 index 0000000..401f4c0 --- /dev/null +++ b/tests/auto/qtpromise/qpromise/operators/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(qpromise.operators + SOURCES + tst_operators.cpp +) diff --git a/tests/auto/qtpromise/qpromise/operators/operators.pro b/tests/auto/qtpromise/qpromise/operators/operators.pro deleted file mode 100644 index 784bf08..0000000 --- a/tests/auto/qtpromise/qpromise/operators/operators.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_qpromise_operators -SOURCES += $$PWD/tst_operators.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/qpromise/qpromise.pro b/tests/auto/qtpromise/qpromise/qpromise.pro deleted file mode 100644 index aeff700..0000000 --- a/tests/auto/qtpromise/qpromise/qpromise.pro +++ /dev/null @@ -1,16 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += \ - construct \ - delay \ - each \ - fail \ - filter \ - finally \ - map \ - operators \ - reduce \ - resolve \ - tap \ - tapfail \ - then \ - timeout diff --git a/tests/auto/qtpromise/qpromise/reduce/CMakeLists.txt b/tests/auto/qtpromise/qpromise/reduce/CMakeLists.txt new file mode 100644 index 0000000..e26fd50 --- /dev/null +++ b/tests/auto/qtpromise/qpromise/reduce/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(qpromise.reduce + SOURCES + tst_reduce.cpp +) diff --git a/tests/auto/qtpromise/qpromise/reduce/reduce.pro b/tests/auto/qtpromise/qpromise/reduce/reduce.pro deleted file mode 100644 index 259eb95..0000000 --- a/tests/auto/qtpromise/qpromise/reduce/reduce.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_qpromise_reduce -SOURCES += $$PWD/tst_reduce.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/qpromise/resolve/CMakeLists.txt b/tests/auto/qtpromise/qpromise/resolve/CMakeLists.txt new file mode 100644 index 0000000..d3f43b7 --- /dev/null +++ b/tests/auto/qtpromise/qpromise/resolve/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(qpromise.resolve + SOURCES + tst_resolve.cpp +) diff --git a/tests/auto/qtpromise/qpromise/resolve/resolve.pro b/tests/auto/qtpromise/qpromise/resolve/resolve.pro deleted file mode 100644 index 26f9882..0000000 --- a/tests/auto/qtpromise/qpromise/resolve/resolve.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_qpromise_resolve -SOURCES += $$PWD/tst_resolve.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/qpromise/tap/CMakeLists.txt b/tests/auto/qtpromise/qpromise/tap/CMakeLists.txt new file mode 100644 index 0000000..509167e --- /dev/null +++ b/tests/auto/qtpromise/qpromise/tap/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(qpromise.tap + SOURCES + tst_tap.cpp +) diff --git a/tests/auto/qtpromise/qpromise/tap/tap.pro b/tests/auto/qtpromise/qpromise/tap/tap.pro deleted file mode 100644 index 71958f8..0000000 --- a/tests/auto/qtpromise/qpromise/tap/tap.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_qpromise_tap -SOURCES += $$PWD/tst_tap.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/qpromise/tapfail/CMakeLists.txt b/tests/auto/qtpromise/qpromise/tapfail/CMakeLists.txt new file mode 100644 index 0000000..d5a45b9 --- /dev/null +++ b/tests/auto/qtpromise/qpromise/tapfail/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(qpromise.tapfail + SOURCES + tst_tapfail.cpp +) diff --git a/tests/auto/qtpromise/qpromise/tapfail/tapfail.pro b/tests/auto/qtpromise/qpromise/tapfail/tapfail.pro deleted file mode 100644 index e5e31d7..0000000 --- a/tests/auto/qtpromise/qpromise/tapfail/tapfail.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_qpromise_tapfail -SOURCES += $$PWD/tst_tapfail.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/qpromise/then/CMakeLists.txt b/tests/auto/qtpromise/qpromise/then/CMakeLists.txt new file mode 100644 index 0000000..26d1331 --- /dev/null +++ b/tests/auto/qtpromise/qpromise/then/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(qpromise.then + SOURCES + tst_then.cpp +) diff --git a/tests/auto/qtpromise/qpromise/then/then.pro b/tests/auto/qtpromise/qpromise/then/then.pro deleted file mode 100644 index b82d33e..0000000 --- a/tests/auto/qtpromise/qpromise/then/then.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_qpromise_then -SOURCES += $$PWD/tst_then.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/qpromise/timeout/CMakeLists.txt b/tests/auto/qtpromise/qpromise/timeout/CMakeLists.txt new file mode 100644 index 0000000..4ea1258 --- /dev/null +++ b/tests/auto/qtpromise/qpromise/timeout/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(qpromise.timeout + SOURCES + tst_timeout.cpp +) diff --git a/tests/auto/qtpromise/qpromise/timeout/timeout.pro b/tests/auto/qtpromise/qpromise/timeout/timeout.pro deleted file mode 100644 index c3ce03a..0000000 --- a/tests/auto/qtpromise/qpromise/timeout/timeout.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_qpromise_timeout -SOURCES += $$PWD/tst_timeout.cpp - -include(../../qtpromise.pri) diff --git a/tests/auto/qtpromise/qpromise/timeout/tst_timeout.cpp b/tests/auto/qtpromise/qpromise/timeout/tst_timeout.cpp index 50333d3..0868ef9 100644 --- a/tests/auto/qtpromise/qpromise/timeout/tst_timeout.cpp +++ b/tests/auto/qtpromise/qpromise/timeout/tst_timeout.cpp @@ -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(2000 * 0.94)); + QVERIFY(elapsed <= static_cast(2000 * 1.06)); } diff --git a/tests/auto/qtpromise/qpromiseconnections/CMakeLists.txt b/tests/auto/qtpromise/qpromiseconnections/CMakeLists.txt new file mode 100644 index 0000000..61232ce --- /dev/null +++ b/tests/auto/qtpromise/qpromiseconnections/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(qpromiseconnections + SOURCES + tst_qpromiseconnections.cpp +) diff --git a/tests/auto/qtpromise/qpromiseconnections/qpromiseconnections.pro b/tests/auto/qtpromise/qpromiseconnections/qpromiseconnections.pro deleted file mode 100644 index 99f5e72..0000000 --- a/tests/auto/qtpromise/qpromiseconnections/qpromiseconnections.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_qpromiseconnections -SOURCES += $$PWD/tst_qpromiseconnections.cpp - -include(../qtpromise.pri) diff --git a/tests/auto/qtpromise/qtpromise.pri b/tests/auto/qtpromise/qtpromise.pri deleted file mode 100644 index 7ab29e6..0000000 --- a/tests/auto/qtpromise/qtpromise.pri +++ /dev/null @@ -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) diff --git a/tests/auto/qtpromise/qtpromise.pro b/tests/auto/qtpromise/qtpromise.pro deleted file mode 100644 index 8aafbf6..0000000 --- a/tests/auto/qtpromise/qtpromise.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += \ - benchmark \ - deprecations \ - exceptions \ - future \ - helpers \ - qpromise \ - qpromiseconnections \ - requirements \ - thread diff --git a/tests/auto/qtpromise/requirements/CMakeLists.txt b/tests/auto/qtpromise/requirements/CMakeLists.txt new file mode 100644 index 0000000..8f7c353 --- /dev/null +++ b/tests/auto/qtpromise/requirements/CMakeLists.txt @@ -0,0 +1,4 @@ +qtpromise_add_test(requirements + SOURCES + tst_requirements.cpp +) diff --git a/tests/auto/qtpromise/requirements/requirements.pro b/tests/auto/qtpromise/requirements/requirements.pro deleted file mode 100644 index da66aa5..0000000 --- a/tests/auto/qtpromise/requirements/requirements.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_requirements -SOURCES += $$PWD/tst_requirements.cpp - -include(../qtpromise.pri) diff --git a/tests/auto/qtpromise/shared/CMakeLists.txt b/tests/auto/qtpromise/shared/CMakeLists.txt new file mode 100644 index 0000000..7e77c7e --- /dev/null +++ b/tests/auto/qtpromise/shared/CMakeLists.txt @@ -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 +) diff --git a/tests/auto/qtpromise/thread/CMakeLists.txt b/tests/auto/qtpromise/thread/CMakeLists.txt new file mode 100644 index 0000000..b786cd1 --- /dev/null +++ b/tests/auto/qtpromise/thread/CMakeLists.txt @@ -0,0 +1,6 @@ +qtpromise_add_test(thread + SOURCES + tst_thread.cpp + LIBRARIES + Qt5::Concurrent +) diff --git a/tests/auto/qtpromise/thread/thread.pro b/tests/auto/qtpromise/thread/thread.pro deleted file mode 100644 index 056a457..0000000 --- a/tests/auto/qtpromise/thread/thread.pro +++ /dev/null @@ -1,5 +0,0 @@ -QT += concurrent -TARGET = tst_thread -SOURCES += $$PWD/tst_thread.cpp - -include(../qtpromise.pri) diff --git a/tests/tests.pro b/tests/tests.pro deleted file mode 100644 index 157ef34..0000000 --- a/tests/tests.pro +++ /dev/null @@ -1,2 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += auto