summaryrefslogtreecommitdiff
path: root/test/datastructures/stlPriorityQueue.cpp.awk
blob: 99d0fb94facc12316eea71d62fa98fc97dae506e (plain)
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
29
30
31
32
33
34
35
36
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 }