summaryrefslogtreecommitdiff
path: root/test/win32ole
diff options
context:
space:
mode:
authorsuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-21 02:18:37 +0000
committersuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-21 02:18:37 +0000
commit8bb93fc8ae53a541be4aa0c3223f1e505b913386 (patch)
tree010c77cba4a995de1311cf4c2799ba89b7f0cb1f /test/win32ole
parente41fde8b776e299342543a85f315646a25bec194 (diff)
ext/win32ole/win32ole.c (rbtime2vtdate, vtdate2rbtime): fix
the bug in conversion of milliseconds. [Bug #10258] test/win32ole/test_win32ole_variant.rb (test_conversion_dbl2date_with_msec, test_conversion_time2date_with_msec): use assert_in_delta instead of assert_equal to treat an acceptable error range. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/win32ole')
-rw-r--r--test/win32ole/test_win32ole_variant.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/win32ole/test_win32ole_variant.rb b/test/win32ole/test_win32ole_variant.rb
index 8f53dbe..3b6fba7 100644
--- a/test/win32ole/test_win32ole_variant.rb
+++ b/test/win32ole/test_win32ole_variant.rb
@@ -393,7 +393,7 @@ if defined?(WIN32OLE_VARIANT)
obj = WIN32OLE_VARIANT.new(41878.524268391200167, WIN32OLE::VARIANT::VT_DATE)
t = obj.value
assert_equal("2014-08-27 12:34:56", t.strftime('%Y-%m-%d %H:%M:%S'))
- assert_equal(789, (t.nsec / 1000000).round)
+ assert_in_delta(0.789, t.nsec / 1000000000.0, 0.001)
end
def test_conversion_time2date_with_msec
@@ -401,12 +401,12 @@ if defined?(WIN32OLE_VARIANT)
t0 += 0.789
t1 = WIN32OLE_VARIANT.new(t0).value
assert_equal("2014-08-27 12:34:56", t1.strftime('%Y-%m-%d %H:%M:%S'))
- assert_equal(789, (t1.nsec / 1000000).round)
+ assert_in_delta(0.789, t1.nsec / 1000000000.0, 0.001)
t0 = Time.now
t1 = WIN32OLE_VARIANT.new(t0).value
assert_equal(t0.strftime('%Y-%m-%d %H:%M:%S'), t1.strftime('%Y-%m-%d %H:%M:%S'))
- assert_equal(t0.nsec.round(-6), t1.nsec.round(-6))
+ assert_in_delta(t0.nsec/1000000000.0, t1.nsec / 1000000000.0, 0.001)
end
# this test failed because of VariantTimeToSystemTime