7void testConstructedQueueIsEmpty() {
15 assert(curQueue.
toVector() == std::vector<int>({10}));
17 assert(curQueue.
toVector() == std::vector<int>({10, 20}));
20 assert(curQueue.
toVector() == std::vector<int>({10, 20, 30, 40}));
30 assert(curQueue.
toVector() == std::vector<int>({20, 30}));
33 assert(curQueue.
toVector() == std::vector<int>({30}));
42 assert(curQueue.
front() == 10);
44 assert(curQueue.
front() == 10);
47void testQueueAfterClearIsEmpty() {
56void testFrontThrowsAnInvalidArgumentWhenQueueEmpty() {
58 bool wasException =
false;
61 }
catch (
const std::invalid_argument&) {
67void testDeQueueThrowsAnInvalidArgumentWhenQueueEmpty() {
69 bool wasException =
false;
72 }
catch (
const std::invalid_argument&) {
79 testConstructedQueueIsEmpty<int>();
80 testConstructedQueueIsEmpty<double>();
81 testConstructedQueueIsEmpty<std::vector<long double>>();
86 testQueueAfterClearIsEmpty();
88 testFrontThrowsAnInvalidArgumentWhenQueueEmpty();
89 testDeQueueThrowsAnInvalidArgumentWhenQueueEmpty();
91 std::cout <<
"All tests pass!\n";
std::vector< value_type > toVector() const
converts the queue into the std::vector
bool isEmptyQueue() const
checks if the queue has no elements
void clear()
removes all elements from the queue
void enQueue(const value_type &item)
inserts a new item into the queue
void deQueue()
removes the first element from the queue