diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-14 04:17:03 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-14 04:17:03 +0000 |
commit | cb7076696c269668a981315b89630a2d5f2b88ae (patch) | |
tree | e6bd2649a2626e96aae711ad6271eb9ca3629525 | |
parent | b83d68a38fcc4d1e499bc7c52a96499fbecb0681 (diff) | |
download | ruby-cb7076696c269668a981315b89630a2d5f2b88ae.tar.gz |
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
-rw-r--r-- | test/date/test_date.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/date/test_date.rb b/test/date/test_date.rb index 86790e4cde..3fdf793e84 100644 --- a/test/date/test_date.rb +++ b/test/date/test_date.rb @@ -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 |