Skip to content

Commit

Permalink
Merge pull request #9691 from JasonLunn/fix_warnings
Browse files Browse the repository at this point in the history
Cleanup warnings seen when running tests.
  • Loading branch information
JasonLunn committed Mar 29, 2022
2 parents 8e7f936 + d0fc279 commit 615a8d9
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions ruby/tests/repeated_field_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ def test_first
end

fill_test_msg(m)
assert_equal -10, m.repeated_int32.first
assert_equal -1_000_000, m.repeated_int64.first
assert_equal( -10, m.repeated_int32.first )
assert_equal( -1_000_000, m.repeated_int64.first )
assert_equal 10, m.repeated_uint32.first
assert_equal 1_000_000, m.repeated_uint64.first
assert_equal true, m.repeated_bool.first
assert_equal -1.01, m.repeated_float.first.round(2)
assert_equal -1.0000000000001, m.repeated_double.first
assert_equal( -1.01, m.repeated_float.first.round(2) )
assert_equal( -1.0000000000001, m.repeated_double.first )
assert_equal 'foo', m.repeated_string.first
assert_equal "bar".encode!('ASCII-8BIT'), m.repeated_bytes.first
assert_equal TestMessage2.new(:foo => 1), m.repeated_msg.first
Expand All @@ -61,13 +61,13 @@ def test_last
assert_nil m.send(field_name).first
end
fill_test_msg(m)
assert_equal -11, m.repeated_int32.last
assert_equal -1_000_001, m.repeated_int64.last
assert_equal( -11, m.repeated_int32.last )
assert_equal( -1_000_001, m.repeated_int64.last )
assert_equal 11, m.repeated_uint32.last
assert_equal 1_000_001, m.repeated_uint64.last
assert_equal false, m.repeated_bool.last
assert_equal -1.02, m.repeated_float.last.round(2)
assert_equal -1.0000000000002, m.repeated_double.last
assert_equal( -1.02, m.repeated_float.last.round(2) )
assert_equal( -1.0000000000002, m.repeated_double.last )
assert_equal 'bar', m.repeated_string.last
assert_equal "foo".encode!('ASCII-8BIT'), m.repeated_bytes.last
assert_equal TestMessage2.new(:foo => 2), m.repeated_msg.last
Expand All @@ -82,20 +82,20 @@ def test_pop
end
fill_test_msg(m)

assert_equal -11, m.repeated_int32.pop
assert_equal -10, m.repeated_int32.pop
assert_equal -1_000_001, m.repeated_int64.pop
assert_equal -1_000_000, m.repeated_int64.pop
assert_equal( -11, m.repeated_int32.pop )
assert_equal( -10, m.repeated_int32.pop )
assert_equal( -1_000_001, m.repeated_int64.pop )
assert_equal( -1_000_000, m.repeated_int64.pop )
assert_equal 11, m.repeated_uint32.pop
assert_equal 10, m.repeated_uint32.pop
assert_equal 1_000_001, m.repeated_uint64.pop
assert_equal 1_000_000, m.repeated_uint64.pop
assert_equal false, m.repeated_bool.pop
assert_equal true, m.repeated_bool.pop
assert_equal -1.02, m.repeated_float.pop.round(2)
assert_equal -1.01, m.repeated_float.pop.round(2)
assert_equal -1.0000000000002, m.repeated_double.pop
assert_equal -1.0000000000001, m.repeated_double.pop
assert_equal( -1.02, m.repeated_float.pop.round(2) )
assert_equal( -1.01, m.repeated_float.pop.round(2) )
assert_equal( -1.0000000000002, m.repeated_double.pop )
assert_equal( -1.0000000000001, m.repeated_double.pop )
assert_equal 'bar', m.repeated_string.pop
assert_equal 'foo', m.repeated_string.pop
assert_equal "foo".encode!('ASCII-8BIT'), m.repeated_bytes.pop
Expand Down Expand Up @@ -487,11 +487,8 @@ def test_shift
def test_shuffle!
m = TestMessage.new
m.repeated_string += %w(foo bar baz)
orig_repeated_string = m.repeated_string.clone
result = m.repeated_string.shuffle!
assert_equal m.repeated_string, result
# NOTE: sometimes it doesn't change the order...
# assert_not_equal m.repeated_string.to_a, orig_repeated_string.to_a
end

def test_slice!
Expand Down

0 comments on commit 615a8d9

Please sign in to comment.