| Index: third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/BoundedByteStringTest.java
|
| diff --git a/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestCornerCases.cs b/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/BoundedByteStringTest.java
|
| similarity index 62%
|
| copy from third_party/protobuf/csharp/src/Google.Protobuf.Test/TestCornerCases.cs
|
| copy to third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/BoundedByteStringTest.java
|
| index fd75b19f42ed9de79a1d373a12038dcf0a103fef..c838274369484391e6e76aa97252696b5e5bed0e 100644
|
| --- a/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestCornerCases.cs
|
| +++ b/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/BoundedByteStringTest.java
|
| @@ -1,7 +1,6 @@
|
| -#region Copyright notice and license
|
| // Protocol Buffers - Google's data interchange format
|
| // Copyright 2008 Google Inc. All rights reserved.
|
| -// https://developers.google.com/protocol-buffers/
|
| +// http://code.google.com/p/protobuf/
|
| //
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| @@ -28,35 +27,30 @@
|
| // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| -#endregion
|
| -
|
| -using UnitTest.Issues.TestProtos;
|
| -using NUnit.Framework;
|
|
|
| -namespace Google.Protobuf
|
| -{
|
| - public class TestCornerCases
|
| - {
|
| - [Test]
|
| - public void TestRoundTripNegativeEnums()
|
| - {
|
| - NegativeEnumMessage msg = new NegativeEnumMessage
|
| - {
|
| - Value = NegativeEnum.MinusOne,
|
| - Values = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnum.FiveBelow },
|
| - PackedValues = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnum.FiveBelow }
|
| - };
|
| +package com.google.protobuf.test;
|
| +import com.google.protobuf.*;
|
|
|
| - Assert.AreEqual(58, msg.CalculateSize());
|
| +import java.io.UnsupportedEncodingException;
|
|
|
| - byte[] bytes = new byte[58];
|
| - CodedOutputStream output = new CodedOutputStream(bytes);
|
| +/**
|
| + * This class tests {@link BoundedByteString}, which extends {@link LiteralByteString},
|
| + * by inheriting the tests from {@link LiteralByteStringTest}. The only method which
|
| + * is strange enough that it needs to be overridden here is {@link #testToString()}.
|
| + *
|
| + * @author carlanton@google.com (Carl Haverl)
|
| + */
|
| +public class BoundedByteStringTest extends LiteralByteStringTest {
|
|
|
| - msg.WriteTo(output);
|
| - Assert.AreEqual(0, output.SpaceLeft);
|
| -
|
| - NegativeEnumMessage copy = NegativeEnumMessage.Parser.ParseFrom(bytes);
|
| - Assert.AreEqual(msg, copy);
|
| - }
|
| - }
|
| + @Override
|
| + protected void setUp() throws Exception {
|
| + classUnderTest = "BoundedByteString";
|
| + byte[] sourceBytes = ByteStringTest.getTestBytes(2341, 11337766L);
|
| + int from = 100;
|
| + int to = sourceBytes.length - 100;
|
| + stringUnderTest = ByteString.copyFrom(sourceBytes).substring(from, to);
|
| + referenceBytes = new byte[to - from];
|
| + System.arraycopy(sourceBytes, from, referenceBytes, 0, to - from);
|
| + expectedHashCode = 727575887;
|
| + }
|
| }
|
|
|