fold_test.cxx 414 B

123456789101112131415161718
  1. //
  2. // fold_test.cxx
  3. // stream-test
  4. //
  5. // Created by Sam Jaffe on 4/5/23.
  6. //
  7. #include "stream/algorithm/fold.h"
  8. #include "stream_helpers.h"
  9. #include "stream_matchers.h"
  10. TEST(FoldLeft, DifferentInitMakesDifferentResult) {
  11. std::vector<int> const input{1, 2, 3, 4, 5};
  12. EXPECT_THAT(ranges::fold_left(input, 0, std::multiplies<>()), 0);
  13. EXPECT_THAT(ranges::fold_left(input, 1, std::multiplies<>()), 120);
  14. }