Website Summary Files Commits Branches @commit @diff @stats
path: root / Seminar03 / QueueTests.cpp
diff options
context:
space:
mode:
Commit7b38c7fa2a76d912ca45576c06b9f900d77b616c (patch)
Author
 Stoycho Kyosev <stoycho.kk@gmail.com>
2022-10-19 13:15:50 +0300
Committer
 Stoycho Kyosev <stoycho.kk@gmail.com>
2022-10-19 13:15:50 +0300
Files2997df965325fb3bf9fcb4c8b31298e9cc615ce6 /Seminar03/QueueTests.cpp
Data-structures-and-algorithms-7b38c7fa2a76d912ca45576c06b9f900d77b616c.tar
Data-structures-and-algorithms-7b38c7fa2a76d912ca45576c06b9f900d77b616c.tar.gz
Data-structures-and-algorithms-7b38c7fa2a76d912ca45576c06b9f900d77b616c.zip
Parent45d4463d1fd0846ebc941e70abd791f5e2c0fccb (diff)
add Sem03
1 files changed, 28 insertions, 0 deletions
-rw-r--r--Seminar03/QueueTests.cpp28
diff --git a/Seminar03/QueueTests.cpp b/Seminar03/QueueTests.cpp
new file mode 100644
index 0000000..221a09a
--- /dev/null
+++ b/Seminar03/QueueTests.cpp
@@ -0,0 +1,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();
+}