netgen/tests/catch/ranges.cpp

19 lines
332 B
C++
Raw Normal View History

2020-09-19 20:39:03 +05:00
2021-09-02 17:52:34 +05:00
#include <catch2/catch.hpp>
2020-09-19 20:39:03 +05:00
#include <core/array.hpp>
#include <core/ranges.hpp>
using namespace ngcore;
TEST_CASE("ranges")
{
Array<int> a { 3, -1, 10, -5 };
Array<int> positive { 3, 10 };
int i = 0;
for(auto pos_val : a | filter([](auto val) { return val >= 0; }))
{
CHECK(pos_val == positive[i++]);
}
}