mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-16 11:22:12 +00:00
27 lines
512 B
C++
27 lines
512 B
C++
#include <Common/RangeGenerator.h>
|
|
#include <gtest/gtest.h>
|
|
|
|
using namespace DB;
|
|
|
|
|
|
TEST(RangeGenerator, Common)
|
|
{
|
|
RangeGenerator g{25, 10};
|
|
EXPECT_EQ(g.totalRanges(), 3);
|
|
|
|
auto r = g.nextRange();
|
|
EXPECT_TRUE(r);
|
|
EXPECT_EQ(*r, RangeGenerator::Range(0, 10));
|
|
|
|
r = g.nextRange();
|
|
EXPECT_TRUE(r);
|
|
EXPECT_EQ(*r, RangeGenerator::Range(10, 20));
|
|
|
|
r = g.nextRange();
|
|
EXPECT_TRUE(r);
|
|
EXPECT_EQ(*r, RangeGenerator::Range(20, 25));
|
|
|
|
r = g.nextRange();
|
|
EXPECT_TRUE(!r);
|
|
}
|