From 18553f22b2743328697ea0e4ebf973b23a8d1e45 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Thu, 23 Nov 2017 03:29:26 +0100 Subject: [PATCH] TreeExplorer: cover both variants of functor signature by unit test (PASS) --- src/lib/iter-tree-explorer.hpp | 4 ++-- tests/library/iter-tree-explorer-test.cpp | 16 ++++++++++++++-- wiki/thinkPad.ichthyo.mm | 18 +++++++++++++----- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/lib/iter-tree-explorer.hpp b/src/lib/iter-tree-explorer.hpp index b7e539279..dfdfac94a 100644 --- a/src/lib/iter-tree-explorer.hpp +++ b/src/lib/iter-tree-explorer.hpp @@ -268,7 +268,7 @@ namespace lib { struct _TreeExplorerTraits>> { using SrcVal = typename std::remove_reference()))>::type; - using SrcIter = IterStateWrapper; + using SrcIter = iter_source::IterableDecorator; }; template @@ -290,7 +290,7 @@ namespace lib { struct ArgAccessor { using FunArg = typename _Fun::Args::List::Head; - static_assert (std::is_convertible::value, + static_assert (std::is_convertible::value, "the expansion functor must accept the source iterator or state core as parameter"); static auto accessor() { return [](auto arg) { return arg; }; } diff --git a/tests/library/iter-tree-explorer-test.cpp b/tests/library/iter-tree-explorer-test.cpp index a34c0ba88..39692241f 100644 --- a/tests/library/iter-tree-explorer-test.cpp +++ b/tests/library/iter-tree-explorer-test.cpp @@ -302,10 +302,22 @@ namespace test{ void verify_expandOperation() { - auto ii = treeExplore(CountDown{5}) + verify_treeExpandingIterator( + treeExplore(CountDown{5}) .expand([](uint j){ return CountDown{j-1}; }) - ; + ); + verify_treeExpandingIterator( + treeExplore(CountDown{5}) + .expand([](CountDown const& core){ return CountDown{ yield(core) - 1}; }) + ); + } + + + template + void + verify_treeExpandingIterator(EXP ii) + { CHECK (!isnil (ii)); CHECK (5 == *ii); ++ii; diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 03d0b51a8..504819676 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -5131,8 +5131,8 @@ - - + + @@ -5168,8 +5168,8 @@ - - + + @@ -5177,9 +5177,17 @@ - + + + + + + + + +