A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://TheAlgorithms.github.io/C-Plus-Plus/d8/dce/test__queue_8cpp_source.html below:

TheAlgorithms/C++: data_structures/test_queue.cpp Source File

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

int main()

Main function.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4