Website Summary Files Commits Branches @commit @diff @stats
path: root / Seminar03 / QueueTests.cpp
blob: 221a09ad8ee50eed0b470f95e37451cb537c27ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include"Linked-Queue.hpp"
#include<cassert>
#include<iostream>

void runTest() {
    LinkedQueue<int> q;

    for (size_t i = 0; i < 1000; i++)
        q.push(i);

    std::cout << "Passed size test" << std::endl;
    assert(q.size() == 1000);

    for (size_t i = 0; i < 1000; i++) {
        assert(q.front() == i);
        q.pop();
    }

    std::cout << "Push, pop and top working as expected" << std::endl;

    assert(q.empty() && q.size() == 0);

    std::cout << "Passed empty test" << std::endl;
}

int main() {
    runTest();
}