Sha256: a3cd0b11e20faf867490edc3f2cb541c31d42ebe9b4235db89a8ceb98ebf62d2

Contents?: true

Size: 690 Bytes

Versions: 77

Compression:

Stored size: 690 Bytes

Contents

require File.join(File.expand_path(File.dirname(__FILE__)), 'test_utils')

include TZInfo

class TCOffsetRationals < Minitest::Test
  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

77 entries across 73 versions & 27 rubygems

Version Path
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/tzinfo-1.2.5/test/tc_offset_rationals.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/tzinfo-1.2.5/test/tc_offset_rationals.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/tzinfo-1.2.5/test/tc_offset_rationals.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/tzinfo-1.2.5/test/tc_offset_rationals.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/tzinfo-1.2.5/test/tc_offset_rationals.rb
spiral_form-0.1.1 vendor/bundle/gems/tzinfo-1.2.5/test/tc_offset_rationals.rb
spiral_form-0.1.0 vendor/bundle/gems/tzinfo-1.2.5/test/tc_offset_rationals.rb
zuora_connect_ui-0.7.1 vendor/ruby/2.6.0/gems/tzinfo-1.2.5/test/tc_offset_rationals.rb
zuora_connect_ui-0.7.0 vendor/ruby/2.6.0/gems/tzinfo-1.2.5/test/tc_offset_rationals.rb
ric-0.13.0 vendor/bundle/ruby/2.5.0/gems/tzinfo-1.2.5/test/tc_offset_rationals.rb
cocoapods-dependency-html-0.0.2 vendor/bundle/gems/tzinfo-1.2.5/test/tc_offset_rationals.rb
cocoapods-dependency-html-0.0.1 vendor/bundle/gems/tzinfo-1.2.5/test/tc_offset_rationals.rb
ric-0.12.2 vendor/bundle/ruby/2.5.0/gems/tzinfo-1.2.5/test/tc_offset_rationals.rb
nullifyable-0.1.0 vendor/bundle/gems/tzinfo-1.2.5/test/tc_offset_rationals.rb
monero_wallet_gen-0.1.0 vendor/bundle/ruby/2.3.0/gems/tzinfo-1.2.5/test/tc_offset_rationals.rb
tdiary-5.0.8 vendor/bundle/gems/tzinfo-1.2.5/test/tc_offset_rationals.rb
tzinfo-1.2.5 test/tc_offset_rationals.rb
pract6-0.1.0 .gem/ruby/2.3.0/gems/tzinfo-1.2.3/test/tc_offset_rationals.rb
tzinfo-1.2.4 test/tc_offset_rationals.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/tzinfo-1.2.2/test/tc_offset_rationals.rb