File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,7 +119,26 @@ TEST(RingBufferTest, IteratorsFromDifferentBuffersAreNotEqual) {
119119 ring_buffer<int , 3 > b1;
120120 ring_buffer<int , 3 > b2;
121121
122+ // Iterators from different buffers should not be equal
122123 EXPECT_NE (b1.cbegin (), b2.cbegin ());
124+
125+ // Add elements to both buffers
126+ b1.push_back (1 );
127+ b1.push_back (2 );
128+ b2.push_back (1 );
129+ b2.push_back (2 );
130+
131+ // Iterators at the same logical position from different buffers should still be unequal
132+ EXPECT_NE (b1.cbegin (), b2.cbegin ());
133+ EXPECT_NE (b1.cend (), b2.cend ());
134+
135+ // Iterators from the same buffer at the same position should be equal
136+ EXPECT_EQ (b1.cbegin (), b1.cbegin ());
137+ EXPECT_EQ (b1.cend (), b1.cend ());
138+
139+ // begin() and end() from the same buffer should be different when not empty
140+ EXPECT_NE (b1.cbegin (), b1.cend ());
141+ EXPECT_NE (b2.cbegin (), b2.cend ());
123142}
124143
125144TEST (RingBufferTest, NoOverwriteWhenFull) {
You can’t perform that action at this time.
0 commit comments