for_each_test.cxx 343 B

12345678910111213141516171819
  1. //
  2. // for_each_test.cxx
  3. // stream-test
  4. //
  5. // Created by Sam Jaffe on 4/6/23.
  6. //
  7. #include "stream/algorithm/for_each.h"
  8. #include "stream_helpers.h"
  9. #include "stream_matchers.h"
  10. TEST(ForEach, IteratesOverEachItem) {
  11. int hits = 0;
  12. ranges::for_each(std::vector<int>{1, 2, 3, 4, 5}, [&hits](int) { ++hits; });
  13. EXPECT_THAT(hits, 5);
  14. }