src/base/circular_queue.test.cc
/** Testing circular queue iterators:
 * By allocating two iterators to a queue we test several
 * operators.
 */
Testing circular queue iterators:
By allocating two iterators to a queue we test several
operators.
Testing circular queue iterators : By allocating two iterators to a queue we test several operators .
TEST(CircularQueueTest, IteratorsOp)
{
    const auto cq_size = 8;
    CircularQueue<uint32_t> cq(cq_size);
    const auto first_value = 0xAAAAAAAA;
    const auto second_value = 0x55555555;
    cq.push_back(first_value);
    cq.push_back(second_value);
    auto it_1 = cq.begin();
    auto it_2 = cq.begin() + 1;
    ASSERT_TRUE(it_1 != it_2);
    ASSERT_FALSE(it_1 == it_2);
    ASSERT_FALSE(it_1 > it_2);
    ASSERT_FALSE(it_1 >= it_2);
    ASSERT_TRUE(it_1 < it_2);
    ASSERT_TRUE(it_1 <= it_2);
    ASSERT_EQ(*it_1, first_value);
    ASSERT_EQ(it_1 + 1, it_2);
    ASSERT_EQ(it_1, it_2 - 1);
    ASSERT_EQ(it_2 - it_1, 1);
    ASSERT_EQ(it_1 - it_2, -1);
    auto temp_it = it_1;
    ASSERT_EQ(++temp_it, it_2);
    ASSERT_EQ(--temp_it, it_1);
    ASSERT_EQ(temp_it++, it_1);
    ASSERT_EQ(temp_it, it_2);
    ASSERT_EQ(temp_it--, it_2);
    ASSERT_EQ(temp_it, it_1);
}
TEST ( CircularQueueTest , IteratorsOp ) { const auto cq_size = 8 ; CircularQueue < uint32_t > cq ( cq_size ) ; const auto first_value = 0xAAAAAAAA ; const auto second_value = 0x55555555 ; cq . push_back ( first_value ) ; cq . push_back ( second_value ) ; auto it_1 = cq . begin ( ) ; auto it_2 = cq . begin ( ) + 1 ; ASSERT_TRUE ( it_1 != it_2 ) ; ASSERT_FALSE ( it_1 == it_2 ) ; ASSERT_FALSE ( it_1 > it_2 ) ; ASSERT_FALSE ( it_1 >= it_2 ) ; ASSERT_TRUE ( it_1 < it_2 ) ; ASSERT_TRUE ( it_1 <= it_2 ) ; ASSERT_EQ ( * it_1 , first_value ) ; ASSERT_EQ ( it_1 + 1 , it_2 ) ; ASSERT_EQ ( it_1 , it_2 - 1 ) ; ASSERT_EQ ( it_2 - it_1 , 1 ) ; ASSERT_EQ ( it_1 - it_2 , -1 ) ; auto temp_it = it_1 ; ASSERT_EQ ( ++ temp_it , it_2 ) ; ASSERT_EQ ( -- temp_it , it_1 ) ; ASSERT_EQ ( temp_it ++ , it_1 ) ; ASSERT_EQ ( temp_it , it_2 ) ; ASSERT_EQ ( temp_it -- , it_2 ) ; ASSERT_EQ ( temp_it , it_1 ) ; }
Testing circular queue iterators:
 By allocating two iterators to a queue we test several
 operators.
Testing circular queue iterators : By allocating two iterators to a queue we test several operators .
// Operators test