2017-04-01 21:43:25 +00:00
|
|
|
#include <gtest/gtest.h>
|
2017-11-24 20:40:14 +00:00
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <DataStreams/ColumnGathererStream.h>
|
2018-08-26 01:56:34 +00:00
|
|
|
|
2016-11-03 12:00:44 +00:00
|
|
|
using DB::RowSourcePart;
|
|
|
|
|
|
|
|
static void check(const RowSourcePart & s, size_t num, bool flag)
|
|
|
|
{
|
2017-07-10 03:45:04 +00:00
|
|
|
EXPECT_FALSE((s.getSourceNum() != num || s.getSkipFlag() != flag) || (!flag && s.data != num));
|
2016-11-03 12:00:44 +00:00
|
|
|
}
|
|
|
|
|
2017-04-01 21:43:25 +00:00
|
|
|
TEST(ColumnGathererStream, RowSourcePartBitsTest)
|
2016-11-03 12:00:44 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
check(RowSourcePart(0, false), 0, false);
|
|
|
|
check(RowSourcePart(0, true), 0, true);
|
|
|
|
check(RowSourcePart(1, false), 1, false);
|
|
|
|
check(RowSourcePart(1, true), 1, true);
|
|
|
|
check(RowSourcePart(RowSourcePart::MAX_PARTS, false), RowSourcePart::MAX_PARTS, false);
|
|
|
|
check(RowSourcePart(RowSourcePart::MAX_PARTS, true), RowSourcePart::MAX_PARTS, true);
|
2016-11-03 12:00:44 +00:00
|
|
|
|
2017-07-10 03:45:04 +00:00
|
|
|
RowSourcePart p{80, false};
|
|
|
|
check(p, 80, false);
|
|
|
|
p.setSkipFlag(true);
|
|
|
|
check(p, 80, true);
|
|
|
|
p.setSkipFlag(false);
|
|
|
|
check(p, 80, false);
|
|
|
|
p.setSourceNum(RowSourcePart::MAX_PARTS);
|
|
|
|
check(p, RowSourcePart::MAX_PARTS, false);
|
2016-11-03 12:00:44 +00:00
|
|
|
}
|