1 | #include <gtest/gtest.h> |
2 | |
3 | #include <DataStreams/ColumnGathererStream.h> |
4 | |
5 | using DB::RowSourcePart; |
6 | |
7 | static void check(const RowSourcePart & s, size_t num, bool flag) |
8 | { |
9 | EXPECT_FALSE((s.getSourceNum() != num || s.getSkipFlag() != flag) || (!flag && s.data != num)); |
10 | } |
11 | |
12 | TEST(ColumnGathererStream, RowSourcePartBitsTest) |
13 | { |
14 | check(RowSourcePart(0, false), 0, false); |
15 | check(RowSourcePart(0, true), 0, true); |
16 | check(RowSourcePart(1, false), 1, false); |
17 | check(RowSourcePart(1, true), 1, true); |
18 | check(RowSourcePart(RowSourcePart::MAX_PARTS, false), RowSourcePart::MAX_PARTS, false); |
19 | check(RowSourcePart(RowSourcePart::MAX_PARTS, true), RowSourcePart::MAX_PARTS, true); |
20 | |
21 | RowSourcePart p{80, false}; |
22 | check(p, 80, false); |
23 | p.setSkipFlag(true); |
24 | check(p, 80, true); |
25 | p.setSkipFlag(false); |
26 | check(p, 80, false); |
27 | p.setSourceNum(RowSourcePart::MAX_PARTS); |
28 | check(p, RowSourcePart::MAX_PARTS, false); |
29 | } |
30 | |