diff options
-rw-r--r-- | src/ProtocolBuffers.Test/AbstractMessageTest.cs | 1 | ||||
-rw-r--r-- | src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj | 1 | ||||
-rw-r--r-- | src/ProtocolBuffers.Test/TestUtil.cs | 86 | ||||
-rw-r--r-- | src/ProtocolBuffersLite.Test/ExtendableMessageLiteTest.cs | 1 |
4 files changed, 46 insertions, 43 deletions
diff --git a/src/ProtocolBuffers.Test/AbstractMessageTest.cs b/src/ProtocolBuffers.Test/AbstractMessageTest.cs index bef5052d..a502a6cd 100644 --- a/src/ProtocolBuffers.Test/AbstractMessageTest.cs +++ b/src/ProtocolBuffers.Test/AbstractMessageTest.cs @@ -133,6 +133,7 @@ namespace Google.ProtocolBuffers byte[] bytes = TestUtil.GetPackedSet().ToByteArray();
ExtensionRegistry registry = ExtensionRegistry.CreateInstance();
UnitTestProtoFile.RegisterAllExtensions(registry);
+ UnitTestExtrasProtoFile.RegisterAllExtensions(registry);
TestUnpackedExtensions message = TestUnpackedExtensions.ParseFrom(bytes, registry);
TestUtil.AssertUnpackedExtensionsSet(message);
}
diff --git a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj index 2633c3cb..e720ce00 100644 --- a/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj +++ b/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj @@ -88,6 +88,7 @@ </Compile>
<Compile Include="Compatibility\TextCompatibilityTests.cs" />
<Compile Include="Compatibility\XmlCompatibilityTests.cs" />
+ <Compile Include="TestProtos\UnitTestExtrasProtoFile.cs" />
<Compile Include="TestRpcForMimeTypes.cs" />
<Compile Include="TestReaderForUrlEncoded.cs" />
<Compile Include="CSharpOptionsTest.cs" />
diff --git a/src/ProtocolBuffers.Test/TestUtil.cs b/src/ProtocolBuffers.Test/TestUtil.cs index 7a1e0234..ae2c1164 100644 --- a/src/ProtocolBuffers.Test/TestUtil.cs +++ b/src/ProtocolBuffers.Test/TestUtil.cs @@ -1690,49 +1690,49 @@ namespace Google.ProtocolBuffers public static void AssertUnpackedExtensionsSet(TestUnpackedExtensions message)
{
- Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedInt32Extension));
- Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedInt64Extension));
- Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedUint32Extension));
- Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedUint64Extension));
- Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedSint32Extension));
- Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedSint64Extension));
- Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedFixed32Extension));
- Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedFixed64Extension));
- Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedSfixed32Extension));
- Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedSfixed64Extension));
- Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedFloatExtension));
- Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedDoubleExtension));
- Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedBoolExtension));
- Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedEnumExtension));
- Assert.AreEqual(601, message.GetExtension(UnitTestProtoFile.UnpackedInt32Extension, 0));
- Assert.AreEqual(602L, message.GetExtension(UnitTestProtoFile.UnpackedInt64Extension, 0));
- Assert.AreEqual(603, message.GetExtension(UnitTestProtoFile.UnpackedUint32Extension, 0));
- Assert.AreEqual(604L, message.GetExtension(UnitTestProtoFile.UnpackedUint64Extension, 0));
- Assert.AreEqual(605, message.GetExtension(UnitTestProtoFile.UnpackedSint32Extension, 0));
- Assert.AreEqual(606L, message.GetExtension(UnitTestProtoFile.UnpackedSint64Extension, 0));
- Assert.AreEqual(607, message.GetExtension(UnitTestProtoFile.UnpackedFixed32Extension, 0));
- Assert.AreEqual(608L, message.GetExtension(UnitTestProtoFile.UnpackedFixed64Extension, 0));
- Assert.AreEqual(609, message.GetExtension(UnitTestProtoFile.UnpackedSfixed32Extension, 0));
- Assert.AreEqual(610L, message.GetExtension(UnitTestProtoFile.UnpackedSfixed64Extension, 0));
- Assert.AreEqual(611F, message.GetExtension(UnitTestProtoFile.UnpackedFloatExtension, 0));
- Assert.AreEqual(612D, message.GetExtension(UnitTestProtoFile.UnpackedDoubleExtension, 0));
- Assert.AreEqual(true, message.GetExtension(UnitTestProtoFile.UnpackedBoolExtension, 0));
- Assert.AreEqual(ForeignEnum.FOREIGN_BAR,
- message.GetExtension(UnitTestProtoFile.UnpackedEnumExtension, 0));
- Assert.AreEqual(701, message.GetExtension(UnitTestProtoFile.UnpackedInt32Extension, 1));
- Assert.AreEqual(702L, message.GetExtension(UnitTestProtoFile.UnpackedInt64Extension, 1));
- Assert.AreEqual(703, message.GetExtension(UnitTestProtoFile.UnpackedUint32Extension, 1));
- Assert.AreEqual(704L, message.GetExtension(UnitTestProtoFile.UnpackedUint64Extension, 1));
- Assert.AreEqual(705, message.GetExtension(UnitTestProtoFile.UnpackedSint32Extension, 1));
- Assert.AreEqual(706L, message.GetExtension(UnitTestProtoFile.UnpackedSint64Extension, 1));
- Assert.AreEqual(707, message.GetExtension(UnitTestProtoFile.UnpackedFixed32Extension, 1));
- Assert.AreEqual(708L, message.GetExtension(UnitTestProtoFile.UnpackedFixed64Extension, 1));
- Assert.AreEqual(709, message.GetExtension(UnitTestProtoFile.UnpackedSfixed32Extension, 1));
- Assert.AreEqual(710L, message.GetExtension(UnitTestProtoFile.UnpackedSfixed64Extension, 1));
- Assert.AreEqual(711F, message.GetExtension(UnitTestProtoFile.UnpackedFloatExtension, 1));
- Assert.AreEqual(712D, message.GetExtension(UnitTestProtoFile.UnpackedDoubleExtension, 1));
- Assert.AreEqual(false, message.GetExtension(UnitTestProtoFile.UnpackedBoolExtension, 1));
- Assert.AreEqual(ForeignEnum.FOREIGN_BAZ, message.GetExtension(UnitTestProtoFile.UnpackedEnumExtension, 1));
+ Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedInt32Extension));
+ Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedInt64Extension));
+ Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedUint32Extension));
+ Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedUint64Extension));
+ Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedSint32Extension));
+ Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedSint64Extension));
+ Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedFixed32Extension));
+ Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedFixed64Extension));
+ Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedSfixed32Extension));
+ Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedSfixed64Extension));
+ Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedFloatExtension));
+ Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedDoubleExtension));
+ Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedBoolExtension));
+ Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedEnumExtension));
+ Assert.AreEqual(601, message.GetExtension(UnitTestExtrasProtoFile.UnpackedInt32Extension, 0));
+ Assert.AreEqual(602L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedInt64Extension, 0));
+ Assert.AreEqual(603, message.GetExtension(UnitTestExtrasProtoFile.UnpackedUint32Extension, 0));
+ Assert.AreEqual(604L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedUint64Extension, 0));
+ Assert.AreEqual(605, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSint32Extension, 0));
+ Assert.AreEqual(606L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSint64Extension, 0));
+ Assert.AreEqual(607, message.GetExtension(UnitTestExtrasProtoFile.UnpackedFixed32Extension, 0));
+ Assert.AreEqual(608L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedFixed64Extension, 0));
+ Assert.AreEqual(609, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSfixed32Extension, 0));
+ Assert.AreEqual(610L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSfixed64Extension, 0));
+ Assert.AreEqual(611F, message.GetExtension(UnitTestExtrasProtoFile.UnpackedFloatExtension, 0));
+ Assert.AreEqual(612D, message.GetExtension(UnitTestExtrasProtoFile.UnpackedDoubleExtension, 0));
+ Assert.AreEqual(true, message.GetExtension(UnitTestExtrasProtoFile.UnpackedBoolExtension, 0));
+ Assert.AreEqual(UnpackedExtensionsForeignEnum.FOREIGN_BAR,
+ message.GetExtension(UnitTestExtrasProtoFile.UnpackedEnumExtension, 0));
+ Assert.AreEqual(701, message.GetExtension(UnitTestExtrasProtoFile.UnpackedInt32Extension, 1));
+ Assert.AreEqual(702L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedInt64Extension, 1));
+ Assert.AreEqual(703, message.GetExtension(UnitTestExtrasProtoFile.UnpackedUint32Extension, 1));
+ Assert.AreEqual(704L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedUint64Extension, 1));
+ Assert.AreEqual(705, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSint32Extension, 1));
+ Assert.AreEqual(706L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSint64Extension, 1));
+ Assert.AreEqual(707, message.GetExtension(UnitTestExtrasProtoFile.UnpackedFixed32Extension, 1));
+ Assert.AreEqual(708L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedFixed64Extension, 1));
+ Assert.AreEqual(709, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSfixed32Extension, 1));
+ Assert.AreEqual(710L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSfixed64Extension, 1));
+ Assert.AreEqual(711F, message.GetExtension(UnitTestExtrasProtoFile.UnpackedFloatExtension, 1));
+ Assert.AreEqual(712D, message.GetExtension(UnitTestExtrasProtoFile.UnpackedDoubleExtension, 1));
+ Assert.AreEqual(false, message.GetExtension(UnitTestExtrasProtoFile.UnpackedBoolExtension, 1));
+ Assert.AreEqual(UnpackedExtensionsForeignEnum.FOREIGN_BAZ, message.GetExtension(UnitTestExtrasProtoFile.UnpackedEnumExtension, 1));
}
private static ByteString goldenPackedFieldsMessage = null;
diff --git a/src/ProtocolBuffersLite.Test/ExtendableMessageLiteTest.cs b/src/ProtocolBuffersLite.Test/ExtendableMessageLiteTest.cs index 5ea8447b..30e34b93 100644 --- a/src/ProtocolBuffersLite.Test/ExtendableMessageLiteTest.cs +++ b/src/ProtocolBuffersLite.Test/ExtendableMessageLiteTest.cs @@ -348,6 +348,7 @@ namespace Google.ProtocolBuffers ExtensionRegistry registry = ExtensionRegistry.CreateInstance();
UnitTestLiteProtoFile.RegisterAllExtensions(registry);
+ UnitTestExtrasLiteProtoFile.RegisterAllExtensions(registry);
TestUnpackedExtensionsLite unpacked = TestUnpackedExtensionsLite.ParseFrom(original.ToByteArray(), registry);
|