aboutsummaryrefslogtreecommitdiffhomepage
path: root/ruby/tests
diff options
context:
space:
mode:
authorGravatar Andreas Eger <dev@eger-andreas.de>2017-05-13 22:20:45 +0200
committerGravatar Andreas Eger <dev@eger-andreas.de>2017-05-13 22:20:45 +0200
commit78cb804063716767966cdcd86c66500df342ad33 (patch)
tree977b532a1afe498fe81cc234d48ca32af2302623 /ruby/tests
parentad203bcb2be17e06909ab6d67ab2475673673bbc (diff)
change test for nanosecond accurate timestamps
Diffstat (limited to 'ruby/tests')
-rw-r--r--ruby/tests/well_known_types_test.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/ruby/tests/well_known_types_test.rb b/ruby/tests/well_known_types_test.rb
index ad8531d9..bd24c328 100644
--- a/ruby/tests/well_known_types_test.rb
+++ b/ruby/tests/well_known_types_test.rb
@@ -13,15 +13,18 @@ class TestWellKnownTypes < Test::Unit::TestCase
assert_equal Time.at(12345), ts.to_time
assert_equal 12345, ts.to_i
+ # millisecond accuracy
time = Time.at(123456, 654321)
ts.from_time(time)
assert_equal 123456, ts.seconds
assert_equal 654321000, ts.nanos
assert_equal time, ts.to_time
- time = Time.now
+ # nanosecond accuracy
+ time = Time.at(123456, Rational(654321321, 1000))
ts.from_time(time)
- assert_equal time.to_f, ts.to_time.to_f
+ assert_equal 654321321, ts.nanos
+ assert_equal time, ts.to_time
end
def test_duration