zip_ut.cpp 623 B

12345678910111213141516171819202122232425262728
  1. #include <library/cpp/iterator/zip.h>
  2. #include <library/cpp/testing/gtest/gtest.h>
  3. #include <util/generic/vector.h>
  4. TEST(TIterator, ZipSimplePostIncrement) {
  5. TVector<int> left{1, 2, 3};
  6. TVector<int> right{4, 5, 6};
  7. auto zipped = Zip(left, right);
  8. auto cur = zipped.begin();
  9. auto last = zipped.end();
  10. {
  11. auto first = *(cur++);
  12. EXPECT_EQ(std::get<0>(first), 1);
  13. EXPECT_EQ(std::get<1>(first), 4);
  14. }
  15. {
  16. auto second = *(cur++);
  17. EXPECT_EQ(std::get<0>(second), 2);
  18. EXPECT_EQ(std::get<1>(second), 5);
  19. }
  20. EXPECT_EQ(std::next(cur), last);
  21. }