summaryrefslogtreecommitdiff
path: root/test/datastructures/stlPriorityQueue.cpp.awk
diff options
context:
space:
mode:
Diffstat (limited to 'test/datastructures/stlPriorityQueue.cpp.awk')
-rw-r--r--test/datastructures/stlPriorityQueue.cpp.awk37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/datastructures/stlPriorityQueue.cpp.awk b/test/datastructures/stlPriorityQueue.cpp.awk
new file mode 100644
index 0000000..99d0fb9
--- /dev/null
+++ b/test/datastructures/stlPriorityQueue.cpp.awk
@@ -0,0 +1,37 @@
+/auto/ {
+ print "void test() {"
+ print "pQueue<ll> pq, pq2;"
+ print "pq.push(1);"
+ print "pq.push(5);"
+ print "pq.push(7);"
+ print "pq2.push(2);"
+ print "pq2.push(4);"
+ print "pq2.push(8);"
+}
+END {
+ print "if (pq.empty()) cerr << \"error: empty\" << FAIL;"
+ print "if (pq.top() != 8) cerr << \"error, got: \" << pq.top() << \", expected: 8\" << FAIL;"
+ print "pq.pop();"
+ print "if (pq.empty()) cerr << \"error: empty\" << FAIL;"
+ print "if (pq.top() != 7) cerr << \"error, got: \" << pq.top() << \", expected: 7\" << FAIL;"
+ print "pq.pop();"
+ print "if (pq.empty()) cerr << \"error: empty\" << FAIL;"
+ print "if (pq.top() != 6) cerr << \"error, got: \" << pq.top() << \", expected: 6\" << FAIL;"
+ print "pq.pop();"
+ print "if (pq.empty()) cerr << \"error: empty\" << FAIL;"
+ print "if (pq.top() != 5) cerr << \"error, got: \" << pq.top() << \", expected: 5\" << FAIL;"
+ print "pq.pop();"
+ print "if (pq.empty()) cerr << \"error: empty\" << FAIL;"
+ print "if (pq.top() != 4) cerr << \"error, got: \" << pq.top() << \", expected: 4\" << FAIL;"
+ print "pq.pop();"
+ print "if (pq.empty()) cerr << \"error: empty\" << FAIL;"
+ print "if (pq.top() != 2) cerr << \"error, got: \" << pq.top() << \", expected: 2\" << FAIL;"
+ print "pq.pop();"
+ print "if (pq.empty()) cerr << \"error: empty\" << FAIL;"
+ print "if (pq.top() != 1) cerr << \"error, got: \" << pq.top() << \", expected: 1\" << FAIL;"
+ print "pq.pop();"
+ print "if (!pq.empty()) cerr << \"error, got: \" << pq.top() << \", expected: empty\" << FAIL;"
+ print "cerr << \"testes example\" << endl;"
+ print "}"
+}
+{ print }