29 lines
625 B
C++
29 lines
625 B
C++
|
#include <cruft/util/ranges/adjacent.hpp>
|
||
|
|
||
|
#include <cruft/util/tap.hpp>
|
||
|
|
||
|
#include <algorithm>
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
static int constexpr INPUT[] = { 1, 1, 2, 3, 5, 8 };
|
||
|
static int constexpr EXPECTED[][2] = {
|
||
|
{ 1, 1 },
|
||
|
{ 1, 2 },
|
||
|
{ 2, 3 },
|
||
|
{ 3, 5 },
|
||
|
{ 5, 8 },
|
||
|
};
|
||
|
|
||
|
cruft::TAP::logger tap;
|
||
|
|
||
|
const bool same = std::ranges::equal (
|
||
|
std::views::all (INPUT) | cruft::ranges::pairwise,
|
||
|
EXPECTED,
|
||
|
[] (auto const &a, auto const &b) { return std::ranges::equal (a, b); }
|
||
|
);
|
||
|
|
||
|
tap.expect (same, "ranges::pairwise fibonacci");
|
||
|
|
||
|
return tap.status ();
|
||
|
}
|