1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

add tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2010-04-06 14:37:16 +00:00
parent 75ce78429e
commit 2e507f34e0

View file

@ -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