File: test_timeline.rb

package info (click to toggle)
ruby-god 0.13.7-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 832 kB
  • sloc: ruby: 6,641; ansic: 237; makefile: 3
file content (37 lines) | stat: -rw-r--r-- 704 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require File.dirname(__FILE__) + '/helper'

class TestTimeline < Minitest::Test
  def setup
    @timeline = Timeline.new(5)
  end

  def test_new_should_be_empty
    assert_equal 0, @timeline.size
  end

  def test_should_not_grow_to_more_than_size
    (1..10).each do |i|
      @timeline.push(i)
    end

    assert_equal [6, 7, 8, 9, 10], @timeline
  end

  def test_clear_should_clear_array
    @timeline << 1
    assert_equal [1], @timeline
    assert_equal [], @timeline.clear
  end

  # def test_benchmark
  #   require 'benchmark'
  #
  #   count = 1_000_000
  #
  #   t = Timeline.new(10)
  #
  #   Benchmark.bmbm do |x|
  #     x.report("go") { count.times { t.push(5) } }
  #   end
  # end
end