gem5  v20.1.0.0
Functions
circular_queue.test.cc File Reference
#include <gtest/gtest.h>
#include "base/circular_queue.hh"

Go to the source code of this file.

Functions

 TEST (CircularQueueTest, Empty)
 Testing that once instantiated with a fixed size, the queue is still empty. More...
 
 TEST (CircularQueueTest, HeadTailEmpty)
 Testing that once instantiated with a fixed size, the queue has Head = Tail + 1. More...
 
 TEST (CircularQueueTest, AddingElements)
 Adding elements to the circular queue. More...
 
 TEST (CircularQueueTest, RemovingElements)
 Removing elements from the circular queue. More...
 
 TEST (CircularQueueTest, Full)
 Testing CircularQueue::full This tests adds elements to the queue and checks that it is full, which means: More...
 
 TEST (CircularQueueTest, BeginEnd)
 Testing CircularQueue::begin(), CircularQueue::end() This tests the following: More...
 
 TEST (CircularQueueTest, BeginFrontEndBack)
 Testing that begin() and end() (-1) iterators actually point to the correct values so that dereferencing them leads to a match with the values of (front() and back()) More...
 
 TEST (CircularQueueTest, IteratorsOp)
 Testing circular queue iterators: By allocating two iterators to a queue we test several operators. More...
 
 TEST (CircularQueueTest, FullLoop)
 Testing a full loop, which is incrementing one iterator until it wraps and has the same index as the starting iterator. More...
 
 TEST (CircularQueueTest, MultipleRound)
 Testing correct behaviour when rounding multiple times: More...
 

Function Documentation

◆ TEST() [1/10]

TEST ( CircularQueueTest  ,
AddingElements   
)

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.

Definition at line 69 of file circular_queue.test.cc.

References CircularQueue< T >::back(), CircularQueue< T >::front(), CircularQueue< T >::push_back(), and CircularQueue< T >::size().

◆ TEST() [2/10]

TEST ( CircularQueueTest  ,
BeginEnd   
)

Testing CircularQueue::begin(), CircularQueue::end() This tests the following:

  • In an empty queue, begin() == end()
  • After pushing some elements in the queue, the begin() and end() iterators are correctly misaligned

Definition at line 147 of file circular_queue.test.cc.

References CircularQueue< T >::begin(), CircularQueue< T >::end(), and CircularQueue< T >::push_back().

◆ TEST() [3/10]

TEST ( CircularQueueTest  ,
BeginFrontEndBack   
)

Testing that begin() and end() (-1) iterators actually point to the correct values so that dereferencing them leads to a match with the values of (front() and back())

Definition at line 170 of file circular_queue.test.cc.

References CircularQueue< T >::back(), CircularQueue< T >::begin(), CircularQueue< T >::end(), CircularQueue< T >::front(), and CircularQueue< T >::push_back().

◆ TEST() [4/10]

TEST ( CircularQueueTest  ,
Empty   
)

Testing that once instantiated with a fixed size, the queue is still empty.

Definition at line 44 of file circular_queue.test.cc.

References CircularQueue< T >::capacity(), CircularQueue< T >::empty(), and CircularQueue< T >::size().

◆ TEST() [5/10]

TEST ( CircularQueueTest  ,
Full   
)

Testing CircularQueue::full This tests adds elements to the queue and checks that it is full, which means:

Definition at line 127 of file circular_queue.test.cc.

References CircularQueue< T >::full(), CircularQueue< T >::head(), CircularQueue< T >::push_back(), and CircularQueue< T >::tail().

◆ TEST() [6/10]

TEST ( CircularQueueTest  ,
FullLoop   
)

Testing a full loop, which is incrementing one iterator until it wraps and has the same index as the starting iterator.

This test checks that even if they have the same index, they are not the same iterator since they have different round.

Definition at line 233 of file circular_queue.test.cc.

References CircularQueue< T >::begin().

◆ TEST() [7/10]

TEST ( CircularQueueTest  ,
HeadTailEmpty   
)

Testing that once instantiated with a fixed size, the queue has Head = Tail + 1.

Definition at line 56 of file circular_queue.test.cc.

References CircularQueue< T >::head(), and CircularQueue< T >::tail().

◆ TEST() [8/10]

TEST ( CircularQueueTest  ,
IteratorsOp   
)

Testing circular queue iterators: By allocating two iterators to a queue we test several operators.

Definition at line 189 of file circular_queue.test.cc.

References CircularQueue< T >::begin(), and CircularQueue< T >::push_back().

◆ TEST() [9/10]

TEST ( CircularQueueTest  ,
MultipleRound   
)

Testing correct behaviour when rounding multiple times:

  • Round indexes in sync
  • Difference between begin() and end() iterator is still equal to the CircularQueue size.

Definition at line 253 of file circular_queue.test.cc.

References CircularQueue< T >::begin(), CircularQueue< T >::end(), and CircularQueue< T >::push_back().

◆ TEST() [10/10]

TEST ( CircularQueueTest  ,
RemovingElements   
)

Removing elements from the circular queue.

We add two elements and we consequently remove them. After removing them we check that the elements have been effectively removed, which means the circular queue is empty

Definition at line 92 of file circular_queue.test.cc.

References CircularQueue< T >::empty(), CircularQueue< T >::head(), CircularQueue< T >::pop_front(), CircularQueue< T >::push_back(), CircularQueue< T >::size(), and CircularQueue< T >::tail().


Generated on Wed Sep 30 2020 14:02:18 for gem5 by doxygen 1.8.17