tighten up Hub and add comments
[god.git] / test / test_timeline.rb
blobc714f98496eb86b53adb436fb5bdb03f13a2824a
1 require File.dirname(__FILE__) + '/helper'
3 class TestTimeline < Test::Unit::TestCase
4   def setup
5     @timeline = Timeline.new(5)
6   end
7   
8   def test_new_should_be_empty
9     assert_equal 0, @timeline.size
10   end
11   
12   def test_should_not_grow_to_more_than_size
13     (1..10).each do |i|
14       @timeline.push(i)
15     end
16     
17     assert_equal [6, 7, 8, 9, 10], @timeline
18   end
19   
20   def test_clear_should_clear_array
21     @timeline.push(1)
22     assert_equal [], @timeline.clear
23   end
24   
25   # def test_benchmark
26   #   require 'benchmark'
27   # 
28   #   count = 1_000_000
29   # 
30   #   t = Timeline.new(10)
31   # 
32   #   Benchmark.bmbm do |x|
33   #     x.report("go") { count.times { t.push(5) } }
34   #   end
35   # end
36 end