aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/iterator/ut/zip_ut.cpp
blob: 68d496515c3e6be3f6c74cab6c12d06dc2690f08 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <library/cpp/iterator/zip.h>

#include <library/cpp/testing/gtest/gtest.h>

#include <util/generic/vector.h>

TEST(TIterator, ZipSimplePostIncrement) {
    TVector<int> left{1, 2, 3};
    TVector<int> right{4, 5, 6};

    auto zipped = Zip(left, right);
    auto cur = zipped.begin();
    auto last = zipped.end();

    {
        auto first = *(cur++);
        EXPECT_EQ(std::get<0>(first), 1);
        EXPECT_EQ(std::get<1>(first), 4);
    }
    {
        auto second = *(cur++);
        EXPECT_EQ(std::get<0>(second), 2);
        EXPECT_EQ(std::get<1>(second), 5);
    }

    EXPECT_EQ(std::next(cur), last);
}