This commit is contained in:
Nathan Braswell
2015-08-29 21:46:05 -04:00
8 changed files with 286 additions and 21 deletions

View File

@@ -0,0 +1,67 @@
adding to q
pushing...
0
pushing...
1
pushing...
2
pushing...
3
pushing...
4
pushing...
5
pushing...
6
pushing...
7
pushing...
8
pushing...
9
adding to q2
pushing...
9
pushing...
8
pushing...
7
pushing...
6
pushing...
5
pushing...
4
pushing...
3
pushing...
2
pushing...
1
pushing...
0
pop test...
0
q is about to pop
q popped
q2 is about to pop
9
8
7
6
5
4
3
2
1
0
1
2
3
4
5
6
7
8
9
done

39
tests/test_queue.krak Normal file
View File

@@ -0,0 +1,39 @@
import queue
import io:*;
fun main() : int {
var q.construct() : queue::queue<int>
var q2.construct() : queue::queue<int>
println("adding to q")
for(var i = 0; i < 10; i++;) {
defer println(i)
println("pushing...")
q.push(i)
}
println("adding to q2")
for(var i = 9; i >= 0; i--;) {
defer println(i)
println("pushing...")
q2.push(i)
}
println("pop test...")
println(q.pop())
println("q is about to pop")
while(!q.empty()) {
q2.push(q.pop())
}
println("q popped")
println("q2 is about to pop")
while(!q2.empty()) {
println(q2.pop())
}
println("done")
return 0
}