4 class MonitorTest < Test::Unit::TestCase
6 @monitor = Upr::Monitor.new
9 def test_start_with_length
10 assert_kind_of Upr::Status, @monitor.start('abcde', 5)
11 status = @monitor.read('abcde')
12 assert_equal 5, status.length
13 assert_equal 0, status.seen
14 assert ! status.error?
18 def test_start_without_length
19 assert_kind_of Upr::Status, @monitor.start('abcde', nil)
20 status = @monitor.read('abcde')
21 assert_nil status.length
22 assert_equal 0, status.seen
23 assert ! status.error?
28 assert_kind_of Upr::Status, @monitor.start('abcde', 5)
29 status = @monitor.incr('abcde', 2)
30 assert_kind_of Upr::Status, status
31 assert_equal 2, status.seen
32 assert ! status.error?
34 @monitor.incr('abcde', 3)
35 assert_equal 5, status.seen
36 assert ! status.error?
40 def test_finish_with_length
41 assert_kind_of Upr::Status, status = @monitor.start('abcde', 5)
42 @monitor.finish('abcde')
43 assert ! status.error?
45 assert_equal 5, status.seen
46 assert_equal 5, status.length
49 def test_finish_without_length
50 assert_kind_of Upr::Status, status = @monitor.start('abcde', nil)
51 @monitor.finish('abcde')
52 assert ! status.error?
54 assert_equal 0, status.seen
55 assert_equal 0, status.length