3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-09-13 13:11:27 +00:00

Fix const_iterator postincrement behavior

This commit is contained in:
Robert O'Callahan 2025-08-29 04:33:14 +00:00
parent c5d096b7b8
commit 4657768506
2 changed files with 26 additions and 2 deletions

View file

@ -90,6 +90,30 @@ namespace RTLIL {
}
TEST_F(KernelRtlilTest, ConstConstIteratorWorks) {
const Const c(0x2, 2);
Const::const_iterator it = c.begin();
ASSERT_NE(it, c.end());
EXPECT_EQ(*it, State::S0);
++it;
ASSERT_NE(it, c.end());
EXPECT_EQ(*it, State::S1);
++it;
EXPECT_EQ(it, c.end());
}
TEST_F(KernelRtlilTest, ConstConstIteratorPreincrement) {
const Const c(0x2, 2);
Const::const_iterator it = c.begin();
EXPECT_EQ(*++it, State::S1);
}
TEST_F(KernelRtlilTest, ConstConstIteratorPostincrement) {
const Const c(0x2, 2);
Const::const_iterator it = c.begin();
EXPECT_EQ(*it++, State::S0);
}
class WireRtlVsHdlIndexConversionTest :
public KernelRtlilTest,
public testing::WithParamInterface<std::tuple<bool, int, int>>