priority_queue 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/priority_queue.rb +4 -0
- data/priority_queue.gemspec +1 -1
- data/test/priority_queue_test.rb +22 -0
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/priority_queue.rb
CHANGED
data/priority_queue.gemspec
CHANGED
data/test/priority_queue_test.rb
CHANGED
@@ -40,4 +40,26 @@ class PriorityQueueTest < Test::Unit::TestCase
|
|
40
40
|
3.times { pq.shift }
|
41
41
|
assert_equal 0, pq.size
|
42
42
|
end
|
43
|
+
|
44
|
+
should "know if it is empty" do
|
45
|
+
pq = PriorityQueue.new
|
46
|
+
|
47
|
+
assert pq.empty?
|
48
|
+
|
49
|
+
pq[7] << :foo
|
50
|
+
pq[7] << :fu
|
51
|
+
pq[1] << :bap
|
52
|
+
pq[0] << :zap
|
53
|
+
|
54
|
+
assert !pq.empty?
|
55
|
+
|
56
|
+
3.times { pq.shift }
|
57
|
+
assert !pq.empty?
|
58
|
+
|
59
|
+
pq.shift
|
60
|
+
assert pq.empty?
|
61
|
+
|
62
|
+
pq.shift
|
63
|
+
assert pq.empty?
|
64
|
+
end
|
43
65
|
end
|