tzinfo 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of tzinfo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.yardopts +6 -0
- data/{CHANGES → CHANGES.md} +121 -50
- data/{README → README.md} +48 -34
- data/Rakefile +45 -22
- data/lib/tzinfo.rb +7 -2
- data/lib/tzinfo/country.rb +23 -1
- data/lib/tzinfo/country_index_definition.rb +6 -1
- data/lib/tzinfo/country_timezone.rb +9 -1
- data/lib/tzinfo/data_source.rb +26 -5
- data/lib/tzinfo/data_timezone.rb +30 -2
- data/lib/tzinfo/data_timezone_info.rb +26 -0
- data/lib/tzinfo/info_timezone.rb +3 -1
- data/lib/tzinfo/linked_timezone.rb +30 -1
- data/lib/tzinfo/offset_rationals.rb +5 -3
- data/lib/tzinfo/ruby_core_support.rb +2 -0
- data/lib/tzinfo/ruby_country_info.rb +14 -0
- data/lib/tzinfo/ruby_data_source.rb +5 -0
- data/lib/tzinfo/time_or_datetime.rb +16 -1
- data/lib/tzinfo/timezone.rb +107 -5
- data/lib/tzinfo/timezone_definition.rb +5 -1
- data/lib/tzinfo/timezone_index_definition.rb +7 -1
- data/lib/tzinfo/{timezone_offset_info.rb → timezone_offset.rb} +12 -10
- data/lib/tzinfo/timezone_period.rb +19 -15
- data/lib/tzinfo/timezone_proxy.rb +5 -1
- data/lib/tzinfo/timezone_transition.rb +136 -0
- data/lib/tzinfo/{timezone_transition_info.rb → timezone_transition_definition.rb} +21 -57
- data/lib/tzinfo/transition_data_timezone_info.rb +81 -8
- data/lib/tzinfo/zoneinfo_country_info.rb +7 -0
- data/lib/tzinfo/zoneinfo_data_source.rb +104 -57
- data/lib/tzinfo/zoneinfo_timezone_info.rb +18 -10
- data/test/tc_country.rb +39 -1
- data/test/tc_data_timezone.rb +28 -5
- data/test/tc_linked_timezone.rb +24 -3
- data/test/tc_ruby_data_source.rb +22 -2
- data/test/tc_time_or_datetime.rb +3 -3
- data/test/tc_timezone.rb +364 -117
- data/test/tc_timezone_london.rb +25 -0
- data/test/tc_timezone_melbourne.rb +24 -0
- data/test/tc_timezone_new_york.rb +24 -0
- data/test/{tc_timezone_offset_info.rb → tc_timezone_offset.rb} +27 -27
- data/test/tc_timezone_period.rb +113 -90
- data/test/tc_timezone_transition.rb +374 -0
- data/test/tc_timezone_transition_definition.rb +306 -0
- data/test/tc_transition_data_timezone_info.rb +143 -43
- data/test/tc_zoneinfo_data_source.rb +69 -5
- data/test/tc_zoneinfo_timezone_info.rb +63 -20
- data/test/test_utils.rb +27 -7
- data/tzinfo.gemspec +21 -0
- metadata +61 -38
- metadata.gz.sig +3 -0
- data/test/tc_timezone_transition_info.rb +0 -471
- data/test/zoneinfo/UTC +0 -0
- data/test/zoneinfo/localtime +0 -0
data/test/test_utils.rb
CHANGED
@@ -74,11 +74,13 @@ module Kernel
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
-
def safe_test(
|
78
|
-
#
|
79
|
-
|
77
|
+
def safe_test(options = {})
|
78
|
+
# JRuby and Rubinus don't support SAFE levels.
|
79
|
+
available = !(defined?(RUBY_ENGINE) && %w(jruby rbx).include?(RUBY_ENGINE))
|
80
|
+
|
81
|
+
if available || options[:unavailable] != :skip
|
80
82
|
thread = Thread.new do
|
81
|
-
$SAFE = level
|
83
|
+
$SAFE = options[:level] || 1 if available
|
82
84
|
yield
|
83
85
|
end
|
84
86
|
|
@@ -99,11 +101,29 @@ module Kernel
|
|
99
101
|
RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT'])
|
100
102
|
|
101
103
|
load_path = [TZINFO_LIB_DIR] + extra_load_path
|
102
|
-
load_path = load_path.collect {|p| "-I \"#{p}\""}.join(' ')
|
103
104
|
|
104
|
-
|
105
|
+
# If RubyGems is loaded in the current process, then require it in the
|
106
|
+
# sub-process, as it may be needed in order to require dependencies.
|
107
|
+
if defined?(Gem) && Gem.instance_of?(Module)
|
108
|
+
required = ['rubygems'] + required
|
109
|
+
end
|
110
|
+
|
111
|
+
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
|
112
|
+
# Stop Rubinus from operating as irb.
|
113
|
+
args = ' -'
|
114
|
+
else
|
115
|
+
args = ''
|
116
|
+
end
|
117
|
+
|
118
|
+
IO.popen("\"#{ruby}\"#{args}", 'r+') do |process|
|
119
|
+
load_path.each do |p|
|
120
|
+
process.puts("$:.unshift('#{p.gsub("'", "\\\\'")}')")
|
121
|
+
end
|
122
|
+
|
123
|
+
required.each do |r|
|
124
|
+
process.puts("require '#{r.gsub("'", "\\\\'")}'")
|
125
|
+
end
|
105
126
|
|
106
|
-
IO.popen("\"#{ruby}\" #{load_path} #{required}", 'r+') do |process|
|
107
127
|
process.puts(code)
|
108
128
|
process.flush
|
109
129
|
process.close_write
|
data/tzinfo.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'tzinfo'
|
3
|
+
s.version = '1.1.0'
|
4
|
+
s.summary = 'Daylight savings aware timezone library'
|
5
|
+
s.description = 'TZInfo provides daylight savings aware transformations between times in different time zones.'
|
6
|
+
s.author = 'Philip Ross'
|
7
|
+
s.email = 'phil.ross@gmail.com'
|
8
|
+
s.homepage = 'http://tzinfo.github.io'
|
9
|
+
s.license = 'MIT'
|
10
|
+
s.files = %w(CHANGES.md LICENSE Rakefile README.md tzinfo.gemspec .yardopts) +
|
11
|
+
Dir['lib/**/*.rb'].delete_if {|f| f.include?('.svn')} +
|
12
|
+
Dir['test/**/*.rb'].delete_if {|f| f.include?('.svn')} +
|
13
|
+
Dir['test/zoneinfo/**/*'].delete_if {|f| f.include?('.svn') || File.symlink?(f)}
|
14
|
+
s.platform = Gem::Platform::RUBY
|
15
|
+
s.require_path = 'lib'
|
16
|
+
s.rdoc_options << '--title' << 'TZInfo' <<
|
17
|
+
'--main' << 'README.md'
|
18
|
+
s.extra_rdoc_files = ['README.md', 'CHANGES.md', 'LICENSE']
|
19
|
+
s.required_ruby_version = '>= 1.8.6'
|
20
|
+
s.add_dependency 'thread_safe', '~> 0.1'
|
21
|
+
end
|
metadata
CHANGED
@@ -1,42 +1,80 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tzinfo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philip Ross
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
|
12
|
-
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDdDCCAlygAwIBAgIBATANBgkqhkiG9w0BAQUFADBAMRIwEAYDVQQDDAlwaGls
|
14
|
+
LnJvc3MxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
15
|
+
bTAeFw0xMzA5MjUyMTA0NTNaFw0xNDA5MjUyMTA0NTNaMEAxEjAQBgNVBAMMCXBo
|
16
|
+
aWwucm9zczEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYD
|
17
|
+
Y29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkZzB+qfhmyY+XRvU
|
18
|
+
u310LMTGsTkR4/8JFCMF0YeQX6ZKmLr1fKzF3At1+DlI+v0t/G2FS6Dic0V3l8MK
|
19
|
+
JczyFh72NANOaQhAo0GHh8WkaeCf2DLL5K6YJeLpvkvp39oxzn00A4zosnzxM50f
|
20
|
+
Xrjx2HmurcJQurzafeCDj67QccaNE+5H+mcIVAJlsA1h1f5QFZ3SqQ4mf8St40pE
|
21
|
+
6YR4ev/Eq6Hb8aUoUq30otxbeHAEHh8cdVhTNFq7sPWb0psQRF2D/+o0MLgHt8PY
|
22
|
+
EUm49szlLsnjVXAMCHU7wH9CmDR/5Lzcrgqh3DgyI8ay6DnlSQ213eYZH/Nkn1Yz
|
23
|
+
TcNLCQIDAQABo3kwdzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU
|
24
|
+
D5nzO9/MG4B6ygch/Pv6PF9Q5x8wHgYDVR0RBBcwFYETcGhpbC5yb3NzQGdtYWls
|
25
|
+
LmNvbTAeBgNVHRIEFzAVgRNwaGlsLnJvc3NAZ21haWwuY29tMA0GCSqGSIb3DQEB
|
26
|
+
BQUAA4IBAQAKZJXA++aLjISMKZea4PmXuH93YbMxoyBby3SRfwvLh7cBMEiCy5fu
|
27
|
+
xYR46qa9ixC6JyVuxAWA2AGHLOqabKkq6AxntqIk1OAnZGBNRuCnLYzSx+6YDjaY
|
28
|
+
ZcAmqPdS0Adj+1lNc+MgHiMrMLimNO4Cur4w4zYNZFvQan78WtLnwiaYPM2Tke1B
|
29
|
+
UVjGvQVkM6gVIVH3937au2iHpJAehbhkEbgM02knNemiNwi58j7pMS9MhelxJxdz
|
30
|
+
fs7XSYlwQp0zY7PFSMwJeBpQFDBnShcweRQ+0QdUUS4FHrwfXex0QsXp9UROUX+4
|
31
|
+
6BVw9ZDNFnDH4PQjZGbdwanB7kzm+TEi
|
32
|
+
-----END CERTIFICATE-----
|
33
|
+
date: 2013-09-25 00:00:00.000000000 Z
|
34
|
+
dependencies:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: thread_safe
|
37
|
+
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ~>
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0.1'
|
42
|
+
type: :runtime
|
43
|
+
prerelease: false
|
44
|
+
version_requirements: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ~>
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0.1'
|
13
49
|
description: TZInfo provides daylight savings aware transformations between times
|
14
50
|
in different time zones.
|
15
51
|
email: phil.ross@gmail.com
|
16
52
|
executables: []
|
17
53
|
extensions: []
|
18
54
|
extra_rdoc_files:
|
19
|
-
- README
|
20
|
-
- CHANGES
|
55
|
+
- README.md
|
56
|
+
- CHANGES.md
|
21
57
|
- LICENSE
|
22
58
|
files:
|
23
|
-
- CHANGES
|
59
|
+
- CHANGES.md
|
24
60
|
- LICENSE
|
25
61
|
- Rakefile
|
26
|
-
- README
|
62
|
+
- README.md
|
63
|
+
- tzinfo.gemspec
|
64
|
+
- .yardopts
|
27
65
|
- lib/tzinfo.rb
|
28
66
|
- lib/tzinfo/info_timezone.rb
|
29
67
|
- lib/tzinfo/timezone_info.rb
|
30
|
-
- lib/tzinfo/timezone_offset_info.rb
|
31
68
|
- lib/tzinfo/data_timezone.rb
|
32
69
|
- lib/tzinfo/ruby_data_source.rb
|
33
70
|
- lib/tzinfo/timezone_period.rb
|
71
|
+
- lib/tzinfo/timezone_transition_definition.rb
|
34
72
|
- lib/tzinfo/country_timezone.rb
|
35
73
|
- lib/tzinfo/ruby_country_info.rb
|
36
74
|
- lib/tzinfo/linked_timezone.rb
|
37
75
|
- lib/tzinfo/data_source.rb
|
38
76
|
- lib/tzinfo/country.rb
|
39
|
-
- lib/tzinfo/
|
77
|
+
- lib/tzinfo/timezone_transition.rb
|
40
78
|
- lib/tzinfo/data_timezone_info.rb
|
41
79
|
- lib/tzinfo/zoneinfo_timezone_info.rb
|
42
80
|
- lib/tzinfo/country_index_definition.rb
|
@@ -48,11 +86,13 @@ files:
|
|
48
86
|
- lib/tzinfo/transition_data_timezone_info.rb
|
49
87
|
- lib/tzinfo/timezone_index_definition.rb
|
50
88
|
- lib/tzinfo/timezone_proxy.rb
|
89
|
+
- lib/tzinfo/timezone_offset.rb
|
51
90
|
- lib/tzinfo/linked_timezone_info.rb
|
52
91
|
- lib/tzinfo/country_info.rb
|
53
92
|
- lib/tzinfo/offset_rationals.rb
|
54
93
|
- lib/tzinfo/zoneinfo_country_info.rb
|
55
94
|
- test/tc_info_timezone.rb
|
95
|
+
- test/tc_timezone_transition_definition.rb
|
56
96
|
- test/tc_data_source.rb
|
57
97
|
- test/test_utils.rb
|
58
98
|
- test/tc_timezone.rb
|
@@ -66,7 +106,7 @@ files:
|
|
66
106
|
- test/tc_ruby_data_source.rb
|
67
107
|
- test/tc_timezone_period.rb
|
68
108
|
- test/tc_country_timezone.rb
|
69
|
-
- test/
|
109
|
+
- test/tc_timezone_offset.rb
|
70
110
|
- test/tc_ruby_core_support.rb
|
71
111
|
- test/tc_country_index_definition.rb
|
72
112
|
- test/tc_timezone_melbourne.rb
|
@@ -88,7 +128,6 @@ files:
|
|
88
128
|
- test/tzinfo-data/tzinfo/data/version.rb
|
89
129
|
- test/tzinfo-data/tzinfo/data/indexes/timezones.rb
|
90
130
|
- test/tzinfo-data/tzinfo/data/indexes/countries.rb
|
91
|
-
- test/tc_timezone_offset_info.rb
|
92
131
|
- test/tc_time_or_datetime.rb
|
93
132
|
- test/tc_country.rb
|
94
133
|
- test/tc_zoneinfo_timezone_info.rb
|
@@ -102,12 +141,12 @@ files:
|
|
102
141
|
- test/tc_timezone_new_york.rb
|
103
142
|
- test/tc_timezone_proxy.rb
|
104
143
|
- test/tc_linked_timezone.rb
|
144
|
+
- test/tc_timezone_transition.rb
|
105
145
|
- test/tc_data_timezone.rb
|
106
|
-
- test/
|
146
|
+
- test/tc_country_info.rb
|
107
147
|
- test/zoneinfo/right/Europe/London
|
108
148
|
- test/zoneinfo/EST
|
109
149
|
- test/zoneinfo/Etc/UTC
|
110
|
-
- test/zoneinfo/UTC
|
111
150
|
- test/zoneinfo/Australia/Melbourne
|
112
151
|
- test/zoneinfo/zone.tab
|
113
152
|
- test/zoneinfo/Europe/Prague
|
@@ -121,32 +160,16 @@ files:
|
|
121
160
|
- test/zoneinfo/posix/Europe/London
|
122
161
|
- test/zoneinfo/iso3166.tab
|
123
162
|
- test/zoneinfo/posixrules
|
124
|
-
|
125
|
-
homepage: http://tzinfo.rubyforge.org
|
163
|
+
homepage: http://tzinfo.github.io
|
126
164
|
licenses:
|
127
165
|
- MIT
|
128
166
|
metadata: {}
|
129
|
-
post_install_message:
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
moved to a separate tzinfo-data gem. TZInfo also now supports using the system
|
136
|
-
zoneinfo files on Linux, Mac OS X and other Unix-like operating systems.
|
137
|
-
|
138
|
-
If you want to continue using the Ruby timezone modules, or you are using an
|
139
|
-
operating system that does not include zoneinfo files (such as
|
140
|
-
Microsoft Windows), you will need to install tzinfo-data by running:
|
141
|
-
|
142
|
-
gem install tzinfo-data
|
143
|
-
|
144
|
-
If tzinfo-data is installed then TZInfo will use the Ruby timezone modules.
|
145
|
-
Otherwise, it will attempt to find the system zoneinfo files. Please refer to
|
146
|
-
the TZInfo documentation (available from https://rubygems.org/gems/tzinfo) for
|
147
|
-
further information.
|
148
|
-
|
149
|
-
rdoc_options: []
|
167
|
+
post_install_message:
|
168
|
+
rdoc_options:
|
169
|
+
- --title
|
170
|
+
- TZInfo
|
171
|
+
- --main
|
172
|
+
- README.md
|
150
173
|
require_paths:
|
151
174
|
- lib
|
152
175
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -161,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
184
|
version: '0'
|
162
185
|
requirements: []
|
163
186
|
rubyforge_project:
|
164
|
-
rubygems_version: 2.
|
187
|
+
rubygems_version: 2.1.4
|
165
188
|
signing_key:
|
166
189
|
specification_version: 4
|
167
190
|
summary: Daylight savings aware timezone library
|
metadata.gz.sig
ADDED
@@ -1,471 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright (c) 2005-2013 Philip Ross
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
-
# of this software and associated documentation files (the "Software"), to deal
|
6
|
-
# in the Software without restriction, including without limitation the rights
|
7
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the Software is
|
9
|
-
# furnished to do so, subject to the following conditions:
|
10
|
-
#
|
11
|
-
# The above copyright notice and this permission notice shall be included in all
|
12
|
-
# copies or substantial portions of the Software.
|
13
|
-
#
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
-
# THE SOFTWARE.
|
21
|
-
#++
|
22
|
-
|
23
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), 'test_utils')
|
24
|
-
require 'date'
|
25
|
-
|
26
|
-
include TZInfo
|
27
|
-
|
28
|
-
class TCTimezoneTransitionInfo < Test::Unit::TestCase
|
29
|
-
|
30
|
-
def test_initialize_timestamp_only
|
31
|
-
assert_nothing_raised do
|
32
|
-
TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
33
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_initialize_timestamp_and_datetime
|
38
|
-
assert_nothing_raised do
|
39
|
-
TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
40
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080, 5300392727, 2160)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_initialize_datetime_only
|
45
|
-
assert_nothing_raised do
|
46
|
-
TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
47
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 5300392727, 2160)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_offset
|
52
|
-
t = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
53
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080)
|
54
|
-
|
55
|
-
assert_equal(TimezoneOffsetInfo.new(3600, 3600, :TDT), t.offset)
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_previous_offset
|
59
|
-
t = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
60
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080)
|
61
|
-
|
62
|
-
assert_equal(TimezoneOffsetInfo.new(3600, 0, :TST), t.previous_offset)
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_at
|
66
|
-
t1 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
67
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080)
|
68
|
-
t2 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
69
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 5300392727, 2160)
|
70
|
-
t3 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
71
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080, 5300392727, 2160)
|
72
|
-
|
73
|
-
assert(TimeOrDateTime.new(1148949080).eql?(t1.at))
|
74
|
-
assert(TimeOrDateTime.new(DateTime.new(2006, 5, 30, 0, 31, 20)).eql?(t2.at))
|
75
|
-
assert(TimeOrDateTime.new(1148949080).eql?(t3.at))
|
76
|
-
end
|
77
|
-
|
78
|
-
def test_local_end
|
79
|
-
t1 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
80
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080)
|
81
|
-
t2 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
82
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 5300392727, 2160)
|
83
|
-
t3 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
84
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080, 5300392727, 2160)
|
85
|
-
|
86
|
-
assert(TimeOrDateTime.new(1148952680).eql?(t1.local_end))
|
87
|
-
assert(TimeOrDateTime.new(DateTime.new(2006, 5, 30, 1, 31, 20)).eql?(t2.local_end))
|
88
|
-
assert(TimeOrDateTime.new(1148952680).eql?(t3.local_end))
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_local_start
|
92
|
-
t1 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
93
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080)
|
94
|
-
t2 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
95
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 5300392727, 2160)
|
96
|
-
t3 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
97
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080, 5300392727, 2160)
|
98
|
-
|
99
|
-
assert(TimeOrDateTime.new(1148956280).eql?(t1.local_start))
|
100
|
-
assert(TimeOrDateTime.new(DateTime.new(2006, 5, 30, 2, 31, 20)).eql?(t2.local_start))
|
101
|
-
assert(TimeOrDateTime.new(1148956280).eql?(t3.local_start))
|
102
|
-
end
|
103
|
-
|
104
|
-
def test_at_before_negative_32_bit
|
105
|
-
t = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
106
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), -2147483649, 69573092117, 28800)
|
107
|
-
|
108
|
-
if RubyCoreSupport.time_supports_negative && RubyCoreSupport.time_supports_64bit
|
109
|
-
assert(TimeOrDateTime.new(-2147483649).eql?(t.at))
|
110
|
-
else
|
111
|
-
assert(TimeOrDateTime.new(DateTime.new(1901, 12, 13, 20, 45, 51)).eql?(t.at))
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_local_end_before_negative_32bit
|
116
|
-
t = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(-7200, 3600, :TDT),
|
117
|
-
TimezoneOffsetInfo.new(-7200, 0, :TST), -2147482800, 19325859, 8)
|
118
|
-
|
119
|
-
if RubyCoreSupport.time_supports_negative && RubyCoreSupport.time_supports_64bit
|
120
|
-
assert(TimeOrDateTime.new(-2147490000).eql?(t.local_end))
|
121
|
-
else
|
122
|
-
assert(TimeOrDateTime.new(DateTime.new(1901, 12, 13, 19, 0, 0)).eql?(t.local_end))
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
def test_local_start_before_negative_32bit
|
127
|
-
t = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(-7200, 3600, :TDT),
|
128
|
-
TimezoneOffsetInfo.new(-7200, 0, :TST), -2147482800, 19325859, 8)
|
129
|
-
|
130
|
-
if RubyCoreSupport.time_supports_negative && RubyCoreSupport.time_supports_64bit
|
131
|
-
assert(TimeOrDateTime.new(-2147486400).eql?(t.local_start))
|
132
|
-
else
|
133
|
-
assert(TimeOrDateTime.new(DateTime.new(1901, 12, 13, 20, 0, 0)).eql?(t.local_start))
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
def test_at_before_epoch
|
138
|
-
t = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
139
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), -1, 210866759999, 86400)
|
140
|
-
|
141
|
-
if RubyCoreSupport.time_supports_negative
|
142
|
-
assert(TimeOrDateTime.new(-1).eql?(t.at))
|
143
|
-
else
|
144
|
-
assert(TimeOrDateTime.new(DateTime.new(1969, 12, 31, 23, 59, 59)).eql?(t.at))
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
def test_local_end_before_epoch
|
149
|
-
t = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(-7200, 3600, :TDT),
|
150
|
-
TimezoneOffsetInfo.new(-7200, 0, :TST), 1800, 39049401, 16)
|
151
|
-
|
152
|
-
if RubyCoreSupport.time_supports_negative
|
153
|
-
assert(TimeOrDateTime.new(-5400).eql?(t.local_end))
|
154
|
-
else
|
155
|
-
assert(TimeOrDateTime.new(DateTime.new(1969, 12, 31, 22, 30, 0)).eql?(t.local_end))
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
def test_local_start_before_epoch
|
160
|
-
t = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(-7200, 3600, :TDT),
|
161
|
-
TimezoneOffsetInfo.new(-7200, 0, :TST), 1800, 39049401, 16)
|
162
|
-
|
163
|
-
if RubyCoreSupport.time_supports_negative
|
164
|
-
assert(TimeOrDateTime.new(-1800).eql?(t.local_start))
|
165
|
-
else
|
166
|
-
assert(TimeOrDateTime.new(DateTime.new(1969, 12, 31, 23, 30, 0)).eql?(t.local_start))
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
def test_at_after_32bit
|
171
|
-
t = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
172
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 2147483648, 3328347557, 1350)
|
173
|
-
|
174
|
-
if RubyCoreSupport.time_supports_64bit
|
175
|
-
assert(TimeOrDateTime.new(2147483648).eql?(t.at))
|
176
|
-
else
|
177
|
-
assert(TimeOrDateTime.new(DateTime.new(2038, 1, 19, 3, 14, 8)).eql?(t.at))
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
def test_local_end_after_32bit
|
182
|
-
t = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
183
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 2147482800, 19723541, 8)
|
184
|
-
|
185
|
-
if RubyCoreSupport.time_supports_64bit
|
186
|
-
assert(TimeOrDateTime.new(2147486400).eql?(t.local_end))
|
187
|
-
else
|
188
|
-
assert(TimeOrDateTime.new(DateTime.new(2038, 1, 19, 4, 0, 0)).eql?(t.local_end))
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
def test_local_start_after_32bit
|
193
|
-
t = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
194
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 2147482800, 19723541, 8)
|
195
|
-
|
196
|
-
if RubyCoreSupport.time_supports_64bit
|
197
|
-
assert(TimeOrDateTime.new(2147490000).eql?(t.local_start))
|
198
|
-
else
|
199
|
-
assert(TimeOrDateTime.new(DateTime.new(2038, 1, 19, 5, 0, 0)).eql?(t.local_start))
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
def test_equality_timestamp
|
204
|
-
t1 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
205
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080)
|
206
|
-
t2 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
207
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080)
|
208
|
-
t3 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
209
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 5300392727, 2160)
|
210
|
-
t4 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
211
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080, 5300392727, 2160)
|
212
|
-
t5 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
213
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949081)
|
214
|
-
t6 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
215
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 7852433803, 3200)
|
216
|
-
t7 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3601, 3600, :TDT),
|
217
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080)
|
218
|
-
t8 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
219
|
-
TimezoneOffsetInfo.new(3601, 0, :TST), 1148949080)
|
220
|
-
|
221
|
-
assert_equal(true, t1 == t1)
|
222
|
-
assert_equal(true, t1 == t2)
|
223
|
-
assert_equal(true, t1 == t3)
|
224
|
-
assert_equal(true, t1 == t4)
|
225
|
-
assert_equal(false, t1 == t5)
|
226
|
-
assert_equal(false, t1 == t6)
|
227
|
-
assert_equal(false, t1 == t7)
|
228
|
-
assert_equal(false, t1 == t8)
|
229
|
-
assert_equal(false, t1 == Object.new)
|
230
|
-
end
|
231
|
-
|
232
|
-
def test_equality_datetime
|
233
|
-
t1 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
234
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 5300392727, 2160)
|
235
|
-
t2 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
236
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 5300392727, 2160)
|
237
|
-
t3 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
238
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080)
|
239
|
-
t4 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
240
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080, 5300392727, 2160)
|
241
|
-
t5 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
242
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 7852433803, 3200)
|
243
|
-
t6 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
244
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949081)
|
245
|
-
t7 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3601, 3600, :TDT),
|
246
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 5300392727, 2160)
|
247
|
-
t8 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
248
|
-
TimezoneOffsetInfo.new(3601, 0, :TST), 5300392727, 2160)
|
249
|
-
|
250
|
-
assert_equal(true, t1 == t1)
|
251
|
-
assert_equal(true, t1 == t2)
|
252
|
-
assert_equal(true, t1 == t3)
|
253
|
-
assert_equal(true, t1 == t4)
|
254
|
-
assert_equal(false, t1 == t5)
|
255
|
-
assert_equal(false, t1 == t6)
|
256
|
-
assert_equal(false, t1 == t7)
|
257
|
-
assert_equal(false, t1 == t8)
|
258
|
-
assert_equal(false, t1 == Object.new)
|
259
|
-
end
|
260
|
-
|
261
|
-
def test_eql_timestamp
|
262
|
-
t1 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
263
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080)
|
264
|
-
t2 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
265
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080)
|
266
|
-
t3 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
267
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 5300392727, 2160)
|
268
|
-
t4 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
269
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080, 5300392727, 2160)
|
270
|
-
t5 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
271
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949081)
|
272
|
-
t6 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3601, 3600, :TDT),
|
273
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080)
|
274
|
-
t7 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
275
|
-
TimezoneOffsetInfo.new(3601, 0, :TST), 1148949080)
|
276
|
-
|
277
|
-
assert_equal(true, t1.eql?(t1))
|
278
|
-
assert_equal(true, t1.eql?(t2))
|
279
|
-
assert_equal(false, t1.eql?(t3))
|
280
|
-
assert_equal(true, t1.eql?(t4))
|
281
|
-
assert_equal(false, t1.eql?(t5))
|
282
|
-
assert_equal(false, t1.eql?(t6))
|
283
|
-
assert_equal(false, t1.eql?(t7))
|
284
|
-
assert_equal(false, t1.eql?(Object.new))
|
285
|
-
end
|
286
|
-
|
287
|
-
def test_eql_datetime
|
288
|
-
t1 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
289
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 5300392727, 2160)
|
290
|
-
t2 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
291
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 5300392727, 2160)
|
292
|
-
t3 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
293
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080)
|
294
|
-
t4 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
295
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080, 5300392727, 2160)
|
296
|
-
t5 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
297
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 7852433803, 3200)
|
298
|
-
t6 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3601, 3600, :TDT),
|
299
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 5300392727, 2160)
|
300
|
-
t7 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
301
|
-
TimezoneOffsetInfo.new(3601, 0, :TST), 5300392727, 2160)
|
302
|
-
|
303
|
-
assert_equal(true, t1.eql?(t1))
|
304
|
-
assert_equal(true, t1.eql?(t2))
|
305
|
-
assert_equal(false, t1.eql?(t3))
|
306
|
-
assert_equal(false, t1.eql?(t4))
|
307
|
-
assert_equal(false, t1.eql?(t5))
|
308
|
-
assert_equal(false, t1.eql?(t6))
|
309
|
-
assert_equal(false, t1.eql?(t7))
|
310
|
-
assert_equal(false, t1.eql?(Object.new))
|
311
|
-
end
|
312
|
-
|
313
|
-
def test_eql_timestamp_and_datetime
|
314
|
-
t1 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
315
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080, 5300392727, 2160)
|
316
|
-
t2 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
317
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080, 5300392727, 2160)
|
318
|
-
t3 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
319
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080)
|
320
|
-
t4 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
321
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 5300392727, 2160)
|
322
|
-
t5 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
323
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148952681, 7852433803, 3200)
|
324
|
-
t6 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3601, 3600, :TDT),
|
325
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080, 5300392727, 2160)
|
326
|
-
t7 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
327
|
-
TimezoneOffsetInfo.new(3601, 0, :TST), 1148949080, 5300392727, 2160)
|
328
|
-
|
329
|
-
assert_equal(true, t1.eql?(t1))
|
330
|
-
assert_equal(true, t1.eql?(t2))
|
331
|
-
assert_equal(true, t1.eql?(t3))
|
332
|
-
assert_equal(false, t1.eql?(t4))
|
333
|
-
assert_equal(false, t1.eql?(t5))
|
334
|
-
assert_equal(false, t1.eql?(t6))
|
335
|
-
assert_equal(false, t1.eql?(t7))
|
336
|
-
assert_equal(false, t1.eql?(Object.new))
|
337
|
-
end
|
338
|
-
|
339
|
-
def test_eql_timestamp_and_datetime_before_negative_32bit
|
340
|
-
t1 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
341
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), -2147483649, 69573092117, 28800)
|
342
|
-
t2 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
343
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), -2147483649, 69573092117, 28800)
|
344
|
-
t3 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
345
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), -2147483649)
|
346
|
-
t4 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
347
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 69573092117, 28800)
|
348
|
-
|
349
|
-
assert_equal(true, t1.eql?(t1))
|
350
|
-
assert_equal(true, t1.eql?(t2))
|
351
|
-
|
352
|
-
if RubyCoreSupport.time_supports_negative && RubyCoreSupport.time_supports_64bit
|
353
|
-
assert_equal(true, t1.eql?(t3))
|
354
|
-
assert_equal(false, t1.eql?(t4))
|
355
|
-
assert_equal(true, t3.eql?(t1))
|
356
|
-
assert_equal(false, t4.eql?(t1))
|
357
|
-
else
|
358
|
-
assert_equal(false, t1.eql?(t3))
|
359
|
-
assert_equal(true, t1.eql?(t4))
|
360
|
-
assert_equal(false, t3.eql?(t1))
|
361
|
-
assert_equal(true, t4.eql?(t1))
|
362
|
-
end
|
363
|
-
end
|
364
|
-
|
365
|
-
def test_eql_timestamp_and_datetime_before_epoch
|
366
|
-
t1 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
367
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), -1, 210866759999, 86400)
|
368
|
-
t2 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
369
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), -1, 210866759999, 86400)
|
370
|
-
t3 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
371
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), -1)
|
372
|
-
t4 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
373
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 210866759999, 86400)
|
374
|
-
|
375
|
-
assert_equal(true, t1.eql?(t1))
|
376
|
-
assert_equal(true, t1.eql?(t2))
|
377
|
-
|
378
|
-
if RubyCoreSupport.time_supports_negative
|
379
|
-
assert_equal(true, t1.eql?(t3))
|
380
|
-
assert_equal(false, t1.eql?(t4))
|
381
|
-
assert_equal(true, t3.eql?(t1))
|
382
|
-
assert_equal(false, t4.eql?(t1))
|
383
|
-
else
|
384
|
-
assert_equal(false, t1.eql?(t3))
|
385
|
-
assert_equal(true, t1.eql?(t4))
|
386
|
-
assert_equal(false, t3.eql?(t1))
|
387
|
-
assert_equal(true, t4.eql?(t1))
|
388
|
-
end
|
389
|
-
end
|
390
|
-
|
391
|
-
def test_eql_timestamp_and_datetime_after_32bit
|
392
|
-
t1 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
393
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 2147483648, 3328347557, 1350)
|
394
|
-
t2 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
395
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 2147483648, 3328347557, 1350)
|
396
|
-
t3 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
397
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 2147483648)
|
398
|
-
t4 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
399
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 3328347557, 1350)
|
400
|
-
|
401
|
-
assert_equal(true, t1.eql?(t1))
|
402
|
-
assert_equal(true, t1.eql?(t2))
|
403
|
-
|
404
|
-
if RubyCoreSupport.time_supports_64bit
|
405
|
-
assert_equal(true, t1.eql?(t3))
|
406
|
-
assert_equal(false, t1.eql?(t4))
|
407
|
-
assert_equal(true, t3.eql?(t1))
|
408
|
-
assert_equal(false, t4.eql?(t1))
|
409
|
-
else
|
410
|
-
assert_equal(false, t1.eql?(t3))
|
411
|
-
assert_equal(true, t1.eql?(t4))
|
412
|
-
assert_equal(false, t3.eql?(t1))
|
413
|
-
assert_equal(true, t4.eql?(t1))
|
414
|
-
end
|
415
|
-
end
|
416
|
-
|
417
|
-
def test_hash
|
418
|
-
t1 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
419
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080)
|
420
|
-
t2 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
421
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 5300392727, 2160)
|
422
|
-
t3 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
423
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 1148949080, 5300392727, 2160)
|
424
|
-
t4 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
425
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), -2147483649, 69573092117, 28800)
|
426
|
-
t5 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
427
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), -1, 210866759999, 86400)
|
428
|
-
t6 = TimezoneTransitionInfo.new(TimezoneOffsetInfo.new(3600, 3600, :TDT),
|
429
|
-
TimezoneOffsetInfo.new(3600, 0, :TST), 2147483648, 3328347557, 1350)
|
430
|
-
|
431
|
-
assert_equal(TimezoneOffsetInfo.new(3600, 3600, :TDT).hash ^
|
432
|
-
TimezoneOffsetInfo.new(3600, 0, :TST).hash ^ 1148949080.hash ^ nil.hash,
|
433
|
-
t1.hash)
|
434
|
-
assert_equal(TimezoneOffsetInfo.new(3600, 3600, :TDT).hash ^
|
435
|
-
TimezoneOffsetInfo.new(3600, 0, :TST).hash ^ 5300392727.hash ^ 2160.hash,
|
436
|
-
t2.hash)
|
437
|
-
assert_equal(TimezoneOffsetInfo.new(3600, 3600, :TDT).hash ^
|
438
|
-
TimezoneOffsetInfo.new(3600, 0, :TST).hash ^ 1148949080.hash ^ nil.hash,
|
439
|
-
t3.hash)
|
440
|
-
|
441
|
-
if RubyCoreSupport.time_supports_negative && RubyCoreSupport.time_supports_64bit
|
442
|
-
assert_equal(TimezoneOffsetInfo.new(3600, 3600, :TDT).hash ^
|
443
|
-
TimezoneOffsetInfo.new(3600, 0, :TST).hash ^ -2147483649.hash ^ nil.hash,
|
444
|
-
t4.hash)
|
445
|
-
else
|
446
|
-
assert_equal(TimezoneOffsetInfo.new(3600, 3600, :TDT).hash ^
|
447
|
-
TimezoneOffsetInfo.new(3600, 0, :TST).hash ^ 69573092117.hash ^ 28800.hash,
|
448
|
-
t4.hash)
|
449
|
-
end
|
450
|
-
|
451
|
-
if RubyCoreSupport.time_supports_negative
|
452
|
-
assert_equal(TimezoneOffsetInfo.new(3600, 3600, :TDT).hash ^
|
453
|
-
TimezoneOffsetInfo.new(3600, 0, :TST).hash ^ -1.hash ^ nil.hash,
|
454
|
-
t5.hash)
|
455
|
-
else
|
456
|
-
assert_equal(TimezoneOffsetInfo.new(3600, 3600, :TDT).hash ^
|
457
|
-
TimezoneOffsetInfo.new(3600, 0, :TST).hash ^ 210866759999.hash ^ 86400.hash,
|
458
|
-
t5.hash)
|
459
|
-
end
|
460
|
-
|
461
|
-
if RubyCoreSupport.time_supports_64bit
|
462
|
-
assert_equal(TimezoneOffsetInfo.new(3600, 3600, :TDT).hash ^
|
463
|
-
TimezoneOffsetInfo.new(3600, 0, :TST).hash ^ 2147483648.hash ^ nil.hash,
|
464
|
-
t6.hash)
|
465
|
-
else
|
466
|
-
assert_equal(TimezoneOffsetInfo.new(3600, 3600, :TDT).hash ^
|
467
|
-
TimezoneOffsetInfo.new(3600, 0, :TST).hash ^ 3328347557.hash ^ 1350.hash,
|
468
|
-
t6.hash)
|
469
|
-
end
|
470
|
-
end
|
471
|
-
end
|