Sha256: 8dd2fc55f5120325b7e48027bd034b720116c8d1071dfccbf2d89a0aaed53b50

Contents?: true

Size: 717 Bytes

Versions: 260

Compression:

Stored size: 717 Bytes

Contents

$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
require 'test/unit'
require 'tzinfo'

include TZInfo

class TCOffsetRationals < Test::Unit::TestCase
  def test_rational_for_offset
    [0,1,2,3,4,-1,-2,-3,-4,30*60,-30*60,61*60,-61*60,14*60*60,-14*60*60,20*60*60,-20*60*60].each {|seconds|
      assert_equal(Rational(seconds, 86400), OffsetRationals.rational_for_offset(seconds))      
    }
  end
  
  def test_rational_for_offset_constant
    -28.upto(28) {|i|
      seconds = i * 30 * 60
      
      r1 = OffsetRationals.rational_for_offset(seconds)
      r2 = OffsetRationals.rational_for_offset(seconds)
      
      assert_equal(Rational(seconds, 86400), r1)
      assert_same(r1, r2)
    }
  end
end

Version data entries

260 entries across 183 versions & 18 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/tzinfo-0.3.32/test/tc_offset_rationals.rb
classiccms-0.7.4 vendor/bundle/gems/tzinfo-0.3.32/test/tc_offset_rationals.rb
classiccms-0.7.4 vendor/bundle/gems/tzinfo-0.3.33/test/tc_offset_rationals.rb
classiccms-0.7.3 vendor/bundle/gems/tzinfo-0.3.32/test/tc_offset_rationals.rb
classiccms-0.7.3 vendor/bundle/gems/tzinfo-0.3.33/test/tc_offset_rationals.rb
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/tzinfo-0.3.35/test/tc_offset_rationals.rb
tzinfo-0.3.44 test/tc_offset_rationals.rb
tzinfo-0.3.43 test/tc_offset_rationals.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/tzinfo-0.3.35/test/tc_offset_rationals.rb
apl-library-0.0.90 vendor/bundle/ruby/1.8/gems/tzinfo-0.3.39/test/tc_offset_rationals.rb
apl-library-0.0.90 vendor/bundle/ruby/1.8/gems/tzinfo-0.3.42/test/tc_offset_rationals.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/tzinfo-0.3.39/test/tc_offset_rationals.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.8/gems/tzinfo-0.3.42/test/tc_offset_rationals.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/tzinfo-0.3.42/test/tc_offset_rationals.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/tzinfo-0.3.42/test/tc_offset_rationals.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.8/gems/tzinfo-0.3.39/test/tc_offset_rationals.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/tzinfo-0.3.39/test/tc_offset_rationals.rb
tzinfo-0.3.42 test/tc_offset_rationals.rb
tzinfo-0.3.41 test/tc_offset_rationals.rb
tzinfo-0.3.40 test/tc_offset_rationals.rb