// // join_test.cxx // stream-test // // Created by Sam Jaffe on 4/5/23. // #include "stream/view/join.h" #include "stream/view/transform.h" #include "stream_helpers.h" #include "stream_matchers.h" TEST(JoinView, CanJoinCollectionOfCollections) { std::vector> const input{{1, 2, 3}, {2, 3, 4}, {3, 4, 5}}; EXPECT_THAT(input | views::join(), RangesEq(std::vector{1, 2, 3, 2, 3, 4, 3, 4, 5})); } TEST(JoinView, CanJoinTemporaryCollections) { std::vector const input{1, 2, 3}; auto const range = input | views::transform([](int i) { return std::vector{i, i + 1, i + 2}; }) | views::join(); EXPECT_THAT(range, RangesEq(std::vector{1, 2, 3, 2, 3, 4, 3, 4, 5})); }