File: utilization_timer_test.rb

package info (click to toggle)
ruby-metriks 0.9.9.8-3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 288 kB
  • sloc: ruby: 1,877; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 477 bytes parent folder | download | duplicates (3)
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
require 'test_helper'

require 'metriks/utilization_timer'

class UtilizationTimerTest < Test::Unit::TestCase
  def setup
    @timer = Metriks::UtilizationTimer.new
  end

  def teardown
    @timer.stop
  end

  def test_timer
    5.times do
      @timer.update(0.10)
      @timer.update(0.15)
    end

    @timer.instance_variable_get(:@meter).tick
    @timer.instance_variable_get(:@duration_meter).tick

    assert_in_delta 0.25, @timer.one_minute_utilization, 0.1
  end
end