2
0
mirror of https://github.com/boostorg/hof.git synced 2026-02-01 08:32:12 +00:00
Files
hof/test/compose.cpp
2014-07-18 13:24:18 -04:00

29 lines
525 B
C++

#include <fit/compose.h>
#include "test.h"
namespace compose_test {
struct increment
{
template<class T>
constexpr T operator()(T x) const
{
return x + 1;
}
};
struct decrement
{
template<class T>
constexpr T operator()(T x) const
{
return x - 1;
}
};
FIT_TEST_CASE()
{
int r = fit::compose(increment(), decrement(), increment())(3);
FIT_TEST_CHECK(r == 4);
static_assert(fit::compose(increment(), decrement(), increment())(3) == 4, "static compose failed");
}
}