mirror of
https://github.com/boostorg/hof.git
synced 2026-01-20 16:42:14 +00:00
39 lines
900 B
C++
39 lines
900 B
C++
#include <fit/repeat_while.hpp>
|
|
#include "test.hpp"
|
|
|
|
// TODO: Test default construction, and static initialization
|
|
|
|
struct increment
|
|
{
|
|
template<class T>
|
|
constexpr std::integral_constant<int, T::value + 1> operator()(T) const
|
|
{
|
|
return std::integral_constant<int, T::value + 1>();
|
|
}
|
|
};
|
|
|
|
struct not_6
|
|
{
|
|
template<class T>
|
|
constexpr std::integral_constant<bool, (T::value != 6)>
|
|
operator()(T) const
|
|
{
|
|
return std::integral_constant<bool, (T::value != 6)>();
|
|
}
|
|
};
|
|
|
|
FIT_TEST_CASE()
|
|
{
|
|
static_assert
|
|
(
|
|
std::is_same<
|
|
std::integral_constant<int, 6>,
|
|
decltype(fit::repeat_while(not_6())(increment())(std::integral_constant<int, 1>()))
|
|
>::value,
|
|
"Error"
|
|
);
|
|
|
|
std::integral_constant<int, 6> x = fit::repeat_while(not_6())(increment())(std::integral_constant<int, 1>());
|
|
fit::test::unused(x);
|
|
}
|