fmq 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,47 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- class TestFreeMessageQueue < Test::Unit::TestCase
4
- def setup
5
- #@queue = FreeMessageQueue::LinkedQueue.new
6
- @queue = FreeMessageQueue::SyncronizedQueue.new
7
- end
8
-
9
- def test_basic_get_poll
10
- assert_nil @queue.poll
11
- assert_equal 0, @queue.size
12
- assert @queue.put(nil) == false
13
- assert_nil @queue.poll
14
- td_1 = "asdasd"
15
- assert @queue.put(td_1)
16
- assert_equal 1, @queue.size
17
- assert_equal td_1, @queue.poll.data
18
- end
19
-
20
- def test_n_items
21
- n = 20
22
- byte_size = 0
23
- n.times { |t| byte_size += t.size }
24
-
25
- assert_equal 0, @queue.bytes
26
- assert_nil @queue.poll
27
- n.times do |i|
28
- assert @queue.put(i)
29
- end
30
- assert_equal byte_size, @queue.bytes
31
- assert_equal n, @queue.size
32
- n.times do |i|
33
- assert_equal i, @queue.poll.data
34
- end
35
- assert_equal 0, @queue.bytes
36
- assert_nil @queue.poll
37
- end
38
-
39
- def test_queue_bytes
40
- @queue.put("XX" * 40)
41
- @queue.put("X" * 40)
42
- @queue.put("XX888" * 40)
43
- assert_equal 2*40+40+5*40, @queue.bytes
44
- @queue.clear
45
- assert_equal 0, @queue.bytes
46
- end
47
- end