Add unit tests for the nested seq and all compositions

This commit is contained in:
Denis Blank 2018-03-09 05:40:37 +01:00
parent b50c2bf8a8
commit deb798118c

View File

@ -24,6 +24,10 @@
#ifndef TEST_CONTINUABLE_CONNECTION_HPP__ #ifndef TEST_CONTINUABLE_CONNECTION_HPP__
#define TEST_CONTINUABLE_CONNECTION_HPP__ #define TEST_CONTINUABLE_CONNECTION_HPP__
#include <tuple>
#include <type_traits>
#include <vector>
#include <test-continuable.hpp> #include <test-continuable.hpp>
template <typename Supplier, typename OperatorConnector> template <typename Supplier, typename OperatorConnector>
@ -62,6 +66,25 @@ void test_all_seq_aggregate(Supplier&& supply, AggregateConnector&& ag) {
EXPECT_ASYNC_RESULT(std::move(chain), 1, 2, 3, 4, 5, 6); EXPECT_ASYNC_RESULT(std::move(chain), 1, 2, 3, 4, 5, 6);
} }
{
auto chain =
ag(std::make_tuple(supply(1, 2), std::make_tuple(supply(3, 4))),
supply(5, 6));
EXPECT_ASYNC_RESULT(std::move(chain),
std::make_tuple(1, 2, std::make_tuple(3, 4)), 5, 6);
}
{
using type_t = decltype(
std::declval<Supplier>()(std::declval<int>(), std::declval<int>()));
auto chain = ag(std::make_tuple(
std::vector<type_t>{supply(1, 2), supply(3, 4), supply(5, 6)}));
EXPECT_ASYNC_RESULT(std::move(chain),
std::make_tuple(std::vector<std::tuple<int, int>>{
{1, 2}, {3, 4}, {5, 6}}));
}
{ {
auto chain = auto chain =
ag(supply(1, 2), supply(non_default_constructible{1}), supply(5, 6)); ag(supply(1, 2), supply(non_default_constructible{1}), supply(5, 6));