Sha256: d7c400968b14fd7c23340776f8cd3b5ea58f1f00a235bdb19930c2e963aaf8eb

Contents?: true

Size: 653 Bytes

Versions: 14

Compression:

Stored size: 653 Bytes

Contents

require 'facets/time/trunc'
require 'test/unit'

class Test_Time_Trunc < Test::Unit::TestCase

  def setup
    @t = Time.local(2000,03,03,3,37,23)
  end

  def test_trunc_hour
    assert_equal Time.local(2000,03,03,3, 0), @t.trunc(60 * 60)
  end

  #def test_trunc_month
  #  assert_equal Time.local(2000,03,01,0, 0), @t.trunc( 1.month  )  
  #end

  def test_trunc_15_minutes
    assert_equal Time.local(2000,03,03,3,30), @t.trunc(15 * 60)
  end
  
  def test_trunc_10_minutes
    assert_equal Time.local(2000,03,03,3,30), @t.trunc(10 * 60)
  end

  def test_trunc_05_minutes
    assert_equal Time.local(2000,03,03,3,35), @t.trunc( 5 * 60)
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
facets-2.8.4 test/core/time/test_trunc.rb
facets-2.8.3 test/core/time/test_trunc.rb
facets-2.8.2 test/core/time/test_trunc.rb
facets-2.8.1 test/core/time/test_trunc.rb
facets-2.8.0 test/core/time/test_trunc.rb
facets-2.7.0 test/core/time/test_trunc.rb
facets-2.6.0 test/core/time/test_trunc.rb
facets-2.4.4 test/core/time/test_trunc.rb
facets-2.4.3 test/core/time/test_trunc.rb
facets-2.4.2 test/core/time/test_trunc.rb
facets-2.4.5 test/core/time/test_trunc.rb
facets-2.5.0 test/core/time/test_trunc.rb
facets-2.5.1 test/core/time/test_trunc.rb
facets-2.5.2 test/core/time/test_trunc.rb