コード例 #1
0
 private static void assertDeepEquals(TestAllTypes original, TestAllTypes result) {
   assertEquals(original.getOptionalInt32(), result.getOptionalInt32());
   assertEquals(original.getOptionalInt64(), result.getOptionalInt64());
   assertEquals(original.getOptionalUint32(), result.getOptionalUint32());
   assertEquals(original.getOptionalUint64(), result.getOptionalUint64());
   assertEquals(original.getOptionalSint32(), result.getOptionalSint32());
   assertEquals(original.getOptionalSint64(), result.getOptionalSint64());
   assertEquals(original.getOptionalFixed32(), result.getOptionalFixed32());
   assertEquals(original.getOptionalFixed64(), result.getOptionalFixed64());
   assertEquals(original.getOptionalSfixed32(), result.getOptionalSfixed32());
   assertEquals(original.getOptionalSfixed64(), result.getOptionalSfixed64());
   assertEquals(original.getOptionalFloat(), result.getOptionalFloat(), 0.0);
   assertEquals(original.getOptionalDouble(), result.getOptionalDouble(), 0.0);
   assertEquals(original.getOptionalBool(), result.getOptionalBool());
   assertEquals(original.getOptionalString(), result.getOptionalString());
   assertTrue(Arrays.equals(original.getOptionalBytes(), result.getOptionalBytes()));
   assertEquals(original.getOptionalStringPiece(), result.getOptionalStringPiece());
   assertEquals(original.getOptionalCord(), result.getOptionalCord());
   assertTrue(
       Arrays.equals(original.getRepeatedInt32().toArray(), result.getRepeatedInt32().toArray()));
   assertTrue(
       Arrays.equals(original.getRepeatedInt64().toArray(), result.getRepeatedInt64().toArray()));
   assertTrue(
       Arrays.equals(
           original.getRepeatedUint32().toArray(), result.getRepeatedUint32().toArray()));
   assertTrue(
       Arrays.equals(
           original.getRepeatedUint64().toArray(), result.getRepeatedUint64().toArray()));
   assertTrue(
       Arrays.equals(
           original.getRepeatedSint32().toArray(), result.getRepeatedSint32().toArray()));
   assertTrue(
       Arrays.equals(
           original.getRepeatedSint64().toArray(), result.getRepeatedSint64().toArray()));
   assertTrue(
       Arrays.equals(
           original.getRepeatedFixed32().toArray(), result.getRepeatedFixed32().toArray()));
   assertTrue(
       Arrays.equals(
           original.getRepeatedFixed64().toArray(), result.getRepeatedFixed64().toArray()));
   assertTrue(
       Arrays.equals(
           original.getRepeatedSfixed32().toArray(), result.getRepeatedSfixed32().toArray()));
   assertTrue(
       Arrays.equals(
           original.getRepeatedSfixed64().toArray(), result.getRepeatedSfixed64().toArray()));
   assertTrue(
       Arrays.equals(original.getRepeatedFloat().toArray(), result.getRepeatedFloat().toArray()));
   assertTrue(
       Arrays.equals(
           original.getRepeatedDouble().toArray(), result.getRepeatedDouble().toArray()));
   assertTrue(
       Arrays.equals(original.getRepeatedBool().toArray(), result.getRepeatedBool().toArray()));
   assertTrue(
       Arrays.equals(
           original.getRepeatedString().toArray(), result.getRepeatedString().toArray()));
   assertEquals(
       original.getRepeatedForeignMessage().size(), result.getRepeatedForeignMessage().size());
   assertEquals(
       original.getRepeatedForeignMessage().get(0).getC(),
       result.getRepeatedForeignMessage().get(0).getC());
   assertEquals(
       original.getRepeatedForeignMessage().get(1).getC(),
       result.getRepeatedForeignMessage().get(1).getC());
 }
