Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: third_party/protobuf/csharp/src/Google.Protobuf.Test/ByteStringTest.cs

Issue 2599263002: third_party/protobuf: Update to HEAD (f52e188fe4) (Closed)
Patch Set: Address comments Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #region Copyright notice and license 1 #region Copyright notice and license
2 // Protocol Buffers - Google's data interchange format 2 // Protocol Buffers - Google's data interchange format
3 // Copyright 2008 Google Inc. All rights reserved. 3 // Copyright 2008 Google Inc. All rights reserved.
4 // https://developers.google.com/protocol-buffers/ 4 // https://developers.google.com/protocol-buffers/
5 // 5 //
6 // Redistribution and use in source and binary forms, with or without 6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are 7 // modification, are permitted provided that the following conditions are
8 // met: 8 // met:
9 // 9 //
10 // * Redistributions of source code must retain the above copyright 10 // * Redistributions of source code must retain the above copyright
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 ByteString bs = ByteString.FromBase64(base64); 160 ByteString bs = ByteString.FromBase64(base64);
161 Assert.AreEqual(data, bs.ToByteArray()); 161 Assert.AreEqual(data, bs.ToByteArray());
162 } 162 }
163 163
164 [Test] 164 [Test]
165 public void FromBase64_Empty() 165 public void FromBase64_Empty()
166 { 166 {
167 // Optimization which also fixes issue 61. 167 // Optimization which also fixes issue 61.
168 Assert.AreSame(ByteString.Empty, ByteString.FromBase64("")); 168 Assert.AreSame(ByteString.Empty, ByteString.FromBase64(""));
169 } 169 }
170
171 [Test]
172 public void GetHashCode_Regression()
173 {
174 // We used to have an awful hash algorithm where only the last four
175 // bytes were relevant. This is a regression test for
176 // https://github.com/google/protobuf/issues/2511
177
178 ByteString b1 = ByteString.CopyFrom(100, 1, 2, 3, 4);
179 ByteString b2 = ByteString.CopyFrom(200, 1, 2, 3, 4);
180 Assert.AreNotEqual(b1.GetHashCode(), b2.GetHashCode());
181 }
182
170 } 183 }
171 } 184 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698