summaryrefslogtreecommitdiff
path: root/test/ruby/test_time.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-06 14:37:16 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-06 14:37:16 +0000
commit2e507f34e0518b13fa0aa26d3de5cac7e54ae804 (patch)
treea28b4fd105bdb49926d72624da7ec5739176f4b3 /test/ruby/test_time.rb
parent75ce78429ee220349e3e01aa874e918e1eb1745f (diff)
add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_time.rb')
-rw-r--r--test/ruby/test_time.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb
index cb17f416ee..95d36c597f 100644
--- a/test/ruby/test_time.rb
+++ b/test/ruby/test_time.rb
@@ -183,6 +183,24 @@ class TestTime < Test::Unit::TestCase
assert_equal(-182673138422, t.year)
t = Time.at(-0x6000_0000_0000_0000)
assert_equal(-219207766501, t.year)
+
+ t = Time.at(0).utc
+ assert_equal([1970,1,1, 0,0,0], [t.year, t.mon, t.day, t.hour, t.min, t.sec])
+ t = Time.at(-86400).utc
+ assert_equal([1969,12,31, 0,0,0], [t.year, t.mon, t.day, t.hour, t.min, t.sec])
+ t = Time.at(-86400 * (400 * 365 + 97)).utc
+ assert_equal([1970-400,1,1, 0,0,0], [t.year, t.mon, t.day, t.hour, t.min, t.sec])
+ t = Time.at(-86400 * (400 * 365 + 97)*1000).utc
+ assert_equal([1970-400*1000,1,1, 0,0,0], [t.year, t.mon, t.day, t.hour, t.min, t.sec])
+ t = Time.at(-86400 * (400 * 365 + 97)*2421).utc
+ assert_equal([1970-400*2421,1,1, 0,0,0], [t.year, t.mon, t.day, t.hour, t.min, t.sec])
+ t = Time.at(-86400 * (400 * 365 + 97)*1000000).utc
+ assert_equal([1970-400*1000000,1,1, 0,0,0], [t.year, t.mon, t.day, t.hour, t.min, t.sec])
+
+ t = Time.at(-30613683110400).utc
+ assert_equal([-968139,1,1, 0,0,0], [t.year, t.mon, t.day, t.hour, t.min, t.sec])
+ t = Time.at(-30613683110401).utc
+ assert_equal([-968140,12,31, 23,59,59], [t.year, t.mon, t.day, t.hour, t.min, t.sec])
end
def test_at2