src/base/circular_queue.test.cc
/** Adding elements to the circular queue.
 * Once an element has been added we test the new value
 * of front() and back() (head an tail). Since we are just
 * adding elements and not removing them, we expect the front
 * value to be fixed and the back value to change, matching
 * the latest pushed value.*/
Adding elements to the circular queue.
Once an element has been added we test the new value
of front() and back() (head an tail). Since we are just
adding elements and not removing them, we expect the front
value to be fixed and the back value to change, matching
the latest pushed value.
Adding elements to the circular queue . Once an element has been added we test the new value of front () and back () ( head an tail ) . Since we are just adding elements and not removing them we expect the front value to be fixed and the back value to change matching the latest pushed value .
TEST(CircularQueueTest, AddingElements)
{
    const auto cq_size = 8;
    CircularQueue<uint32_t> cq(cq_size);
    const auto first_element = 0xAAAAAAAA;
    cq.push_back(first_element);
    ASSERT_EQ(cq.front(), first_element);
    ASSERT_EQ(cq.back(), first_element);
    const auto second_element = 0x55555555;
    cq.push_back(second_element);
    ASSERT_EQ(cq.front(), first_element);
    ASSERT_EQ(cq.back(), second_element);
    ASSERT_EQ(cq.size(), 2);
}
TEST ( CircularQueueTest , AddingElements ) { const auto cq_size = 8 ; CircularQueue < uint32_t > cq ( cq_size ) ; const auto first_element = 0xAAAAAAAA ; cq . push_back ( first_element ) ; ASSERT_EQ ( cq . front ( ) , first_element ) ; ASSERT_EQ ( cq . back ( ) , first_element ) ; const auto second_element = 0x55555555 ; cq . push_back ( second_element ) ; ASSERT_EQ ( cq . front ( ) , first_element ) ; ASSERT_EQ ( cq . back ( ) , second_element ) ; ASSERT_EQ ( cq . size ( ) , 2 ) ; }
Adding elements to the circular queue.
Adding elements to the circular queue .