mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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:
parent
b83d68a38f
commit
cb7076696c
1 changed files with 9 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue