mirror of
https://github.com/simonbrunel/qtpromise.git
synced 2024-11-21 18:24:29 +08:00
Simplify tests directory structure
This commit is contained in:
parent
1ad99391a3
commit
d5a82518f9
@ -17,6 +17,7 @@ function(qtpromise_add_test NAME)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${_TARGET}
|
||||
Qt5::Concurrent
|
||||
Qt5::Test
|
||||
qtpromise
|
||||
qtpromise.tests.utils
|
||||
@ -28,3 +29,16 @@ function(qtpromise_add_test NAME)
|
||||
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
||||
)
|
||||
endfunction()
|
||||
|
||||
function(qtpromise_add_tests GROUP)
|
||||
cmake_parse_arguments(_ARG "" "" "SOURCES" ${ARGN})
|
||||
|
||||
foreach(_FILE ${_ARG_SOURCES})
|
||||
get_filename_component(_FILE_NAME ${_FILE} NAME)
|
||||
if (_FILE_NAME MATCHES "^tst_(.+)\.cpp$")
|
||||
string(REGEX REPLACE "^tst_(.+)\.cpp$" "\\1" _TEST_NAME ${_FILE_NAME})
|
||||
qtpromise_add_test(${GROUP}.${_TEST_NAME} SOURCES ${_FILE} ${_ARG_UNPARSED_ARGUMENTS})
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
|
@ -5,5 +5,9 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
add_compile_options(/wd4996)
|
||||
endif()
|
||||
|
||||
add_subdirectory(helpers)
|
||||
add_subdirectory(qpromise)
|
||||
qtpromise_add_tests(deprecation
|
||||
SOURCES
|
||||
tst_helpers_qpromise.cpp
|
||||
tst_helpers_qpromiseall.cpp
|
||||
tst_qpromise_all.cpp
|
||||
)
|
||||
|
@ -1,2 +0,0 @@
|
||||
add_subdirectory(qpromise)
|
||||
add_subdirectory(qpromiseall)
|
@ -1,6 +0,0 @@
|
||||
qtpromise_add_test(deprecations.helpers.qpromise
|
||||
SOURCES
|
||||
tst_qpromise.cpp
|
||||
LIBRARIES
|
||||
Qt5::Concurrent
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(deprecations.helpers.qpromiseall
|
||||
SOURCES
|
||||
tst_qpromiseall.cpp
|
||||
)
|
@ -1 +0,0 @@
|
||||
add_subdirectory(all)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(deprecations.qpromise.all
|
||||
SOURCES
|
||||
tst_all.cpp
|
||||
)
|
@ -5,8 +5,8 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../../shared/data.h"
|
||||
#include "../../../shared/utils.h"
|
||||
#include "../shared/data.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
||||
@ -38,7 +38,7 @@ private Q_SLOTS:
|
||||
};
|
||||
|
||||
QTEST_MAIN(tst_deprecations_helpers_qpromise)
|
||||
#include "tst_qpromise.moc"
|
||||
#include "tst_helpers_qpromise.moc"
|
||||
|
||||
void tst_deprecations_helpers_qpromise::value()
|
||||
{
|
@ -5,7 +5,7 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../../shared/utils.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
||||
@ -32,7 +32,7 @@ private Q_SLOTS:
|
||||
};
|
||||
|
||||
QTEST_MAIN(tst_deprecations_helpers_qpromiseall)
|
||||
#include "tst_qpromiseall.moc"
|
||||
#include "tst_helpers_qpromiseall.moc"
|
||||
|
||||
namespace {
|
||||
|
@ -5,7 +5,7 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../../shared/utils.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
||||
@ -32,7 +32,7 @@ private Q_SLOTS:
|
||||
};
|
||||
|
||||
QTEST_MAIN(tst_deprecations_qpromise_all)
|
||||
#include "tst_all.moc"
|
||||
#include "tst_qpromise_all.moc"
|
||||
|
||||
namespace {
|
||||
|
@ -1,6 +1,4 @@
|
||||
qtpromise_add_test(exceptions
|
||||
SOURCES
|
||||
tst_exceptions.cpp
|
||||
LIBRARIES
|
||||
Qt5::Concurrent
|
||||
)
|
||||
|
@ -1,6 +1,4 @@
|
||||
qtpromise_add_test(future
|
||||
SOURCES
|
||||
tst_future.cpp
|
||||
LIBRARIES
|
||||
Qt5::Concurrent
|
||||
)
|
||||
|
@ -1,9 +1,12 @@
|
||||
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)
|
||||
qtpromise_add_tests(helpers
|
||||
SOURCES
|
||||
tst_all.cpp
|
||||
tst_attempt.cpp
|
||||
tst_connect.cpp
|
||||
tst_each.cpp
|
||||
tst_filter.cpp
|
||||
tst_map.cpp
|
||||
tst_reduce.cpp
|
||||
tst_reject.cpp
|
||||
tst_resolve.cpp
|
||||
)
|
||||
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(helpers.all
|
||||
SOURCES
|
||||
tst_all.cpp
|
||||
)
|
@ -1,6 +0,0 @@
|
||||
qtpromise_add_test(helpers.attempt
|
||||
SOURCES
|
||||
tst_attempt.cpp
|
||||
LIBRARIES
|
||||
Qt5::Concurrent
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(helpers.connect
|
||||
SOURCES
|
||||
tst_connect.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(helpers.each
|
||||
SOURCES
|
||||
tst_each.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(helpers.filter
|
||||
SOURCES
|
||||
tst_filter.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(helpers.map
|
||||
SOURCES
|
||||
tst_map.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(helpers.reduce
|
||||
SOURCES
|
||||
tst_reduce.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(helpers.reject
|
||||
SOURCES
|
||||
tst_reject.cpp
|
||||
)
|
@ -1,6 +0,0 @@
|
||||
qtpromise_add_test(helpers.resolve
|
||||
SOURCES
|
||||
tst_resolve.cpp
|
||||
LIBRARIES
|
||||
Qt5::Concurrent
|
||||
)
|
@ -5,7 +5,7 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
@ -5,7 +5,7 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
@ -5,8 +5,8 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/object.h"
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/object.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
@ -5,7 +5,7 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
@ -5,12 +5,13 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
||||
|
||||
// Qt
|
||||
#include <QtConcurrent>
|
||||
#include <QtTest>
|
||||
|
||||
using namespace QtPromise;
|
||||
@ -52,8 +53,6 @@ struct SequenceTester
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
|
||||
void tst_helpers_filter::emptySequence()
|
||||
{
|
||||
auto p = QtPromise::filter(QVector<int>{}, [](int v, ...) {
|
@ -5,7 +5,7 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
@ -5,8 +5,8 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/data.h"
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/data.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
@ -5,7 +5,7 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
@ -5,8 +5,8 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/data.h"
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/data.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
@ -1,14 +1,17 @@
|
||||
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)
|
||||
qtpromise_add_tests(qpromise
|
||||
SOURCES
|
||||
tst_construct.cpp
|
||||
tst_delay.cpp
|
||||
tst_each.cpp
|
||||
tst_fail.cpp
|
||||
tst_filter.cpp
|
||||
tst_finally.cpp
|
||||
tst_map.cpp
|
||||
tst_operators.cpp
|
||||
tst_reduce.cpp
|
||||
tst_resolve.cpp
|
||||
tst_tap.cpp
|
||||
tst_tapfail.cpp
|
||||
tst_then.cpp
|
||||
tst_timeout.cpp
|
||||
)
|
||||
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(qpromise.construct
|
||||
SOURCES
|
||||
tst_construct.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(qpromise.delay
|
||||
SOURCES
|
||||
tst_delay.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(qpromise.each
|
||||
SOURCES
|
||||
tst_each.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(qpromise.fail
|
||||
SOURCES
|
||||
tst_fail.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(qpromise.filter
|
||||
SOURCES
|
||||
tst_filter.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(qpromise.finally
|
||||
SOURCES
|
||||
tst_finally.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(qpromise.map
|
||||
SOURCES
|
||||
tst_map.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(qpromise.operators
|
||||
SOURCES
|
||||
tst_operators.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(qpromise.reduce
|
||||
SOURCES
|
||||
tst_reduce.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(qpromise.resolve
|
||||
SOURCES
|
||||
tst_resolve.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(qpromise.tap
|
||||
SOURCES
|
||||
tst_tap.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(qpromise.tapfail
|
||||
SOURCES
|
||||
tst_tapfail.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(qpromise.then
|
||||
SOURCES
|
||||
tst_then.cpp
|
||||
)
|
@ -1,4 +0,0 @@
|
||||
qtpromise_add_test(qpromise.timeout
|
||||
SOURCES
|
||||
tst_timeout.cpp
|
||||
)
|
@ -5,7 +5,7 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
@ -5,7 +5,7 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
@ -5,7 +5,7 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
@ -5,7 +5,7 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
@ -5,12 +5,13 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
||||
|
||||
// Qt
|
||||
#include <QtConcurrent>
|
||||
#include <QtTest>
|
||||
|
||||
using namespace QtPromise;
|
||||
@ -57,8 +58,6 @@ struct SequenceTester
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
|
||||
void tst_qpromise_filter::emptySequence()
|
||||
{
|
||||
auto p = QPromise<QVector<int>>::resolve({}).filter([](int v, ...) {
|
@ -5,7 +5,7 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
@ -5,7 +5,7 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
@ -5,7 +5,7 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
@ -5,8 +5,8 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/data.h"
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/data.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
@ -5,8 +5,8 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/data.h"
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/data.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
@ -5,7 +5,7 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
@ -5,7 +5,7 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
@ -5,7 +5,7 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
#include <functional>
|
||||
|
@ -5,7 +5,7 @@
|
||||
* the LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include "../../shared/utils.h"
|
||||
#include "../shared/utils.h"
|
||||
|
||||
// QtPromise
|
||||
#include <QtPromise>
|
@ -1,6 +1,4 @@
|
||||
qtpromise_add_test(thread
|
||||
SOURCES
|
||||
tst_thread.cpp
|
||||
LIBRARIES
|
||||
Qt5::Concurrent
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user