Skip to content

Commit 41a4849

Browse files
committed
[hist] Test (in)equality operators of RBinIndexRange
1 parent 12dbddc commit 41a4849

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

hist/histv7/test/hist_index.cxx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,27 @@ TEST(RBinIndexRange, ConstructorCreate)
169169
EXPECT_EQ(range01.GetEnd(), RBinIndex(1));
170170
}
171171

172+
TEST(RBinIndexRange, Equality)
173+
{
174+
const auto index0 = RBinIndex(0);
175+
const auto index1 = RBinIndex(1);
176+
const auto empty = CreateBinIndexRange(index0, index0, 0);
177+
const auto empty0 = CreateBinIndexRange(index0, index0, 0);
178+
const auto empty1 = CreateBinIndexRange(index1, index1, 0);
179+
EXPECT_EQ(empty, empty0);
180+
EXPECT_NE(empty0, empty1);
181+
182+
const auto range01 = CreateBinIndexRange(index0, index1, 0);
183+
EXPECT_NE(empty, range01);
184+
185+
const auto underflow = RBinIndex::Underflow();
186+
const RBinIndex invalid;
187+
const auto full1 = CreateBinIndexRange(underflow, invalid, /*nNormalBins=*/1);
188+
const auto full2 = CreateBinIndexRange(underflow, invalid, /*nNormalBins=*/2);
189+
EXPECT_NE(range01, full1);
190+
EXPECT_NE(full1, full2);
191+
}
192+
172193
TEST(RBinIndexRange, Empty)
173194
{
174195
const auto index0 = RBinIndex(0);

0 commit comments

Comments
 (0)