2
0
mirror of https://github.com/boostorg/hof.git synced 2026-01-21 04:52:20 +00:00
Files
hof/test/repeat_while.cpp
2016-01-17 23:16:02 -06:00

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);
}