| 1 | # -*- coding: utf-8 -*- |
| 2 | |
| 3 | require 'test/unit' |
| 4 | require File.expand_path(File.join('..', 'timelimitedqueue')) |
| 5 | |
| 6 | class TC_TimeLimitedQueue < Test::Unit::TestCase |
| 7 | def setup |
| 8 | Thread.abort_on_exception = true |
| 9 | end |
| 10 | |
| 11 | # def teardown |
| 12 | # end |
| 13 | |
| 14 | def test_output |
| 15 | tlq = TimeLimitedQueue.new(10, 1){ |v| p v } |
| 16 | 100.times{ |n| |
| 17 | tlq.push(n) } |
| 18 | assert_equal(tlq.thread.group, TimeLimitedQueue::TLQGroup) |
| 19 | # sleep(1) |
| 20 | end |
| 21 | |
| 22 | end |
| 23 | # >> Loaded suite - |
| 24 | # >> Started |
| 25 | # >> . |
| 26 | # >> Finished in 0.001979 seconds. |
| 27 | # >> |
| 28 | # >> 1 tests, 1 assertions, 0 failures, 0 errors |