コード例 #2
0
 private static void assertDeepEquals(
     protobuf_unittest.UnittestProto.TestAllTypes defaultImpl, TestAllTypes optimized) {
   assertEquals(defaultImpl.getOptionalInt32(), optimized.getOptionalInt32());
   assertEquals(defaultImpl.getOptionalInt64(), optimized.getOptionalInt64());
   assertEquals(defaultImpl.getOptionalUint32(), optimized.getOptionalUint32());
   assertEquals(defaultImpl.getOptionalUint64(), optimized.getOptionalUint64());
   assertEquals(defaultImpl.getOptionalSint32(), optimized.getOptionalSint32());
   assertEquals(defaultImpl.getOptionalSint64(), optimized.getOptionalSint64());
   assertEquals(defaultImpl.getOptionalFixed32(), optimized.getOptionalFixed32());
   assertEquals(defaultImpl.getOptionalFixed64(), optimized.getOptionalFixed64());
   assertEquals(defaultImpl.getOptionalSfixed32(), optimized.getOptionalSfixed32());
   assertEquals(defaultImpl.getOptionalSfixed64(), optimized.getOptionalSfixed64());
   assertEquals(defaultImpl.getOptionalFloat(), optimized.getOptionalFloat(), 0.0);
   assertEquals(defaultImpl.getOptionalDouble(), optimized.getOptionalDouble(), 0.0);
   assertEquals(defaultImpl.getOptionalBool(), optimized.getOptionalBool());
   assertEquals(defaultImpl.getOptionalString(), optimized.getOptionalString());
   assertTrue(
       Arrays.equals(defaultImpl.getOptionalBytes().toByteArray(), optimized.getOptionalBytes()));
   assertEquals(defaultImpl.getOptionalStringPiece(), optimized.getOptionalStringPiece());
   assertEquals(defaultImpl.getOptionalCord(), optimized.getOptionalCord());
   assertTrue(
       Arrays.equals(
           defaultImpl.getRepeatedInt32List().toArray(), optimized.getRepeatedInt32().toArray()));
   assertTrue(
       Arrays.equals(
           defaultImpl.getRepeatedInt64List().toArray(), optimized.getRepeatedInt64().toArray()));
   assertTrue(
       Arrays.equals(
           defaultImpl.getRepeatedUint32List().toArray(),
           optimized.getRepeatedUint32().toArray()));
   assertTrue(
       Arrays.equals(
           defaultImpl.getRepeatedUint64List().toArray(),
           optimized.getRepeatedUint64().toArray()));
   assertTrue(
       Arrays.equals(
           defaultImpl.getRepeatedSint32List().toArray(),
           optimized.getRepeatedSint32().toArray()));
   assertTrue(
       Arrays.equals(
           defaultImpl.getRepeatedSint64List().toArray(),
           optimized.getRepeatedSint64().toArray()));
   assertTrue(
       Arrays.equals(
           defaultImpl.getRepeatedFixed32List().toArray(),
           optimized.getRepeatedFixed32().toArray()));
   assertTrue(
       Arrays.equals(
           defaultImpl.getRepeatedFixed64List().toArray(),
           optimized.getRepeatedFixed64().toArray()));
   assertTrue(
       Arrays.equals(
           defaultImpl.getRepeatedSfixed32List().toArray(),
           optimized.getRepeatedSfixed32().toArray()));
   assertTrue(
       Arrays.equals(
           defaultImpl.getRepeatedSfixed64List().toArray(),
           optimized.getRepeatedSfixed64().toArray()));
   assertTrue(
       Arrays.equals(
           defaultImpl.getRepeatedFloatList().toArray(), optimized.getRepeatedFloat().toArray()));
   assertTrue(
       Arrays.equals(
           defaultImpl.getRepeatedDoubleList().toArray(),
           optimized.getRepeatedDouble().toArray()));
   assertTrue(
       Arrays.equals(
           defaultImpl.getRepeatedBoolList().toArray(), optimized.getRepeatedBool().toArray()));
   assertTrue(
       Arrays.equals(
           defaultImpl.getRepeatedStringList().toArray(),
           optimized.getRepeatedString().toArray()));
   assertEquals(
       defaultImpl.getRepeatedForeignMessageCount(), optimized.getRepeatedForeignMessage().size());
   assertEquals(
       defaultImpl.getRepeatedForeignMessage(0).getC(),
       optimized.getRepeatedForeignMessage().get(0).getC());
   assertEquals(
       defaultImpl.getRepeatedForeignMessage(1).getC(),
       optimized.getRepeatedForeignMessage().get(1).getC());
 }