Skip to content

Commit d6769df

Browse files
committed
add combined skip & take secondary subrange test
1 parent df77b46 commit d6769df

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/subranges.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,24 @@ SCENARIO("Subranges", "[subranges::simple]")
100100
REQUIRE(elements_equal_to<3>(next(begin(r)), end(r)));
101101
}
102102
}
103+
104+
WHEN("skipping the first 25 elements and taking the next 50 elements of both buffers")
105+
{
106+
auto r0 = skip<1>({25});
107+
auto r1 = take<1>({50});
108+
buffer<int, 1> buf_out{size};
109+
110+
in_buf_a | r0 | r1 | t0 << (in_buf_b | r0 | r1) | buf_out | submit_to(q);
111+
112+
THEN("the first and last 25 elements are zero and the rest is 3")
113+
{
114+
const auto r = copy_to_host(q, buf_out);
115+
REQUIRE(r.size() == in_buf_a.get_range().size());
116+
REQUIRE(elements_equal_to<0>(begin(r), begin(r) + 25));
117+
REQUIRE(elements_equal_to<3>(begin(r) + 25, begin(r) + 75));
118+
REQUIRE(elements_equal_to<0>(begin(r) + 75, end(r)));
119+
}
120+
}
103121
}
104122

105123
GIVEN("A 2d buffer of 100 ones and a transform kernel which adds 5")

0 commit comments

Comments
 (0)