Additional test coverage to DateTime comparison (sub millisecond).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-12-14 04:17:03 +00:00
Родитель b83d68a38f
Коммит cb7076696c
1 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -141,4 +141,13 @@ class TestDate < Test::Unit::TestCase
assert_instance_of(String, d.to_s)
end
def test_submillisecond_comparison
d1 = DateTime.new(2013, 12, 6, 0, 0, Rational(1, 10000))
d2 = DateTime.new(2013, 12, 6, 0, 0, Rational(2, 10000))
# d1 is 0.0001s earlier than d2
assert_equal(-1, d1 <=> d2)
assert_equal(0, d1 <=> d1)
assert_equal(1, d2 <=> d1)
end
end