diff options
author | Brendan Ribera <brendan.ribera@gmail.com> | 2016-08-30 16:21:33 -0700 |
---|---|---|
committer | Brendan Ribera <brendan.ribera@gmail.com> | 2016-08-30 16:21:33 -0700 |
commit | 047419a1729b3b0cb57dc7f78b93d18fb430b6c4 (patch) | |
tree | 22788d6bf3571b5dab92aed8b4ec795b5b2c12ce /ruby | |
parent | c0a6a6b4628a634f6a0529c9f7e9e1e0fe66d4d6 (diff) | |
download | protobuf-047419a1729b3b0cb57dc7f78b93d18fb430b6c4.tar.gz protobuf-047419a1729b3b0cb57dc7f78b93d18fb430b6c4.tar.bz2 protobuf-047419a1729b3b0cb57dc7f78b93d18fb430b6c4.zip |
failing test for #2036:
* add a repeated field to the tested hash
* also assert that two messages with identical values produce identical hashes
Diffstat (limited to 'ruby')
-rw-r--r-- | ruby/tests/basic.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ruby/tests/basic.rb b/ruby/tests/basic.rb index 8b6d329e..989a047e 100644 --- a/ruby/tests/basic.rb +++ b/ruby/tests/basic.rb @@ -183,12 +183,15 @@ module BasicTest def test_hash m1 = TestMessage.new(:optional_int32 => 42) - m2 = TestMessage.new(:optional_int32 => 102) + m2 = TestMessage.new(:optional_int32 => 102, repeated_string: ['please', 'work', 'ok?']) + m3 = TestMessage.new(:optional_int32 => 102, repeated_string: ['please', 'work', 'ok?']) assert m1.hash != 0 assert m2.hash != 0 + assert m3.hash != 0 # relying on the randomness here -- if hash function changes and we are # unlucky enough to get a collision, then change the values above. assert m1.hash != m2.hash + assert_equal m2.hash, m3.hash end def test_unknown_field_errors |