Add more remaining nested unit tests to the any strategy

This commit is contained in:
Denis Blank 2018-03-09 08:13:50 +01:00
parent c4cb102795
commit 1ce251483c
4 changed files with 23 additions and 12 deletions

View File

@ -151,7 +151,7 @@ struct continuable_dispatcher {
template <typename Continuable, template <typename Continuable,
std::enable_if_t<base::is_continuable< std::enable_if_t<base::is_continuable<
std::decay_t<Continuable>>::value>* = nullptr> std::decay_t<Continuable>>::value>* = nullptr>
void operator()(Continuable&& continuable) const { void operator()(Continuable&& continuable) {
// Retrieve a callback from the submitter and attach it to the continuable // Retrieve a callback from the submitter and attach it to the continuable
std::forward<Continuable>(continuable) std::forward<Continuable>(continuable)
.next(submitter->create_callback()) .next(submitter->create_callback())

View File

@ -176,13 +176,4 @@ int main(int, char**) {
.then([](int) { .then([](int) {
}); });
{
container::flat_variant<int, float> var;
var = 1;
var = 1.f;
}
int i = 0;
} }

View File

@ -75,8 +75,8 @@ void test_all_seq_aggregate(Supplier&& supply, AggregateConnector&& ag) {
} }
{ {
using type_t = decltype( using type_t = std::decay_t<decltype(
std::declval<Supplier>()(std::declval<int>(), std::declval<int>())); std::declval<Supplier>()(std::declval<int>(), std::declval<int>()))>;
auto chain = ag(std::make_tuple( auto chain = ag(std::make_tuple(
std::vector<type_t>{supply(1, 2), supply(3, 4), supply(5, 6)})); std::vector<type_t>{supply(1, 2), supply(3, 4), supply(5, 6)}));

View File

@ -21,6 +21,8 @@
SOFTWARE. SOFTWARE.
**/ **/
#include <type_traits>
#include <test-continuable.hpp> #include <test-continuable.hpp>
TYPED_TEST(single_dimension_tests, is_logical_any_connectable) { TYPED_TEST(single_dimension_tests, is_logical_any_connectable) {
@ -57,6 +59,24 @@ TYPED_TEST(single_dimension_tests, is_logical_any_connectable) {
ASSERT_ASYNC_TYPES(std::move(chain), tag1, tag2, tag3); ASSERT_ASYNC_TYPES(std::move(chain), tag1, tag2, tag3);
} }
{
auto chain =
cti::when_any(std::make_tuple(this->supply(1, 2),
std::make_tuple(this->supply(3, 4))),
this->supply(5, 6));
EXPECT_ASYNC_RESULT(std::move(chain), 1, 2);
}
{
using type_t = std::decay_t<decltype(std::declval<TestFixture>().supply(
std::declval<int>(), std::declval<int>()))>;
std::vector<type_t> v{this->supply(1, 2), this->supply(3, 4),
this->supply(5, 6)};
auto chain = cti::when_any(std::make_tuple(std::move(v)));
EXPECT_ASYNC_RESULT(std::move(chain), 1, 2);
}
{ {
// Check the evaluation order // Check the evaluation order
unsigned i = 0; unsigned i = 0;