From 044c36ebef20f66a9a8b0548f52b81692d779ac7 Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Tue, 4 Aug 2015 09:25:38 +0100 Subject: First pass at C# conformance tests. Completely untested so far - easier to get started in VS and then transfer to Linux for tweaking... --- csharp/.gitignore | 2 + csharp/generate_protos.sh | 3 + csharp/src/Google.Protobuf.Conformance/App.config | 6 + .../src/Google.Protobuf.Conformance/Conformance.cs | 2400 ++++++++++++++++++++ .../Google.Protobuf.Conformance.csproj | 61 + csharp/src/Google.Protobuf.Conformance/Program.cs | 126 + .../Properties/AssemblyInfo.cs | 36 + csharp/src/Google.Protobuf.sln | 8 + 8 files changed, 2642 insertions(+) create mode 100644 csharp/src/Google.Protobuf.Conformance/App.config create mode 100644 csharp/src/Google.Protobuf.Conformance/Conformance.cs create mode 100644 csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj create mode 100644 csharp/src/Google.Protobuf.Conformance/Program.cs create mode 100644 csharp/src/Google.Protobuf.Conformance/Properties/AssemblyInfo.cs (limited to 'csharp') diff --git a/csharp/.gitignore b/csharp/.gitignore index dbb3dd39..07ea90ac 100644 --- a/csharp/.gitignore +++ b/csharp/.gitignore @@ -5,6 +5,8 @@ src/AddressBook/bin src/AddressBook/obj src/Google.Protobuf/bin/ src/Google.Protobuf/obj/ +src/Google.Protobuf.Conformance/bin/ +src/Google.Protobuf.Conformance/obj/ src/Google.Protobuf.Test/bin/ src/Google.Protobuf.Test/obj/ src/Google.Protobuf.JsonDump/bin/ diff --git a/csharp/generate_protos.sh b/csharp/generate_protos.sh index 2b5e525d..962f2a9c 100755 --- a/csharp/generate_protos.sh +++ b/csharp/generate_protos.sh @@ -68,3 +68,6 @@ $PROTOC -Icsharp/protos --csharp_out=csharp/src/Google.Protobuf.Test/TestProtos # AddressBook sample protos $PROTOC -Iexamples --csharp_out=csharp/src/AddressBook \ examples/addressbook.proto + +$PROTOC -Iconformance --csharp_out=csharp/src/Google.Protobuf.Conformance \ + conformance/conformance.proto diff --git a/csharp/src/Google.Protobuf.Conformance/App.config b/csharp/src/Google.Protobuf.Conformance/App.config new file mode 100644 index 00000000..8e156463 --- /dev/null +++ b/csharp/src/Google.Protobuf.Conformance/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/csharp/src/Google.Protobuf.Conformance/Conformance.cs b/csharp/src/Google.Protobuf.Conformance/Conformance.cs new file mode 100644 index 00000000..187eea9d --- /dev/null +++ b/csharp/src/Google.Protobuf.Conformance/Conformance.cs @@ -0,0 +1,2400 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: conformance.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Conformance { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Conformance { + + #region Descriptor + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static Conformance() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChFjb25mb3JtYW5jZS5wcm90bxILY29uZm9ybWFuY2UijQEKEkNvbmZvcm1h", + "bmNlUmVxdWVzdBIaChBwcm90b2J1Zl9wYXlsb2FkGAEgASgMSAASFgoManNv", + "bl9wYXlsb2FkGAIgASgJSAASOAoXcmVxdWVzdGVkX291dHB1dF9mb3JtYXQY", + "AyABKA4yFy5jb25mb3JtYW5jZS5XaXJlRm9ybWF0QgkKB3BheWxvYWQilgEK", + "E0NvbmZvcm1hbmNlUmVzcG9uc2USFQoLcGFyc2VfZXJyb3IYASABKAlIABIX", + "Cg1ydW50aW1lX2Vycm9yGAIgASgJSAASGgoQcHJvdG9idWZfcGF5bG9hZBgD", + "IAEoDEgAEhYKDGpzb25fcGF5bG9hZBgEIAEoCUgAEhEKB3NraXBwZWQYBSAB", + "KAlIAEIICgZyZXN1bHQi6yIKDFRlc3RB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KkAKC0ZvcmVpZ25FbnVtEg8KC0ZPUkVJR05fRk9P", + "EAASDwoLRk9SRUlHTl9CQVIQARIPCgtGT1JFSUdOX0JBWhACQiEKH2NvbS5n", + "b29nbGUucHJvdG9idWYuY29uZm9ybWFuY2ViBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedCodeInfo(new[] {typeof(global::Conformance.WireFormat), typeof(global::Conformance.ForeignEnum), }, new pbr::GeneratedCodeInfo[] { + new pbr::GeneratedCodeInfo(typeof(global::Conformance.ConformanceRequest), new[]{ "ProtobufPayload", "JsonPayload", "RequestedOutputFormat" }, new[]{ "Payload" }, null, null), + new pbr::GeneratedCodeInfo(typeof(global::Conformance.ConformanceResponse), new[]{ "ParseError", "RuntimeError", "ProtobufPayload", "JsonPayload", "Skipped" }, new[]{ "Result" }, null, null), + new pbr::GeneratedCodeInfo(typeof(global::Conformance.TestAllTypes), new[]{ "OptionalInt32", "OptionalInt64", "OptionalUint32", "OptionalUint64", "OptionalSint32", "OptionalSint64", "OptionalFixed32", "OptionalFixed64", "OptionalSfixed32", "OptionalSfixed64", "OptionalFloat", "OptionalDouble", "OptionalBool", "OptionalString", "OptionalBytes", "OptionalNestedMessage", "OptionalForeignMessage", "OptionalNestedEnum", "OptionalForeignEnum", "OptionalStringPiece", "OptionalCord", "RecursiveMessage", "RepeatedInt32", "RepeatedInt64", "RepeatedUint32", "RepeatedUint64", "RepeatedSint32", "RepeatedSint64", "RepeatedFixed32", "RepeatedFixed64", "RepeatedSfixed32", "RepeatedSfixed64", "RepeatedFloat", "RepeatedDouble", "RepeatedBool", "RepeatedString", "RepeatedBytes", "RepeatedNestedMessage", "RepeatedForeignMessage", "RepeatedNestedEnum", "RepeatedForeignEnum", "RepeatedStringPiece", "RepeatedCord", "MapInt32Int32", "MapInt64Int64", "MapUint32Uint32", "MapUint64Uint64", "MapSint32Sint32", "MapSint64Sint64", "MapFixed32Fixed32", "MapFixed64Fixed64", "MapSfixed32Sfixed32", "MapSfixed64Sfixed64", "MapInt32Float", "MapInt32Double", "MapBoolBool", "MapStringString", "MapStringBytes", "MapStringNestedMessage", "MapStringForeignMessage", "MapStringNestedEnum", "MapStringForeignEnum", "OneofUint32", "OneofNestedMessage", "OneofString", "OneofBytes" }, new[]{ "OneofField" }, new[]{ typeof(global::Conformance.TestAllTypes.Types.NestedEnum) }, new pbr::GeneratedCodeInfo[] { new pbr::GeneratedCodeInfo(typeof(global::Conformance.TestAllTypes.Types.NestedMessage), new[]{ "A", "Corecursive" }, null, null, null), + null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, }), + new pbr::GeneratedCodeInfo(typeof(global::Conformance.ForeignMessage), new[]{ "C" }, null, null, null) + })); + } + #endregion + + } + #region Enums + public enum WireFormat { + UNSPECIFIED = 0, + PROTOBUF = 1, + JSON = 2, + } + + public enum ForeignEnum { + FOREIGN_FOO = 0, + FOREIGN_BAR = 1, + FOREIGN_BAZ = 2, + } + + #endregion + + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ConformanceRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConformanceRequest()); + public static pb::MessageParser Parser { get { return _parser; } } + + public static pbr::MessageDescriptor Descriptor { + get { return global::Conformance.Conformance.Descriptor.MessageTypes[0]; } + } + + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + public ConformanceRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + public ConformanceRequest(ConformanceRequest other) : this() { + requestedOutputFormat_ = other.requestedOutputFormat_; + switch (other.PayloadCase) { + case PayloadOneofCase.ProtobufPayload: + ProtobufPayload = other.ProtobufPayload; + break; + case PayloadOneofCase.JsonPayload: + JsonPayload = other.JsonPayload; + break; + } + + } + + public ConformanceRequest Clone() { + return new ConformanceRequest(this); + } + + public const int ProtobufPayloadFieldNumber = 1; + public pb::ByteString ProtobufPayload { + get { return payloadCase_ == PayloadOneofCase.ProtobufPayload ? (pb::ByteString) payload_ : pb::ByteString.Empty; } + set { + payload_ = pb::Preconditions.CheckNotNull(value, "value"); + payloadCase_ = PayloadOneofCase.ProtobufPayload; + } + } + + public const int JsonPayloadFieldNumber = 2; + public string JsonPayload { + get { return payloadCase_ == PayloadOneofCase.JsonPayload ? (string) payload_ : ""; } + set { + payload_ = pb::Preconditions.CheckNotNull(value, "value"); + payloadCase_ = PayloadOneofCase.JsonPayload; + } + } + + public const int RequestedOutputFormatFieldNumber = 3; + private global::Conformance.WireFormat requestedOutputFormat_ = global::Conformance.WireFormat.UNSPECIFIED; + public global::Conformance.WireFormat RequestedOutputFormat { + get { return requestedOutputFormat_; } + set { + requestedOutputFormat_ = value; + } + } + + private object payload_; + public enum PayloadOneofCase { + None = 0, + ProtobufPayload = 1, + JsonPayload = 2, + } + private PayloadOneofCase payloadCase_ = PayloadOneofCase.None; + public PayloadOneofCase PayloadCase { + get { return payloadCase_; } + } + + public void ClearPayload() { + payloadCase_ = PayloadOneofCase.None; + payload_ = null; + } + + public override bool Equals(object other) { + return Equals(other as ConformanceRequest); + } + + public bool Equals(ConformanceRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ProtobufPayload != other.ProtobufPayload) return false; + if (JsonPayload != other.JsonPayload) return false; + if (RequestedOutputFormat != other.RequestedOutputFormat) return false; + return true; + } + + public override int GetHashCode() { + int hash = 1; + if (payloadCase_ == PayloadOneofCase.ProtobufPayload) hash ^= ProtobufPayload.GetHashCode(); + if (payloadCase_ == PayloadOneofCase.JsonPayload) hash ^= JsonPayload.GetHashCode(); + if (RequestedOutputFormat != global::Conformance.WireFormat.UNSPECIFIED) hash ^= RequestedOutputFormat.GetHashCode(); + return hash; + } + + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + + public void WriteTo(pb::CodedOutputStream output) { + if (payloadCase_ == PayloadOneofCase.ProtobufPayload) { + output.WriteRawTag(10); + output.WriteBytes(ProtobufPayload); + } + if (payloadCase_ == PayloadOneofCase.JsonPayload) { + output.WriteRawTag(18); + output.WriteString(JsonPayload); + } + if (RequestedOutputFormat != global::Conformance.WireFormat.UNSPECIFIED) { + output.WriteRawTag(24); + output.WriteEnum((int) RequestedOutputFormat); + } + } + + public int CalculateSize() { + int size = 0; + if (payloadCase_ == PayloadOneofCase.ProtobufPayload) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(ProtobufPayload); + } + if (payloadCase_ == PayloadOneofCase.JsonPayload) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(JsonPayload); + } + if (RequestedOutputFormat != global::Conformance.WireFormat.UNSPECIFIED) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) RequestedOutputFormat); + } + return size; + } + + public void MergeFrom(ConformanceRequest other) { + if (other == null) { + return; + } + if (other.RequestedOutputFormat != global::Conformance.WireFormat.UNSPECIFIED) { + RequestedOutputFormat = other.RequestedOutputFormat; + } + switch (other.PayloadCase) { + case PayloadOneofCase.ProtobufPayload: + ProtobufPayload = other.ProtobufPayload; + break; + case PayloadOneofCase.JsonPayload: + JsonPayload = other.JsonPayload; + break; + } + + } + + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while (input.ReadTag(out tag)) { + switch(tag) { + case 0: + throw pb::InvalidProtocolBufferException.InvalidTag(); + default: + if (pb::WireFormat.IsEndGroupTag(tag)) { + return; + } + break; + case 10: { + ProtobufPayload = input.ReadBytes(); + break; + } + case 18: { + JsonPayload = input.ReadString(); + break; + } + case 24: { + requestedOutputFormat_ = (global::Conformance.WireFormat) input.ReadEnum(); + break; + } + } + } + } + + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ConformanceResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConformanceResponse()); + public static pb::MessageParser Parser { get { return _parser; } } + + public static pbr::MessageDescriptor Descriptor { + get { return global::Conformance.Conformance.Descriptor.MessageTypes[1]; } + } + + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + public ConformanceResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + public ConformanceResponse(ConformanceResponse other) : this() { + switch (other.ResultCase) { + case ResultOneofCase.ParseError: + ParseError = other.ParseError; + break; + case ResultOneofCase.RuntimeError: + RuntimeError = other.RuntimeError; + break; + case ResultOneofCase.ProtobufPayload: + ProtobufPayload = other.ProtobufPayload; + break; + case ResultOneofCase.JsonPayload: + JsonPayload = other.JsonPayload; + break; + case ResultOneofCase.Skipped: + Skipped = other.Skipped; + break; + } + + } + + public ConformanceResponse Clone() { + return new ConformanceResponse(this); + } + + public const int ParseErrorFieldNumber = 1; + public string ParseError { + get { return resultCase_ == ResultOneofCase.ParseError ? (string) result_ : ""; } + set { + result_ = pb::Preconditions.CheckNotNull(value, "value"); + resultCase_ = ResultOneofCase.ParseError; + } + } + + public const int RuntimeErrorFieldNumber = 2; + public string RuntimeError { + get { return resultCase_ == ResultOneofCase.RuntimeError ? (string) result_ : ""; } + set { + result_ = pb::Preconditions.CheckNotNull(value, "value"); + resultCase_ = ResultOneofCase.RuntimeError; + } + } + + public const int ProtobufPayloadFieldNumber = 3; + public pb::ByteString ProtobufPayload { + get { return resultCase_ == ResultOneofCase.ProtobufPayload ? (pb::ByteString) result_ : pb::ByteString.Empty; } + set { + result_ = pb::Preconditions.CheckNotNull(value, "value"); + resultCase_ = ResultOneofCase.ProtobufPayload; + } + } + + public const int JsonPayloadFieldNumber = 4; + public string JsonPayload { + get { return resultCase_ == ResultOneofCase.JsonPayload ? (string) result_ : ""; } + set { + result_ = pb::Preconditions.CheckNotNull(value, "value"); + resultCase_ = ResultOneofCase.JsonPayload; + } + } + + public const int SkippedFieldNumber = 5; + public string Skipped { + get { return resultCase_ == ResultOneofCase.Skipped ? (string) result_ : ""; } + set { + result_ = pb::Preconditions.CheckNotNull(value, "value"); + resultCase_ = ResultOneofCase.Skipped; + } + } + + private object result_; + public enum ResultOneofCase { + None = 0, + ParseError = 1, + RuntimeError = 2, + ProtobufPayload = 3, + JsonPayload = 4, + Skipped = 5, + } + private ResultOneofCase resultCase_ = ResultOneofCase.None; + public ResultOneofCase ResultCase { + get { return resultCase_; } + } + + public void ClearResult() { + resultCase_ = ResultOneofCase.None; + result_ = null; + } + + public override bool Equals(object other) { + return Equals(other as ConformanceResponse); + } + + public bool Equals(ConformanceResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ParseError != other.ParseError) return false; + if (RuntimeError != other.RuntimeError) return false; + if (ProtobufPayload != other.ProtobufPayload) return false; + if (JsonPayload != other.JsonPayload) return false; + if (Skipped != other.Skipped) return false; + return true; + } + + public override int GetHashCode() { + int hash = 1; + if (resultCase_ == ResultOneofCase.ParseError) hash ^= ParseError.GetHashCode(); + if (resultCase_ == ResultOneofCase.RuntimeError) hash ^= RuntimeError.GetHashCode(); + if (resultCase_ == ResultOneofCase.ProtobufPayload) hash ^= ProtobufPayload.GetHashCode(); + if (resultCase_ == ResultOneofCase.JsonPayload) hash ^= JsonPayload.GetHashCode(); + if (resultCase_ == ResultOneofCase.Skipped) hash ^= Skipped.GetHashCode(); + return hash; + } + + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + + public void WriteTo(pb::CodedOutputStream output) { + if (resultCase_ == ResultOneofCase.ParseError) { + output.WriteRawTag(10); + output.WriteString(ParseError); + } + if (resultCase_ == ResultOneofCase.RuntimeError) { + output.WriteRawTag(18); + output.WriteString(RuntimeError); + } + if (resultCase_ == ResultOneofCase.ProtobufPayload) { + output.WriteRawTag(26); + output.WriteBytes(ProtobufPayload); + } + if (resultCase_ == ResultOneofCase.JsonPayload) { + output.WriteRawTag(34); + output.WriteString(JsonPayload); + } + if (resultCase_ == ResultOneofCase.Skipped) { + output.WriteRawTag(42); + output.WriteString(Skipped); + } + } + + public int CalculateSize() { + int size = 0; + if (resultCase_ == ResultOneofCase.ParseError) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ParseError); + } + if (resultCase_ == ResultOneofCase.RuntimeError) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(RuntimeError); + } + if (resultCase_ == ResultOneofCase.ProtobufPayload) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(ProtobufPayload); + } + if (resultCase_ == ResultOneofCase.JsonPayload) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(JsonPayload); + } + if (resultCase_ == ResultOneofCase.Skipped) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Skipped); + } + return size; + } + + public void MergeFrom(ConformanceResponse other) { + if (other == null) { + return; + } + switch (other.ResultCase) { + case ResultOneofCase.ParseError: + ParseError = other.ParseError; + break; + case ResultOneofCase.RuntimeError: + RuntimeError = other.RuntimeError; + break; + case ResultOneofCase.ProtobufPayload: + ProtobufPayload = other.ProtobufPayload; + break; + case ResultOneofCase.JsonPayload: + JsonPayload = other.JsonPayload; + break; + case ResultOneofCase.Skipped: + Skipped = other.Skipped; + break; + } + + } + + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while (input.ReadTag(out tag)) { + switch(tag) { + case 0: + throw pb::InvalidProtocolBufferException.InvalidTag(); + default: + if (pb::WireFormat.IsEndGroupTag(tag)) { + return; + } + break; + case 10: { + ParseError = input.ReadString(); + break; + } + case 18: { + RuntimeError = input.ReadString(); + break; + } + case 26: { + ProtobufPayload = input.ReadBytes(); + break; + } + case 34: { + JsonPayload = input.ReadString(); + break; + } + case 42: { + Skipped = input.ReadString(); + break; + } + } + } + } + + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestAllTypes : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestAllTypes()); + public static pb::MessageParser Parser { get { return _parser; } } + + public static pbr::MessageDescriptor Descriptor { + get { return global::Conformance.Conformance.Descriptor.MessageTypes[2]; } + } + + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + public TestAllTypes() { + OnConstruction(); + } + + partial void OnConstruction(); + + public TestAllTypes(TestAllTypes other) : this() { + optionalInt32_ = other.optionalInt32_; + optionalInt64_ = other.optionalInt64_; + optionalUint32_ = other.optionalUint32_; + optionalUint64_ = other.optionalUint64_; + optionalSint32_ = other.optionalSint32_; + optionalSint64_ = other.optionalSint64_; + optionalFixed32_ = other.optionalFixed32_; + optionalFixed64_ = other.optionalFixed64_; + optionalSfixed32_ = other.optionalSfixed32_; + optionalSfixed64_ = other.optionalSfixed64_; + optionalFloat_ = other.optionalFloat_; + optionalDouble_ = other.optionalDouble_; + optionalBool_ = other.optionalBool_; + optionalString_ = other.optionalString_; + optionalBytes_ = other.optionalBytes_; + OptionalNestedMessage = other.optionalNestedMessage_ != null ? other.OptionalNestedMessage.Clone() : null; + OptionalForeignMessage = other.optionalForeignMessage_ != null ? other.OptionalForeignMessage.Clone() : null; + optionalNestedEnum_ = other.optionalNestedEnum_; + optionalForeignEnum_ = other.optionalForeignEnum_; + optionalStringPiece_ = other.optionalStringPiece_; + optionalCord_ = other.optionalCord_; + RecursiveMessage = other.recursiveMessage_ != null ? other.RecursiveMessage.Clone() : null; + repeatedInt32_ = other.repeatedInt32_.Clone(); + repeatedInt64_ = other.repeatedInt64_.Clone(); + repeatedUint32_ = other.repeatedUint32_.Clone(); + repeatedUint64_ = other.repeatedUint64_.Clone(); + repeatedSint32_ = other.repeatedSint32_.Clone(); + repeatedSint64_ = other.repeatedSint64_.Clone(); + repeatedFixed32_ = other.repeatedFixed32_.Clone(); + repeatedFixed64_ = other.repeatedFixed64_.Clone(); + repeatedSfixed32_ = other.repeatedSfixed32_.Clone(); + repeatedSfixed64_ = other.repeatedSfixed64_.Clone(); + repeatedFloat_ = other.repeatedFloat_.Clone(); + repeatedDouble_ = other.repeatedDouble_.Clone(); + repeatedBool_ = other.repeatedBool_.Clone(); + repeatedString_ = other.repeatedString_.Clone(); + repeatedBytes_ = other.repeatedBytes_.Clone(); + repeatedNestedMessage_ = other.repeatedNestedMessage_.Clone(); + repeatedForeignMessage_ = other.repeatedForeignMessage_.Clone(); + repeatedNestedEnum_ = other.repeatedNestedEnum_.Clone(); + repeatedForeignEnum_ = other.repeatedForeignEnum_.Clone(); + repeatedStringPiece_ = other.repeatedStringPiece_.Clone(); + repeatedCord_ = other.repeatedCord_.Clone(); + mapInt32Int32_ = other.mapInt32Int32_.Clone(); + mapInt64Int64_ = other.mapInt64Int64_.Clone(); + mapUint32Uint32_ = other.mapUint32Uint32_.Clone(); + mapUint64Uint64_ = other.mapUint64Uint64_.Clone(); + mapSint32Sint32_ = other.mapSint32Sint32_.Clone(); + mapSint64Sint64_ = other.mapSint64Sint64_.Clone(); + mapFixed32Fixed32_ = other.mapFixed32Fixed32_.Clone(); + mapFixed64Fixed64_ = other.mapFixed64Fixed64_.Clone(); + mapSfixed32Sfixed32_ = other.mapSfixed32Sfixed32_.Clone(); + mapSfixed64Sfixed64_ = other.mapSfixed64Sfixed64_.Clone(); + mapInt32Float_ = other.mapInt32Float_.Clone(); + mapInt32Double_ = other.mapInt32Double_.Clone(); + mapBoolBool_ = other.mapBoolBool_.Clone(); + mapStringString_ = other.mapStringString_.Clone(); + mapStringBytes_ = other.mapStringBytes_.Clone(); + mapStringNestedMessage_ = other.mapStringNestedMessage_.Clone(); + mapStringForeignMessage_ = other.mapStringForeignMessage_.Clone(); + mapStringNestedEnum_ = other.mapStringNestedEnum_.Clone(); + mapStringForeignEnum_ = other.mapStringForeignEnum_.Clone(); + switch (other.OneofFieldCase) { + case OneofFieldOneofCase.OneofUint32: + OneofUint32 = other.OneofUint32; + break; + case OneofFieldOneofCase.OneofNestedMessage: + OneofNestedMessage = other.OneofNestedMessage.Clone(); + break; + case OneofFieldOneofCase.OneofString: + OneofString = other.OneofString; + break; + case OneofFieldOneofCase.OneofBytes: + OneofBytes = other.OneofBytes; + break; + } + + } + + public TestAllTypes Clone() { + return new TestAllTypes(this); + } + + public const int OptionalInt32FieldNumber = 1; + private int optionalInt32_; + public int OptionalInt32 { + get { return optionalInt32_; } + set { + optionalInt32_ = value; + } + } + + public const int OptionalInt64FieldNumber = 2; + private long optionalInt64_; + public long OptionalInt64 { + get { return optionalInt64_; } + set { + optionalInt64_ = value; + } + } + + public const int OptionalUint32FieldNumber = 3; + private uint optionalUint32_; + public uint OptionalUint32 { + get { return optionalUint32_; } + set { + optionalUint32_ = value; + } + } + + public const int OptionalUint64FieldNumber = 4; + private ulong optionalUint64_; + public ulong OptionalUint64 { + get { return optionalUint64_; } + set { + optionalUint64_ = value; + } + } + + public const int OptionalSint32FieldNumber = 5; + private int optionalSint32_; + public int OptionalSint32 { + get { return optionalSint32_; } + set { + optionalSint32_ = value; + } + } + + public const int OptionalSint64FieldNumber = 6; + private long optionalSint64_; + public long OptionalSint64 { + get { return optionalSint64_; } + set { + optionalSint64_ = value; + } + } + + public const int OptionalFixed32FieldNumber = 7; + private uint optionalFixed32_; + public uint OptionalFixed32 { + get { return optionalFixed32_; } + set { + optionalFixed32_ = value; + } + } + + public const int OptionalFixed64FieldNumber = 8; + private ulong optionalFixed64_; + public ulong OptionalFixed64 { + get { return optionalFixed64_; } + set { + optionalFixed64_ = value; + } + } + + public const int OptionalSfixed32FieldNumber = 9; + private int optionalSfixed32_; + public int OptionalSfixed32 { + get { return optionalSfixed32_; } + set { + optionalSfixed32_ = value; + } + } + + public const int OptionalSfixed64FieldNumber = 10; + private long optionalSfixed64_; + public long OptionalSfixed64 { + get { return optionalSfixed64_; } + set { + optionalSfixed64_ = value; + } + } + + public const int OptionalFloatFieldNumber = 11; + private float optionalFloat_; + public float OptionalFloat { + get { return optionalFloat_; } + set { + optionalFloat_ = value; + } + } + + public const int OptionalDoubleFieldNumber = 12; + private double optionalDouble_; + public double OptionalDouble { + get { return optionalDouble_; } + set { + optionalDouble_ = value; + } + } + + public const int OptionalBoolFieldNumber = 13; + private bool optionalBool_; + public bool OptionalBool { + get { return optionalBool_; } + set { + optionalBool_ = value; + } + } + + public const int OptionalStringFieldNumber = 14; + private string optionalString_ = ""; + public string OptionalString { + get { return optionalString_; } + set { + optionalString_ = pb::Preconditions.CheckNotNull(value, "value"); + } + } + + public const int OptionalBytesFieldNumber = 15; + private pb::ByteString optionalBytes_ = pb::ByteString.Empty; + public pb::ByteString OptionalBytes { + get { return optionalBytes_; } + set { + optionalBytes_ = pb::Preconditions.CheckNotNull(value, "value"); + } + } + + public const int OptionalNestedMessageFieldNumber = 18; + private global::Conformance.TestAllTypes.Types.NestedMessage optionalNestedMessage_; + public global::Conformance.TestAllTypes.Types.NestedMessage OptionalNestedMessage { + get { return optionalNestedMessage_; } + set { + optionalNestedMessage_ = value; + } + } + + public const int OptionalForeignMessageFieldNumber = 19; + private global::Conformance.ForeignMessage optionalForeignMessage_; + public global::Conformance.ForeignMessage OptionalForeignMessage { + get { return optionalForeignMessage_; } + set { + optionalForeignMessage_ = value; + } + } + + public const int OptionalNestedEnumFieldNumber = 21; + private global::Conformance.TestAllTypes.Types.NestedEnum optionalNestedEnum_ = global::Conformance.TestAllTypes.Types.NestedEnum.FOO; + public global::Conformance.TestAllTypes.Types.NestedEnum OptionalNestedEnum { + get { return optionalNestedEnum_; } + set { + optionalNestedEnum_ = value; + } + } + + public const int OptionalForeignEnumFieldNumber = 22; + private global::Conformance.ForeignEnum optionalForeignEnum_ = global::Conformance.ForeignEnum.FOREIGN_FOO; + public global::Conformance.ForeignEnum OptionalForeignEnum { + get { return optionalForeignEnum_; } + set { + optionalForeignEnum_ = value; + } + } + + public const int OptionalStringPieceFieldNumber = 24; + private string optionalStringPiece_ = ""; + public string OptionalStringPiece { + get { return optionalStringPiece_; } + set { + optionalStringPiece_ = pb::Preconditions.CheckNotNull(value, "value"); + } + } + + public const int OptionalCordFieldNumber = 25; + private string optionalCord_ = ""; + public string OptionalCord { + get { return optionalCord_; } + set { + optionalCord_ = pb::Preconditions.CheckNotNull(value, "value"); + } + } + + public const int RecursiveMessageFieldNumber = 27; + private global::Conformance.TestAllTypes recursiveMessage_; + public global::Conformance.TestAllTypes RecursiveMessage { + get { return recursiveMessage_; } + set { + recursiveMessage_ = value; + } + } + + public const int RepeatedInt32FieldNumber = 31; + private static readonly pb::FieldCodec _repeated_repeatedInt32_codec + = pb::FieldCodec.ForInt32(250); + private readonly pbc::RepeatedField repeatedInt32_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedInt32 { + get { return repeatedInt32_; } + } + + public const int RepeatedInt64FieldNumber = 32; + private static readonly pb::FieldCodec _repeated_repeatedInt64_codec + = pb::FieldCodec.ForInt64(258); + private readonly pbc::RepeatedField repeatedInt64_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedInt64 { + get { return repeatedInt64_; } + } + + public const int RepeatedUint32FieldNumber = 33; + private static readonly pb::FieldCodec _repeated_repeatedUint32_codec + = pb::FieldCodec.ForUInt32(266); + private readonly pbc::RepeatedField repeatedUint32_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedUint32 { + get { return repeatedUint32_; } + } + + public const int RepeatedUint64FieldNumber = 34; + private static readonly pb::FieldCodec _repeated_repeatedUint64_codec + = pb::FieldCodec.ForUInt64(274); + private readonly pbc::RepeatedField repeatedUint64_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedUint64 { + get { return repeatedUint64_; } + } + + public const int RepeatedSint32FieldNumber = 35; + private static readonly pb::FieldCodec _repeated_repeatedSint32_codec + = pb::FieldCodec.ForSInt32(282); + private readonly pbc::RepeatedField repeatedSint32_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedSint32 { + get { return repeatedSint32_; } + } + + public const int RepeatedSint64FieldNumber = 36; + private static readonly pb::FieldCodec _repeated_repeatedSint64_codec + = pb::FieldCodec.ForSInt64(290); + private readonly pbc::RepeatedField repeatedSint64_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedSint64 { + get { return repeatedSint64_; } + } + + public const int RepeatedFixed32FieldNumber = 37; + private static readonly pb::FieldCodec _repeated_repeatedFixed32_codec + = pb::FieldCodec.ForFixed32(298); + private readonly pbc::RepeatedField repeatedFixed32_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedFixed32 { + get { return repeatedFixed32_; } + } + + public const int RepeatedFixed64FieldNumber = 38; + private static readonly pb::FieldCodec _repeated_repeatedFixed64_codec + = pb::FieldCodec.ForFixed64(306); + private readonly pbc::RepeatedField repeatedFixed64_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedFixed64 { + get { return repeatedFixed64_; } + } + + public const int RepeatedSfixed32FieldNumber = 39; + private static readonly pb::FieldCodec _repeated_repeatedSfixed32_codec + = pb::FieldCodec.ForSFixed32(314); + private readonly pbc::RepeatedField repeatedSfixed32_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedSfixed32 { + get { return repeatedSfixed32_; } + } + + public const int RepeatedSfixed64FieldNumber = 40; + private static readonly pb::FieldCodec _repeated_repeatedSfixed64_codec + = pb::FieldCodec.ForSFixed64(322); + private readonly pbc::RepeatedField repeatedSfixed64_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedSfixed64 { + get { return repeatedSfixed64_; } + } + + public const int RepeatedFloatFieldNumber = 41; + private static readonly pb::FieldCodec _repeated_repeatedFloat_codec + = pb::FieldCodec.ForFloat(330); + private readonly pbc::RepeatedField repeatedFloat_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedFloat { + get { return repeatedFloat_; } + } + + public const int RepeatedDoubleFieldNumber = 42; + private static readonly pb::FieldCodec _repeated_repeatedDouble_codec + = pb::FieldCodec.ForDouble(338); + private readonly pbc::RepeatedField repeatedDouble_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedDouble { + get { return repeatedDouble_; } + } + + public const int RepeatedBoolFieldNumber = 43; + private static readonly pb::FieldCodec _repeated_repeatedBool_codec + = pb::FieldCodec.ForBool(346); + private readonly pbc::RepeatedField repeatedBool_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedBool { + get { return repeatedBool_; } + } + + public const int RepeatedStringFieldNumber = 44; + private static readonly pb::FieldCodec _repeated_repeatedString_codec + = pb::FieldCodec.ForString(354); + private readonly pbc::RepeatedField repeatedString_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedString { + get { return repeatedString_; } + } + + public const int RepeatedBytesFieldNumber = 45; + private static readonly pb::FieldCodec _repeated_repeatedBytes_codec + = pb::FieldCodec.ForBytes(362); + private readonly pbc::RepeatedField repeatedBytes_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedBytes { + get { return repeatedBytes_; } + } + + public const int RepeatedNestedMessageFieldNumber = 48; + private static readonly pb::FieldCodec _repeated_repeatedNestedMessage_codec + = pb::FieldCodec.ForMessage(386, global::Conformance.TestAllTypes.Types.NestedMessage.Parser); + private readonly pbc::RepeatedField repeatedNestedMessage_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedNestedMessage { + get { return repeatedNestedMessage_; } + } + + public const int RepeatedForeignMessageFieldNumber = 49; + private static readonly pb::FieldCodec _repeated_repeatedForeignMessage_codec + = pb::FieldCodec.ForMessage(394, global::Conformance.ForeignMessage.Parser); + private readonly pbc::RepeatedField repeatedForeignMessage_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedForeignMessage { + get { return repeatedForeignMessage_; } + } + + public const int RepeatedNestedEnumFieldNumber = 51; + private static readonly pb::FieldCodec _repeated_repeatedNestedEnum_codec + = pb::FieldCodec.ForEnum(410, x => (int) x, x => (global::Conformance.TestAllTypes.Types.NestedEnum) x); + private readonly pbc::RepeatedField repeatedNestedEnum_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedNestedEnum { + get { return repeatedNestedEnum_; } + } + + public const int RepeatedForeignEnumFieldNumber = 52; + private static readonly pb::FieldCodec _repeated_repeatedForeignEnum_codec + = pb::FieldCodec.ForEnum(418, x => (int) x, x => (global::Conformance.ForeignEnum) x); + private readonly pbc::RepeatedField repeatedForeignEnum_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedForeignEnum { + get { return repeatedForeignEnum_; } + } + + public const int RepeatedStringPieceFieldNumber = 54; + private static readonly pb::FieldCodec _repeated_repeatedStringPiece_codec + = pb::FieldCodec.ForString(434); + private readonly pbc::RepeatedField repeatedStringPiece_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedStringPiece { + get { return repeatedStringPiece_; } + } + + public const int RepeatedCordFieldNumber = 55; + private static readonly pb::FieldCodec _repeated_repeatedCord_codec + = pb::FieldCodec.ForString(442); + private readonly pbc::RepeatedField repeatedCord_ = new pbc::RepeatedField(); + public pbc::RepeatedField RepeatedCord { + get { return repeatedCord_; } + } + + public const int MapInt32Int32FieldNumber = 56; + private static readonly pbc::MapField.Codec _map_mapInt32Int32_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 450); + private readonly pbc::MapField mapInt32Int32_ = new pbc::MapField(); + public pbc::MapField MapInt32Int32 { + get { return mapInt32Int32_; } + } + + public const int MapInt64Int64FieldNumber = 57; + private static readonly pbc::MapField.Codec _map_mapInt64Int64_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForInt64(8), pb::FieldCodec.ForInt64(16), 458); + private readonly pbc::MapField mapInt64Int64_ = new pbc::MapField(); + public pbc::MapField MapInt64Int64 { + get { return mapInt64Int64_; } + } + + public const int MapUint32Uint32FieldNumber = 58; + private static readonly pbc::MapField.Codec _map_mapUint32Uint32_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForUInt32(8), pb::FieldCodec.ForUInt32(16), 466); + private readonly pbc::MapField mapUint32Uint32_ = new pbc::MapField(); + public pbc::MapField MapUint32Uint32 { + get { return mapUint32Uint32_; } + } + + public const int MapUint64Uint64FieldNumber = 59; + private static readonly pbc::MapField.Codec _map_mapUint64Uint64_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForUInt64(8), pb::FieldCodec.ForUInt64(16), 474); + private readonly pbc::MapField mapUint64Uint64_ = new pbc::MapField(); + public pbc::MapField MapUint64Uint64 { + get { return mapUint64Uint64_; } + } + + public const int MapSint32Sint32FieldNumber = 60; + private static readonly pbc::MapField.Codec _map_mapSint32Sint32_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForSInt32(8), pb::FieldCodec.ForSInt32(16), 482); + private readonly pbc::MapField mapSint32Sint32_ = new pbc::MapField(); + public pbc::MapField MapSint32Sint32 { + get { return mapSint32Sint32_; } + } + + public const int MapSint64Sint64FieldNumber = 61; + private static readonly pbc::MapField.Codec _map_mapSint64Sint64_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForSInt64(8), pb::FieldCodec.ForSInt64(16), 490); + private readonly pbc::MapField mapSint64Sint64_ = new pbc::MapField(); + public pbc::MapField MapSint64Sint64 { + get { return mapSint64Sint64_; } + } + + public const int MapFixed32Fixed32FieldNumber = 62; + private static readonly pbc::MapField.Codec _map_mapFixed32Fixed32_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForFixed32(13), pb::FieldCodec.ForFixed32(21), 498); + private readonly pbc::MapField mapFixed32Fixed32_ = new pbc::MapField(); + public pbc::MapField MapFixed32Fixed32 { + get { return mapFixed32Fixed32_; } + } + + public const int MapFixed64Fixed64FieldNumber = 63; + private static readonly pbc::MapField.Codec _map_mapFixed64Fixed64_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForFixed64(9), pb::FieldCodec.ForFixed64(17), 506); + private readonly pbc::MapField mapFixed64Fixed64_ = new pbc::MapField(); + public pbc::MapField MapFixed64Fixed64 { + get { return mapFixed64Fixed64_; } + } + + public const int MapSfixed32Sfixed32FieldNumber = 64; + private static readonly pbc::MapField.Codec _map_mapSfixed32Sfixed32_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed32(13), pb::FieldCodec.ForSFixed32(21), 514); + private readonly pbc::MapField mapSfixed32Sfixed32_ = new pbc::MapField(); + public pbc::MapField MapSfixed32Sfixed32 { + get { return mapSfixed32Sfixed32_; } + } + + public const int MapSfixed64Sfixed64FieldNumber = 65; + private static readonly pbc::MapField.Codec _map_mapSfixed64Sfixed64_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed64(9), pb::FieldCodec.ForSFixed64(17), 522); + private readonly pbc::MapField mapSfixed64Sfixed64_ = new pbc::MapField(); + public pbc::MapField MapSfixed64Sfixed64 { + get { return mapSfixed64Sfixed64_; } + } + + public const int MapInt32FloatFieldNumber = 66; + private static readonly pbc::MapField.Codec _map_mapInt32Float_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForFloat(21), 530); + private readonly pbc::MapField mapInt32Float_ = new pbc::MapField(); + public pbc::MapField MapInt32Float { + get { return mapInt32Float_; } + } + + public const int MapInt32DoubleFieldNumber = 67; + private static readonly pbc::MapField.Codec _map_mapInt32Double_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForDouble(17), 538); + private readonly pbc::MapField mapInt32Double_ = new pbc::MapField(); + public pbc::MapField MapInt32Double { + get { return mapInt32Double_; } + } + + public const int MapBoolBoolFieldNumber = 68; + private static readonly pbc::MapField.Codec _map_mapBoolBool_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForBool(8), pb::FieldCodec.ForBool(16), 546); + private readonly pbc::MapField mapBoolBool_ = new pbc::MapField(); + public pbc::MapField MapBoolBool { + get { return mapBoolBool_; } + } + + public const int MapStringStringFieldNumber = 69; + private static readonly pbc::MapField.Codec _map_mapStringString_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 554); + private readonly pbc::MapField mapStringString_ = new pbc::MapField(); + public pbc::MapField MapStringString { + get { return mapStringString_; } + } + + public const int MapStringBytesFieldNumber = 70; + private static readonly pbc::MapField.Codec _map_mapStringBytes_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForBytes(18), 562); + private readonly pbc::MapField mapStringBytes_ = new pbc::MapField(); + public pbc::MapField MapStringBytes { + get { return mapStringBytes_; } + } + + public const int MapStringNestedMessageFieldNumber = 71; + private static readonly pbc::MapField.Codec _map_mapStringNestedMessage_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForMessage(18, global::Conformance.TestAllTypes.Types.NestedMessage.Parser), 570); + private readonly pbc::MapField mapStringNestedMessage_ = new pbc::MapField(); + public pbc::MapField MapStringNestedMessage { + get { return mapStringNestedMessage_; } + } + + public const int MapStringForeignMessageFieldNumber = 72; + private static readonly pbc::MapField.Codec _map_mapStringForeignMessage_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForMessage(18, global::Conformance.ForeignMessage.Parser), 578); + private readonly pbc::MapField mapStringForeignMessage_ = new pbc::MapField(); + public pbc::MapField MapStringForeignMessage { + get { return mapStringForeignMessage_; } + } + + public const int MapStringNestedEnumFieldNumber = 73; + private static readonly pbc::MapField.Codec _map_mapStringNestedEnum_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::Conformance.TestAllTypes.Types.NestedEnum) x), 586); + private readonly pbc::MapField mapStringNestedEnum_ = new pbc::MapField(); + public pbc::MapField MapStringNestedEnum { + get { return mapStringNestedEnum_; } + } + + public const int MapStringForeignEnumFieldNumber = 74; + private static readonly pbc::MapField.Codec _map_mapStringForeignEnum_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::Conformance.ForeignEnum) x), 594); + private readonly pbc::MapField mapStringForeignEnum_ = new pbc::MapField(); + public pbc::MapField MapStringForeignEnum { + get { return mapStringForeignEnum_; } + } + + public const int OneofUint32FieldNumber = 111; + public uint OneofUint32 { + get { return oneofFieldCase_ == OneofFieldOneofCase.OneofUint32 ? (uint) oneofField_ : 0; } + set { + oneofField_ = value; + oneofFieldCase_ = OneofFieldOneofCase.OneofUint32; + } + } + + public const int OneofNestedMessageFieldNumber = 112; + public global::Conformance.TestAllTypes.Types.NestedMessage OneofNestedMessage { + get { return oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage ? (global::Conformance.TestAllTypes.Types.NestedMessage) oneofField_ : null; } + set { + oneofField_ = value; + oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.OneofNestedMessage; + } + } + + public const int OneofStringFieldNumber = 113; + public string OneofString { + get { return oneofFieldCase_ == OneofFieldOneofCase.OneofString ? (string) oneofField_ : ""; } + set { + oneofField_ = pb::Preconditions.CheckNotNull(value, "value"); + oneofFieldCase_ = OneofFieldOneofCase.OneofString; + } + } + + public const int OneofBytesFieldNumber = 114; + public pb::ByteString OneofBytes { + get { return oneofFieldCase_ == OneofFieldOneofCase.OneofBytes ? (pb::ByteString) oneofField_ : pb::ByteString.Empty; } + set { + oneofField_ = pb::Preconditions.CheckNotNull(value, "value"); + oneofFieldCase_ = OneofFieldOneofCase.OneofBytes; + } + } + + private object oneofField_; + public enum OneofFieldOneofCase { + None = 0, + OneofUint32 = 111, + OneofNestedMessage = 112, + OneofString = 113, + OneofBytes = 114, + } + private OneofFieldOneofCase oneofFieldCase_ = OneofFieldOneofCase.None; + public OneofFieldOneofCase OneofFieldCase { + get { return oneofFieldCase_; } + } + + public void ClearOneofField() { + oneofFieldCase_ = OneofFieldOneofCase.None; + oneofField_ = null; + } + + public override bool Equals(object other) { + return Equals(other as TestAllTypes); + } + + public bool Equals(TestAllTypes other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (OptionalInt32 != other.OptionalInt32) return false; + if (OptionalInt64 != other.OptionalInt64) return false; + if (OptionalUint32 != other.OptionalUint32) return false; + if (OptionalUint64 != other.OptionalUint64) return false; + if (OptionalSint32 != other.OptionalSint32) return false; + if (OptionalSint64 != other.OptionalSint64) return false; + if (OptionalFixed32 != other.OptionalFixed32) return false; + if (OptionalFixed64 != other.OptionalFixed64) return false; + if (OptionalSfixed32 != other.OptionalSfixed32) return false; + if (OptionalSfixed64 != other.OptionalSfixed64) return false; + if (OptionalFloat != other.OptionalFloat) return false; + if (OptionalDouble != other.OptionalDouble) return false; + if (OptionalBool != other.OptionalBool) return false; + if (OptionalString != other.OptionalString) return false; + if (OptionalBytes != other.OptionalBytes) return false; + if (!object.Equals(OptionalNestedMessage, other.OptionalNestedMessage)) return false; + if (!object.Equals(OptionalForeignMessage, other.OptionalForeignMessage)) return false; + if (OptionalNestedEnum != other.OptionalNestedEnum) return false; + if (OptionalForeignEnum != other.OptionalForeignEnum) return false; + if (OptionalStringPiece != other.OptionalStringPiece) return false; + if (OptionalCord != other.OptionalCord) return false; + if (!object.Equals(RecursiveMessage, other.RecursiveMessage)) return false; + if(!repeatedInt32_.Equals(other.repeatedInt32_)) return false; + if(!repeatedInt64_.Equals(other.repeatedInt64_)) return false; + if(!repeatedUint32_.Equals(other.repeatedUint32_)) return false; + if(!repeatedUint64_.Equals(other.repeatedUint64_)) return false; + if(!repeatedSint32_.Equals(other.repeatedSint32_)) return false; + if(!repeatedSint64_.Equals(other.repeatedSint64_)) return false; + if(!repeatedFixed32_.Equals(other.repeatedFixed32_)) return false; + if(!repeatedFixed64_.Equals(other.repeatedFixed64_)) return false; + if(!repeatedSfixed32_.Equals(other.repeatedSfixed32_)) return false; + if(!repeatedSfixed64_.Equals(other.repeatedSfixed64_)) return false; + if(!repeatedFloat_.Equals(other.repeatedFloat_)) return false; + if(!repeatedDouble_.Equals(other.repeatedDouble_)) return false; + if(!repeatedBool_.Equals(other.repeatedBool_)) return false; + if(!repeatedString_.Equals(other.repeatedString_)) return false; + if(!repeatedBytes_.Equals(other.repeatedBytes_)) return false; + if(!repeatedNestedMessage_.Equals(other.repeatedNestedMessage_)) return false; + if(!repeatedForeignMessage_.Equals(other.repeatedForeignMessage_)) return false; + if(!repeatedNestedEnum_.Equals(other.repeatedNestedEnum_)) return false; + if(!repeatedForeignEnum_.Equals(other.repeatedForeignEnum_)) return false; + if(!repeatedStringPiece_.Equals(other.repeatedStringPiece_)) return false; + if(!repeatedCord_.Equals(other.repeatedCord_)) return false; + if (!MapInt32Int32.Equals(other.MapInt32Int32)) return false; + if (!MapInt64Int64.Equals(other.MapInt64Int64)) return false; + if (!MapUint32Uint32.Equals(other.MapUint32Uint32)) return false; + if (!MapUint64Uint64.Equals(other.MapUint64Uint64)) return false; + if (!MapSint32Sint32.Equals(other.MapSint32Sint32)) return false; + if (!MapSint64Sint64.Equals(other.MapSint64Sint64)) return false; + if (!MapFixed32Fixed32.Equals(other.MapFixed32Fixed32)) return false; + if (!MapFixed64Fixed64.Equals(other.MapFixed64Fixed64)) return false; + if (!MapSfixed32Sfixed32.Equals(other.MapSfixed32Sfixed32)) return false; + if (!MapSfixed64Sfixed64.Equals(other.MapSfixed64Sfixed64)) return false; + if (!MapInt32Float.Equals(other.MapInt32Float)) return false; + if (!MapInt32Double.Equals(other.MapInt32Double)) return false; + if (!MapBoolBool.Equals(other.MapBoolBool)) return false; + if (!MapStringString.Equals(other.MapStringString)) return false; + if (!MapStringBytes.Equals(other.MapStringBytes)) return false; + if (!MapStringNestedMessage.Equals(other.MapStringNestedMessage)) return false; + if (!MapStringForeignMessage.Equals(other.MapStringForeignMessage)) return false; + if (!MapStringNestedEnum.Equals(other.MapStringNestedEnum)) return false; + if (!MapStringForeignEnum.Equals(other.MapStringForeignEnum)) return false; + if (OneofUint32 != other.OneofUint32) return false; + if (!object.Equals(OneofNestedMessage, other.OneofNestedMessage)) return false; + if (OneofString != other.OneofString) return false; + if (OneofBytes != other.OneofBytes) return false; + return true; + } + + public override int GetHashCode() { + int hash = 1; + if (OptionalInt32 != 0) hash ^= OptionalInt32.GetHashCode(); + if (OptionalInt64 != 0L) hash ^= OptionalInt64.GetHashCode(); + if (OptionalUint32 != 0) hash ^= OptionalUint32.GetHashCode(); + if (OptionalUint64 != 0UL) hash ^= OptionalUint64.GetHashCode(); + if (OptionalSint32 != 0) hash ^= OptionalSint32.GetHashCode(); + if (OptionalSint64 != 0L) hash ^= OptionalSint64.GetHashCode(); + if (OptionalFixed32 != 0) hash ^= OptionalFixed32.GetHashCode(); + if (OptionalFixed64 != 0UL) hash ^= OptionalFixed64.GetHashCode(); + if (OptionalSfixed32 != 0) hash ^= OptionalSfixed32.GetHashCode(); + if (OptionalSfixed64 != 0L) hash ^= OptionalSfixed64.GetHashCode(); + if (OptionalFloat != 0F) hash ^= OptionalFloat.GetHashCode(); + if (OptionalDouble != 0D) hash ^= OptionalDouble.GetHashCode(); + if (OptionalBool != false) hash ^= OptionalBool.GetHashCode(); + if (OptionalString.Length != 0) hash ^= OptionalString.GetHashCode(); + if (OptionalBytes.Length != 0) hash ^= OptionalBytes.GetHashCode(); + if (optionalNestedMessage_ != null) hash ^= OptionalNestedMessage.GetHashCode(); + if (optionalForeignMessage_ != null) hash ^= OptionalForeignMessage.GetHashCode(); + if (OptionalNestedEnum != global::Conformance.TestAllTypes.Types.NestedEnum.FOO) hash ^= OptionalNestedEnum.GetHashCode(); + if (OptionalForeignEnum != global::Conformance.ForeignEnum.FOREIGN_FOO) hash ^= OptionalForeignEnum.GetHashCode(); + if (OptionalStringPiece.Length != 0) hash ^= OptionalStringPiece.GetHashCode(); + if (OptionalCord.Length != 0) hash ^= OptionalCord.GetHashCode(); + if (recursiveMessage_ != null) hash ^= RecursiveMessage.GetHashCode(); + hash ^= repeatedInt32_.GetHashCode(); + hash ^= repeatedInt64_.GetHashCode(); + hash ^= repeatedUint32_.GetHashCode(); + hash ^= repeatedUint64_.GetHashCode(); + hash ^= repeatedSint32_.GetHashCode(); + hash ^= repeatedSint64_.GetHashCode(); + hash ^= repeatedFixed32_.GetHashCode(); + hash ^= repeatedFixed64_.GetHashCode(); + hash ^= repeatedSfixed32_.GetHashCode(); + hash ^= repeatedSfixed64_.GetHashCode(); + hash ^= repeatedFloat_.GetHashCode(); + hash ^= repeatedDouble_.GetHashCode(); + hash ^= repeatedBool_.GetHashCode(); + hash ^= repeatedString_.GetHashCode(); + hash ^= repeatedBytes_.GetHashCode(); + hash ^= repeatedNestedMessage_.GetHashCode(); + hash ^= repeatedForeignMessage_.GetHashCode(); + hash ^= repeatedNestedEnum_.GetHashCode(); + hash ^= repeatedForeignEnum_.GetHashCode(); + hash ^= repeatedStringPiece_.GetHashCode(); + hash ^= repeatedCord_.GetHashCode(); + hash ^= MapInt32Int32.GetHashCode(); + hash ^= MapInt64Int64.GetHashCode(); + hash ^= MapUint32Uint32.GetHashCode(); + hash ^= MapUint64Uint64.GetHashCode(); + hash ^= MapSint32Sint32.GetHashCode(); + hash ^= MapSint64Sint64.GetHashCode(); + hash ^= MapFixed32Fixed32.GetHashCode(); + hash ^= MapFixed64Fixed64.GetHashCode(); + hash ^= MapSfixed32Sfixed32.GetHashCode(); + hash ^= MapSfixed64Sfixed64.GetHashCode(); + hash ^= MapInt32Float.GetHashCode(); + hash ^= MapInt32Double.GetHashCode(); + hash ^= MapBoolBool.GetHashCode(); + hash ^= MapStringString.GetHashCode(); + hash ^= MapStringBytes.GetHashCode(); + hash ^= MapStringNestedMessage.GetHashCode(); + hash ^= MapStringForeignMessage.GetHashCode(); + hash ^= MapStringNestedEnum.GetHashCode(); + hash ^= MapStringForeignEnum.GetHashCode(); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofUint32) hash ^= OneofUint32.GetHashCode(); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) hash ^= OneofNestedMessage.GetHashCode(); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofString) hash ^= OneofString.GetHashCode(); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofBytes) hash ^= OneofBytes.GetHashCode(); + return hash; + } + + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + + public void WriteTo(pb::CodedOutputStream output) { + if (OptionalInt32 != 0) { + output.WriteRawTag(8); + output.WriteInt32(OptionalInt32); + } + if (OptionalInt64 != 0L) { + output.WriteRawTag(16); + output.WriteInt64(OptionalInt64); + } + if (OptionalUint32 != 0) { + output.WriteRawTag(24); + output.WriteUInt32(OptionalUint32); + } + if (OptionalUint64 != 0UL) { + output.WriteRawTag(32); + output.WriteUInt64(OptionalUint64); + } + if (OptionalSint32 != 0) { + output.WriteRawTag(40); + output.WriteSInt32(OptionalSint32); + } + if (OptionalSint64 != 0L) { + output.WriteRawTag(48); + output.WriteSInt64(OptionalSint64); + } + if (OptionalFixed32 != 0) { + output.WriteRawTag(61); + output.WriteFixed32(OptionalFixed32); + } + if (OptionalFixed64 != 0UL) { + output.WriteRawTag(65); + output.WriteFixed64(OptionalFixed64); + } + if (OptionalSfixed32 != 0) { + output.WriteRawTag(77); + output.WriteSFixed32(OptionalSfixed32); + } + if (OptionalSfixed64 != 0L) { + output.WriteRawTag(81); + output.WriteSFixed64(OptionalSfixed64); + } + if (OptionalFloat != 0F) { + output.WriteRawTag(93); + output.WriteFloat(OptionalFloat); + } + if (OptionalDouble != 0D) { + output.WriteRawTag(97); + output.WriteDouble(OptionalDouble); + } + if (OptionalBool != false) { + output.WriteRawTag(104); + output.WriteBool(OptionalBool); + } + if (OptionalString.Length != 0) { + output.WriteRawTag(114); + output.WriteString(OptionalString); + } + if (OptionalBytes.Length != 0) { + output.WriteRawTag(122); + output.WriteBytes(OptionalBytes); + } + if (optionalNestedMessage_ != null) { + output.WriteRawTag(146, 1); + output.WriteMessage(OptionalNestedMessage); + } + if (optionalForeignMessage_ != null) { + output.WriteRawTag(154, 1); + output.WriteMessage(OptionalForeignMessage); + } + if (OptionalNestedEnum != global::Conformance.TestAllTypes.Types.NestedEnum.FOO) { + output.WriteRawTag(168, 1); + output.WriteEnum((int) OptionalNestedEnum); + } + if (OptionalForeignEnum != global::Conformance.ForeignEnum.FOREIGN_FOO) { + output.WriteRawTag(176, 1); + output.WriteEnum((int) OptionalForeignEnum); + } + if (OptionalStringPiece.Length != 0) { + output.WriteRawTag(194, 1); + output.WriteString(OptionalStringPiece); + } + if (OptionalCord.Length != 0) { + output.WriteRawTag(202, 1); + output.WriteString(OptionalCord); + } + if (recursiveMessage_ != null) { + output.WriteRawTag(218, 1); + output.WriteMessage(RecursiveMessage); + } + repeatedInt32_.WriteTo(output, _repeated_repeatedInt32_codec); + repeatedInt64_.WriteTo(output, _repeated_repeatedInt64_codec); + repeatedUint32_.WriteTo(output, _repeated_repeatedUint32_codec); + repeatedUint64_.WriteTo(output, _repeated_repeatedUint64_codec); + repeatedSint32_.WriteTo(output, _repeated_repeatedSint32_codec); + repeatedSint64_.WriteTo(output, _repeated_repeatedSint64_codec); + repeatedFixed32_.WriteTo(output, _repeated_repeatedFixed32_codec); + repeatedFixed64_.WriteTo(output, _repeated_repeatedFixed64_codec); + repeatedSfixed32_.WriteTo(output, _repeated_repeatedSfixed32_codec); + repeatedSfixed64_.WriteTo(output, _repeated_repeatedSfixed64_codec); + repeatedFloat_.WriteTo(output, _repeated_repeatedFloat_codec); + repeatedDouble_.WriteTo(output, _repeated_repeatedDouble_codec); + repeatedBool_.WriteTo(output, _repeated_repeatedBool_codec); + repeatedString_.WriteTo(output, _repeated_repeatedString_codec); + repeatedBytes_.WriteTo(output, _repeated_repeatedBytes_codec); + repeatedNestedMessage_.WriteTo(output, _repeated_repeatedNestedMessage_codec); + repeatedForeignMessage_.WriteTo(output, _repeated_repeatedForeignMessage_codec); + repeatedNestedEnum_.WriteTo(output, _repeated_repeatedNestedEnum_codec); + repeatedForeignEnum_.WriteTo(output, _repeated_repeatedForeignEnum_codec); + repeatedStringPiece_.WriteTo(output, _repeated_repeatedStringPiece_codec); + repeatedCord_.WriteTo(output, _repeated_repeatedCord_codec); + mapInt32Int32_.WriteTo(output, _map_mapInt32Int32_codec); + mapInt64Int64_.WriteTo(output, _map_mapInt64Int64_codec); + mapUint32Uint32_.WriteTo(output, _map_mapUint32Uint32_codec); + mapUint64Uint64_.WriteTo(output, _map_mapUint64Uint64_codec); + mapSint32Sint32_.WriteTo(output, _map_mapSint32Sint32_codec); + mapSint64Sint64_.WriteTo(output, _map_mapSint64Sint64_codec); + mapFixed32Fixed32_.WriteTo(output, _map_mapFixed32Fixed32_codec); + mapFixed64Fixed64_.WriteTo(output, _map_mapFixed64Fixed64_codec); + mapSfixed32Sfixed32_.WriteTo(output, _map_mapSfixed32Sfixed32_codec); + mapSfixed64Sfixed64_.WriteTo(output, _map_mapSfixed64Sfixed64_codec); + mapInt32Float_.WriteTo(output, _map_mapInt32Float_codec); + mapInt32Double_.WriteTo(output, _map_mapInt32Double_codec); + mapBoolBool_.WriteTo(output, _map_mapBoolBool_codec); + mapStringString_.WriteTo(output, _map_mapStringString_codec); + mapStringBytes_.WriteTo(output, _map_mapStringBytes_codec); + mapStringNestedMessage_.WriteTo(output, _map_mapStringNestedMessage_codec); + mapStringForeignMessage_.WriteTo(output, _map_mapStringForeignMessage_codec); + mapStringNestedEnum_.WriteTo(output, _map_mapStringNestedEnum_codec); + mapStringForeignEnum_.WriteTo(output, _map_mapStringForeignEnum_codec); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofUint32) { + output.WriteRawTag(248, 6); + output.WriteUInt32(OneofUint32); + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) { + output.WriteRawTag(130, 7); + output.WriteMessage(OneofNestedMessage); + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofString) { + output.WriteRawTag(138, 7); + output.WriteString(OneofString); + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofBytes) { + output.WriteRawTag(146, 7); + output.WriteBytes(OneofBytes); + } + } + + public int CalculateSize() { + int size = 0; + if (OptionalInt32 != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(OptionalInt32); + } + if (OptionalInt64 != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(OptionalInt64); + } + if (OptionalUint32 != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(OptionalUint32); + } + if (OptionalUint64 != 0UL) { + size += 1 + pb::CodedOutputStream.ComputeUInt64Size(OptionalUint64); + } + if (OptionalSint32 != 0) { + size += 1 + pb::CodedOutputStream.ComputeSInt32Size(OptionalSint32); + } + if (OptionalSint64 != 0L) { + size += 1 + pb::CodedOutputStream.ComputeSInt64Size(OptionalSint64); + } + if (OptionalFixed32 != 0) { + size += 1 + 4; + } + if (OptionalFixed64 != 0UL) { + size += 1 + 8; + } + if (OptionalSfixed32 != 0) { + size += 1 + 4; + } + if (OptionalSfixed64 != 0L) { + size += 1 + 8; + } + if (OptionalFloat != 0F) { + size += 1 + 4; + } + if (OptionalDouble != 0D) { + size += 1 + 8; + } + if (OptionalBool != false) { + size += 1 + 1; + } + if (OptionalString.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OptionalString); + } + if (OptionalBytes.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(OptionalBytes); + } + if (optionalNestedMessage_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalNestedMessage); + } + if (optionalForeignMessage_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalForeignMessage); + } + if (OptionalNestedEnum != global::Conformance.TestAllTypes.Types.NestedEnum.FOO) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) OptionalNestedEnum); + } + if (OptionalForeignEnum != global::Conformance.ForeignEnum.FOREIGN_FOO) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) OptionalForeignEnum); + } + if (OptionalStringPiece.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(OptionalStringPiece); + } + if (OptionalCord.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(OptionalCord); + } + if (recursiveMessage_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(RecursiveMessage); + } + size += repeatedInt32_.CalculateSize(_repeated_repeatedInt32_codec); + size += repeatedInt64_.CalculateSize(_repeated_repeatedInt64_codec); + size += repeatedUint32_.CalculateSize(_repeated_repeatedUint32_codec); + size += repeatedUint64_.CalculateSize(_repeated_repeatedUint64_codec); + size += repeatedSint32_.CalculateSize(_repeated_repeatedSint32_codec); + size += repeatedSint64_.CalculateSize(_repeated_repeatedSint64_codec); + size += repeatedFixed32_.CalculateSize(_repeated_repeatedFixed32_codec); + size += repeatedFixed64_.CalculateSize(_repeated_repeatedFixed64_codec); + size += repeatedSfixed32_.CalculateSize(_repeated_repeatedSfixed32_codec); + size += repeatedSfixed64_.CalculateSize(_repeated_repeatedSfixed64_codec); + size += repeatedFloat_.CalculateSize(_repeated_repeatedFloat_codec); + size += repeatedDouble_.CalculateSize(_repeated_repeatedDouble_codec); + size += repeatedBool_.CalculateSize(_repeated_repeatedBool_codec); + size += repeatedString_.CalculateSize(_repeated_repeatedString_codec); + size += repeatedBytes_.CalculateSize(_repeated_repeatedBytes_codec); + size += repeatedNestedMessage_.CalculateSize(_repeated_repeatedNestedMessage_codec); + size += repeatedForeignMessage_.CalculateSize(_repeated_repeatedForeignMessage_codec); + size += repeatedNestedEnum_.CalculateSize(_repeated_repeatedNestedEnum_codec); + size += repeatedForeignEnum_.CalculateSize(_repeated_repeatedForeignEnum_codec); + size += repeatedStringPiece_.CalculateSize(_repeated_repeatedStringPiece_codec); + size += repeatedCord_.CalculateSize(_repeated_repeatedCord_codec); + size += mapInt32Int32_.CalculateSize(_map_mapInt32Int32_codec); + size += mapInt64Int64_.CalculateSize(_map_mapInt64Int64_codec); + size += mapUint32Uint32_.CalculateSize(_map_mapUint32Uint32_codec); + size += mapUint64Uint64_.CalculateSize(_map_mapUint64Uint64_codec); + size += mapSint32Sint32_.CalculateSize(_map_mapSint32Sint32_codec); + size += mapSint64Sint64_.CalculateSize(_map_mapSint64Sint64_codec); + size += mapFixed32Fixed32_.CalculateSize(_map_mapFixed32Fixed32_codec); + size += mapFixed64Fixed64_.CalculateSize(_map_mapFixed64Fixed64_codec); + size += mapSfixed32Sfixed32_.CalculateSize(_map_mapSfixed32Sfixed32_codec); + size += mapSfixed64Sfixed64_.CalculateSize(_map_mapSfixed64Sfixed64_codec); + size += mapInt32Float_.CalculateSize(_map_mapInt32Float_codec); + size += mapInt32Double_.CalculateSize(_map_mapInt32Double_codec); + size += mapBoolBool_.CalculateSize(_map_mapBoolBool_codec); + size += mapStringString_.CalculateSize(_map_mapStringString_codec); + size += mapStringBytes_.CalculateSize(_map_mapStringBytes_codec); + size += mapStringNestedMessage_.CalculateSize(_map_mapStringNestedMessage_codec); + size += mapStringForeignMessage_.CalculateSize(_map_mapStringForeignMessage_codec); + size += mapStringNestedEnum_.CalculateSize(_map_mapStringNestedEnum_codec); + size += mapStringForeignEnum_.CalculateSize(_map_mapStringForeignEnum_codec); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofUint32) { + size += 2 + pb::CodedOutputStream.ComputeUInt32Size(OneofUint32); + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(OneofNestedMessage); + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofString) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(OneofString); + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofBytes) { + size += 2 + pb::CodedOutputStream.ComputeBytesSize(OneofBytes); + } + return size; + } + + public void MergeFrom(TestAllTypes other) { + if (other == null) { + return; + } + if (other.OptionalInt32 != 0) { + OptionalInt32 = other.OptionalInt32; + } + if (other.OptionalInt64 != 0L) { + OptionalInt64 = other.OptionalInt64; + } + if (other.OptionalUint32 != 0) { + OptionalUint32 = other.OptionalUint32; + } + if (other.OptionalUint64 != 0UL) { + OptionalUint64 = other.OptionalUint64; + } + if (other.OptionalSint32 != 0) { + OptionalSint32 = other.OptionalSint32; + } + if (other.OptionalSint64 != 0L) { + OptionalSint64 = other.OptionalSint64; + } + if (other.OptionalFixed32 != 0) { + OptionalFixed32 = other.OptionalFixed32; + } + if (other.OptionalFixed64 != 0UL) { + OptionalFixed64 = other.OptionalFixed64; + } + if (other.OptionalSfixed32 != 0) { + OptionalSfixed32 = other.OptionalSfixed32; + } + if (other.OptionalSfixed64 != 0L) { + OptionalSfixed64 = other.OptionalSfixed64; + } + if (other.OptionalFloat != 0F) { + OptionalFloat = other.OptionalFloat; + } + if (other.OptionalDouble != 0D) { + OptionalDouble = other.OptionalDouble; + } + if (other.OptionalBool != false) { + OptionalBool = other.OptionalBool; + } + if (other.OptionalString.Length != 0) { + OptionalString = other.OptionalString; + } + if (other.OptionalBytes.Length != 0) { + OptionalBytes = other.OptionalBytes; + } + if (other.optionalNestedMessage_ != null) { + if (optionalNestedMessage_ == null) { + optionalNestedMessage_ = new global::Conformance.TestAllTypes.Types.NestedMessage(); + } + OptionalNestedMessage.MergeFrom(other.OptionalNestedMessage); + } + if (other.optionalForeignMessage_ != null) { + if (optionalForeignMessage_ == null) { + optionalForeignMessage_ = new global::Conformance.ForeignMessage(); + } + OptionalForeignMessage.MergeFrom(other.OptionalForeignMessage); + } + if (other.OptionalNestedEnum != global::Conformance.TestAllTypes.Types.NestedEnum.FOO) { + OptionalNestedEnum = other.OptionalNestedEnum; + } + if (other.OptionalForeignEnum != global::Conformance.ForeignEnum.FOREIGN_FOO) { + OptionalForeignEnum = other.OptionalForeignEnum; + } + if (other.OptionalStringPiece.Length != 0) { + OptionalStringPiece = other.OptionalStringPiece; + } + if (other.OptionalCord.Length != 0) { + OptionalCord = other.OptionalCord; + } + if (other.recursiveMessage_ != null) { + if (recursiveMessage_ == null) { + recursiveMessage_ = new global::Conformance.TestAllTypes(); + } + RecursiveMessage.MergeFrom(other.RecursiveMessage); + } + repeatedInt32_.Add(other.repeatedInt32_); + repeatedInt64_.Add(other.repeatedInt64_); + repeatedUint32_.Add(other.repeatedUint32_); + repeatedUint64_.Add(other.repeatedUint64_); + repeatedSint32_.Add(other.repeatedSint32_); + repeatedSint64_.Add(other.repeatedSint64_); + repeatedFixed32_.Add(other.repeatedFixed32_); + repeatedFixed64_.Add(other.repeatedFixed64_); + repeatedSfixed32_.Add(other.repeatedSfixed32_); + repeatedSfixed64_.Add(other.repeatedSfixed64_); + repeatedFloat_.Add(other.repeatedFloat_); + repeatedDouble_.Add(other.repeatedDouble_); + repeatedBool_.Add(other.repeatedBool_); + repeatedString_.Add(other.repeatedString_); + repeatedBytes_.Add(other.repeatedBytes_); + repeatedNestedMessage_.Add(other.repeatedNestedMessage_); + repeatedForeignMessage_.Add(other.repeatedForeignMessage_); + repeatedNestedEnum_.Add(other.repeatedNestedEnum_); + repeatedForeignEnum_.Add(other.repeatedForeignEnum_); + repeatedStringPiece_.Add(other.repeatedStringPiece_); + repeatedCord_.Add(other.repeatedCord_); + mapInt32Int32_.Add(other.mapInt32Int32_); + mapInt64Int64_.Add(other.mapInt64Int64_); + mapUint32Uint32_.Add(other.mapUint32Uint32_); + mapUint64Uint64_.Add(other.mapUint64Uint64_); + mapSint32Sint32_.Add(other.mapSint32Sint32_); + mapSint64Sint64_.Add(other.mapSint64Sint64_); + mapFixed32Fixed32_.Add(other.mapFixed32Fixed32_); + mapFixed64Fixed64_.Add(other.mapFixed64Fixed64_); + mapSfixed32Sfixed32_.Add(other.mapSfixed32Sfixed32_); + mapSfixed64Sfixed64_.Add(other.mapSfixed64Sfixed64_); + mapInt32Float_.Add(other.mapInt32Float_); + mapInt32Double_.Add(other.mapInt32Double_); + mapBoolBool_.Add(other.mapBoolBool_); + mapStringString_.Add(other.mapStringString_); + mapStringBytes_.Add(other.mapStringBytes_); + mapStringNestedMessage_.Add(other.mapStringNestedMessage_); + mapStringForeignMessage_.Add(other.mapStringForeignMessage_); + mapStringNestedEnum_.Add(other.mapStringNestedEnum_); + mapStringForeignEnum_.Add(other.mapStringForeignEnum_); + switch (other.OneofFieldCase) { + case OneofFieldOneofCase.OneofUint32: + OneofUint32 = other.OneofUint32; + break; + case OneofFieldOneofCase.OneofNestedMessage: + OneofNestedMessage = other.OneofNestedMessage; + break; + case OneofFieldOneofCase.OneofString: + OneofString = other.OneofString; + break; + case OneofFieldOneofCase.OneofBytes: + OneofBytes = other.OneofBytes; + break; + } + + } + + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while (input.ReadTag(out tag)) { + switch(tag) { + case 0: + throw pb::InvalidProtocolBufferException.InvalidTag(); + default: + if (pb::WireFormat.IsEndGroupTag(tag)) { + return; + } + break; + case 8: { + OptionalInt32 = input.ReadInt32(); + break; + } + case 16: { + OptionalInt64 = input.ReadInt64(); + break; + } + case 24: { + OptionalUint32 = input.ReadUInt32(); + break; + } + case 32: { + OptionalUint64 = input.ReadUInt64(); + break; + } + case 40: { + OptionalSint32 = input.ReadSInt32(); + break; + } + case 48: { + OptionalSint64 = input.ReadSInt64(); + break; + } + case 61: { + OptionalFixed32 = input.ReadFixed32(); + break; + } + case 65: { + OptionalFixed64 = input.ReadFixed64(); + break; + } + case 77: { + OptionalSfixed32 = input.ReadSFixed32(); + break; + } + case 81: { + OptionalSfixed64 = input.ReadSFixed64(); + break; + } + case 93: { + OptionalFloat = input.ReadFloat(); + break; + } + case 97: { + OptionalDouble = input.ReadDouble(); + break; + } + case 104: { + OptionalBool = input.ReadBool(); + break; + } + case 114: { + OptionalString = input.ReadString(); + break; + } + case 122: { + OptionalBytes = input.ReadBytes(); + break; + } + case 146: { + if (optionalNestedMessage_ == null) { + optionalNestedMessage_ = new global::Conformance.TestAllTypes.Types.NestedMessage(); + } + input.ReadMessage(optionalNestedMessage_); + break; + } + case 154: { + if (optionalForeignMessage_ == null) { + optionalForeignMessage_ = new global::Conformance.ForeignMessage(); + } + input.ReadMessage(optionalForeignMessage_); + break; + } + case 168: { + optionalNestedEnum_ = (global::Conformance.TestAllTypes.Types.NestedEnum) input.ReadEnum(); + break; + } + case 176: { + optionalForeignEnum_ = (global::Conformance.ForeignEnum) input.ReadEnum(); + break; + } + case 194: { + OptionalStringPiece = input.ReadString(); + break; + } + case 202: { + OptionalCord = input.ReadString(); + break; + } + case 218: { + if (recursiveMessage_ == null) { + recursiveMessage_ = new global::Conformance.TestAllTypes(); + } + input.ReadMessage(recursiveMessage_); + break; + } + case 250: + case 248: { + repeatedInt32_.AddEntriesFrom(input, _repeated_repeatedInt32_codec); + break; + } + case 258: + case 256: { + repeatedInt64_.AddEntriesFrom(input, _repeated_repeatedInt64_codec); + break; + } + case 266: + case 264: { + repeatedUint32_.AddEntriesFrom(input, _repeated_repeatedUint32_codec); + break; + } + case 274: + case 272: { + repeatedUint64_.AddEntriesFrom(input, _repeated_repeatedUint64_codec); + break; + } + case 282: + case 280: { + repeatedSint32_.AddEntriesFrom(input, _repeated_repeatedSint32_codec); + break; + } + case 290: + case 288: { + repeatedSint64_.AddEntriesFrom(input, _repeated_repeatedSint64_codec); + break; + } + case 298: + case 301: { + repeatedFixed32_.AddEntriesFrom(input, _repeated_repeatedFixed32_codec); + break; + } + case 306: + case 305: { + repeatedFixed64_.AddEntriesFrom(input, _repeated_repeatedFixed64_codec); + break; + } + case 314: + case 317: { + repeatedSfixed32_.AddEntriesFrom(input, _repeated_repeatedSfixed32_codec); + break; + } + case 322: + case 321: { + repeatedSfixed64_.AddEntriesFrom(input, _repeated_repeatedSfixed64_codec); + break; + } + case 330: + case 333: { + repeatedFloat_.AddEntriesFrom(input, _repeated_repeatedFloat_codec); + break; + } + case 338: + case 337: { + repeatedDouble_.AddEntriesFrom(input, _repeated_repeatedDouble_codec); + break; + } + case 346: + case 344: { + repeatedBool_.AddEntriesFrom(input, _repeated_repeatedBool_codec); + break; + } + case 354: { + repeatedString_.AddEntriesFrom(input, _repeated_repeatedString_codec); + break; + } + case 362: { + repeatedBytes_.AddEntriesFrom(input, _repeated_repeatedBytes_codec); + break; + } + case 386: { + repeatedNestedMessage_.AddEntriesFrom(input, _repeated_repeatedNestedMessage_codec); + break; + } + case 394: { + repeatedForeignMessage_.AddEntriesFrom(input, _repeated_repeatedForeignMessage_codec); + break; + } + case 410: + case 408: { + repeatedNestedEnum_.AddEntriesFrom(input, _repeated_repeatedNestedEnum_codec); + break; + } + case 418: + case 416: { + repeatedForeignEnum_.AddEntriesFrom(input, _repeated_repeatedForeignEnum_codec); + break; + } + case 434: { + repeatedStringPiece_.AddEntriesFrom(input, _repeated_repeatedStringPiece_codec); + break; + } + case 442: { + repeatedCord_.AddEntriesFrom(input, _repeated_repeatedCord_codec); + break; + } + case 450: { + mapInt32Int32_.AddEntriesFrom(input, _map_mapInt32Int32_codec); + break; + } + case 458: { + mapInt64Int64_.AddEntriesFrom(input, _map_mapInt64Int64_codec); + break; + } + case 466: { + mapUint32Uint32_.AddEntriesFrom(input, _map_mapUint32Uint32_codec); + break; + } + case 474: { + mapUint64Uint64_.AddEntriesFrom(input, _map_mapUint64Uint64_codec); + break; + } + case 482: { + mapSint32Sint32_.AddEntriesFrom(input, _map_mapSint32Sint32_codec); + break; + } + case 490: { + mapSint64Sint64_.AddEntriesFrom(input, _map_mapSint64Sint64_codec); + break; + } + case 498: { + mapFixed32Fixed32_.AddEntriesFrom(input, _map_mapFixed32Fixed32_codec); + break; + } + case 506: { + mapFixed64Fixed64_.AddEntriesFrom(input, _map_mapFixed64Fixed64_codec); + break; + } + case 514: { + mapSfixed32Sfixed32_.AddEntriesFrom(input, _map_mapSfixed32Sfixed32_codec); + break; + } + case 522: { + mapSfixed64Sfixed64_.AddEntriesFrom(input, _map_mapSfixed64Sfixed64_codec); + break; + } + case 530: { + mapInt32Float_.AddEntriesFrom(input, _map_mapInt32Float_codec); + break; + } + case 538: { + mapInt32Double_.AddEntriesFrom(input, _map_mapInt32Double_codec); + break; + } + case 546: { + mapBoolBool_.AddEntriesFrom(input, _map_mapBoolBool_codec); + break; + } + case 554: { + mapStringString_.AddEntriesFrom(input, _map_mapStringString_codec); + break; + } + case 562: { + mapStringBytes_.AddEntriesFrom(input, _map_mapStringBytes_codec); + break; + } + case 570: { + mapStringNestedMessage_.AddEntriesFrom(input, _map_mapStringNestedMessage_codec); + break; + } + case 578: { + mapStringForeignMessage_.AddEntriesFrom(input, _map_mapStringForeignMessage_codec); + break; + } + case 586: { + mapStringNestedEnum_.AddEntriesFrom(input, _map_mapStringNestedEnum_codec); + break; + } + case 594: { + mapStringForeignEnum_.AddEntriesFrom(input, _map_mapStringForeignEnum_codec); + break; + } + case 888: { + OneofUint32 = input.ReadUInt32(); + break; + } + case 898: { + global::Conformance.TestAllTypes.Types.NestedMessage subBuilder = new global::Conformance.TestAllTypes.Types.NestedMessage(); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) { + subBuilder.MergeFrom(OneofNestedMessage); + } + input.ReadMessage(subBuilder); + OneofNestedMessage = subBuilder; + break; + } + case 906: { + OneofString = input.ReadString(); + break; + } + case 914: { + OneofBytes = input.ReadBytes(); + break; + } + } + } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + public enum NestedEnum { + FOO = 0, + BAR = 1, + BAZ = 2, + NEG = -1, + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class NestedMessage : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NestedMessage()); + public static pb::MessageParser Parser { get { return _parser; } } + + public static pbr::MessageDescriptor Descriptor { + get { return global::Conformance.TestAllTypes.Descriptor.NestedTypes[0]; } + } + + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + public NestedMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + public NestedMessage(NestedMessage other) : this() { + a_ = other.a_; + Corecursive = other.corecursive_ != null ? other.Corecursive.Clone() : null; + } + + public NestedMessage Clone() { + return new NestedMessage(this); + } + + public const int AFieldNumber = 1; + private int a_; + public int A { + get { return a_; } + set { + a_ = value; + } + } + + public const int CorecursiveFieldNumber = 2; + private global::Conformance.TestAllTypes corecursive_; + public global::Conformance.TestAllTypes Corecursive { + get { return corecursive_; } + set { + corecursive_ = value; + } + } + + public override bool Equals(object other) { + return Equals(other as NestedMessage); + } + + public bool Equals(NestedMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (A != other.A) return false; + if (!object.Equals(Corecursive, other.Corecursive)) return false; + return true; + } + + public override int GetHashCode() { + int hash = 1; + if (A != 0) hash ^= A.GetHashCode(); + if (corecursive_ != null) hash ^= Corecursive.GetHashCode(); + return hash; + } + + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + + public void WriteTo(pb::CodedOutputStream output) { + if (A != 0) { + output.WriteRawTag(8); + output.WriteInt32(A); + } + if (corecursive_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Corecursive); + } + } + + public int CalculateSize() { + int size = 0; + if (A != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(A); + } + if (corecursive_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Corecursive); + } + return size; + } + + public void MergeFrom(NestedMessage other) { + if (other == null) { + return; + } + if (other.A != 0) { + A = other.A; + } + if (other.corecursive_ != null) { + if (corecursive_ == null) { + corecursive_ = new global::Conformance.TestAllTypes(); + } + Corecursive.MergeFrom(other.Corecursive); + } + } + + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while (input.ReadTag(out tag)) { + switch(tag) { + case 0: + throw pb::InvalidProtocolBufferException.InvalidTag(); + default: + if (pb::WireFormat.IsEndGroupTag(tag)) { + return; + } + break; + case 8: { + A = input.ReadInt32(); + break; + } + case 18: { + if (corecursive_ == null) { + corecursive_ = new global::Conformance.TestAllTypes(); + } + input.ReadMessage(corecursive_); + break; + } + } + } + } + + } + + } + #endregion + + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ForeignMessage : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ForeignMessage()); + public static pb::MessageParser Parser { get { return _parser; } } + + public static pbr::MessageDescriptor Descriptor { + get { return global::Conformance.Conformance.Descriptor.MessageTypes[3]; } + } + + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + public ForeignMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + public ForeignMessage(ForeignMessage other) : this() { + c_ = other.c_; + } + + public ForeignMessage Clone() { + return new ForeignMessage(this); + } + + public const int CFieldNumber = 1; + private int c_; + public int C { + get { return c_; } + set { + c_ = value; + } + } + + public override bool Equals(object other) { + return Equals(other as ForeignMessage); + } + + public bool Equals(ForeignMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (C != other.C) return false; + return true; + } + + public override int GetHashCode() { + int hash = 1; + if (C != 0) hash ^= C.GetHashCode(); + return hash; + } + + public override string ToString() { + return pb::JsonFormatter.Default.Format(this); + } + + public void WriteTo(pb::CodedOutputStream output) { + if (C != 0) { + output.WriteRawTag(8); + output.WriteInt32(C); + } + } + + public int CalculateSize() { + int size = 0; + if (C != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(C); + } + return size; + } + + public void MergeFrom(ForeignMessage other) { + if (other == null) { + return; + } + if (other.C != 0) { + C = other.C; + } + } + + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while (input.ReadTag(out tag)) { + switch(tag) { + case 0: + throw pb::InvalidProtocolBufferException.InvalidTag(); + default: + if (pb::WireFormat.IsEndGroupTag(tag)) { + return; + } + break; + case 8: { + C = input.ReadInt32(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj b/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj new file mode 100644 index 00000000..82f728d1 --- /dev/null +++ b/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + {0607D1B8-80D6-4B35-9857-1263C1B32B94} + Exe + Properties + Google.Protobuf.Conformance + Google.Protobuf.Conformance + v4.5 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + {6908bdce-d925-43f3-94ac-a531e6df2591} + Google.Protobuf + + + + + \ No newline at end of file diff --git a/csharp/src/Google.Protobuf.Conformance/Program.cs b/csharp/src/Google.Protobuf.Conformance/Program.cs new file mode 100644 index 00000000..af92da9f --- /dev/null +++ b/csharp/src/Google.Protobuf.Conformance/Program.cs @@ -0,0 +1,126 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// 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 Conformance; +using System; +using System.IO; + +namespace Google.Protobuf.Conformance +{ + /// + /// Conformance tests. The test runner will provide JSON or proto data on stdin, + /// and this program will produce its output on stdout. + /// + class Program + { + private static void Main(string[] args) + { + // This way we get the binary streams instead of readers/writers. + var input = new BinaryReader(Console.OpenStandardInput()); + var output = new BinaryWriter(Console.OpenStandardOutput()); + + int count = 0; + while (RunTest(input, output)) + { + count++; + } + Console.Error.WriteLine("Received EOF after {0} tests", count); + } + + private static bool RunTest(BinaryReader input, BinaryWriter output) + { + int? size = ReadInt32(input); + if (size == null) + { + return false; + } + byte[] inputData = input.ReadBytes(size.Value); + if (inputData.Length != size.Value) + { + throw new EndOfStreamException("Read " + inputData.Length + " bytes of data when expecting " + size); + } + ConformanceRequest request = ConformanceRequest.Parser.ParseFrom(inputData); + ConformanceResponse response = PerformRequest(request); + byte[] outputData = response.ToByteArray(); + output.Write(outputData.Length); + output.Write(outputData); + // Ready for another test... + return true; + } + + private static ConformanceResponse PerformRequest(ConformanceRequest request) + { + TestAllTypes message; + switch (request.PayloadCase) + { + case ConformanceRequest.PayloadOneofCase.JsonPayload: + return new ConformanceResponse { Skipped = "JSON parsing not implemented in C# yet" }; + case ConformanceRequest.PayloadOneofCase.ProtobufPayload: + try + { + message = TestAllTypes.Parser.ParseFrom(request.ProtobufPayload); + } + catch (InvalidProtocolBufferException e) + { + return new ConformanceResponse { ParseError = e.Message }; + } + break; + default: + throw new Exception("Unsupported request payload: " + request.PayloadCase); + } + switch (request.RequestedOutputFormat) + { + case global::Conformance.WireFormat.JSON: + return new ConformanceResponse { JsonPayload = JsonFormatter.Default.Format(message) }; + case global::Conformance.WireFormat.PROTOBUF: + return new ConformanceResponse { ProtobufPayload = message.ToByteString() }; + default: + throw new Exception("Unsupported request output format: " + request.PayloadCase); + } + } + + private static int? ReadInt32(BinaryReader input) + { + byte[] bytes = input.ReadBytes(4); + if (bytes.Length == 0) + { + // Cleanly reached the end of the stream + return null; + } + if (bytes.Length != 4) + { + throw new EndOfStreamException("Read " + bytes.Length + " bytes of size when expecting 4"); + } + return bytes[0] | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24); + } + } +} diff --git a/csharp/src/Google.Protobuf.Conformance/Properties/AssemblyInfo.cs b/csharp/src/Google.Protobuf.Conformance/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..4c46bb38 --- /dev/null +++ b/csharp/src/Google.Protobuf.Conformance/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Google.Protobuf.Conformance")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Google.Protobuf.Conformance")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("0607d1b8-80d6-4b35-9857-1263c1b32b94")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/csharp/src/Google.Protobuf.sln b/csharp/src/Google.Protobuf.sln index fef7a7f1..69ce9a47 100644 --- a/csharp/src/Google.Protobuf.sln +++ b/csharp/src/Google.Protobuf.sln @@ -10,6 +10,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddressBook", "AddressBook\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Google.Protobuf.JsonDump", "Google.Protobuf.JsonDump\Google.Protobuf.JsonDump.csproj", "{D7282E99-2DC3-405B-946F-177DB2FD2AE2}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Google.Protobuf.Conformance", "Google.Protobuf.Conformance\Google.Protobuf.Conformance.csproj", "{0607D1B8-80D6-4B35-9857-1263C1B32B94}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -41,6 +43,12 @@ Global {D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Release|Any CPU.Build.0 = Release|Any CPU {D7282E99-2DC3-405B-946F-177DB2FD2AE2}.ReleaseSigned|Any CPU.ActiveCfg = Release|Any CPU {D7282E99-2DC3-405B-946F-177DB2FD2AE2}.ReleaseSigned|Any CPU.Build.0 = Release|Any CPU + {0607D1B8-80D6-4B35-9857-1263C1B32B94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0607D1B8-80D6-4B35-9857-1263C1B32B94}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0607D1B8-80D6-4B35-9857-1263C1B32B94}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0607D1B8-80D6-4B35-9857-1263C1B32B94}.Release|Any CPU.Build.0 = Release|Any CPU + {0607D1B8-80D6-4B35-9857-1263C1B32B94}.ReleaseSigned|Any CPU.ActiveCfg = Release|Any CPU + {0607D1B8-80D6-4B35-9857-1263C1B32B94}.ReleaseSigned|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE -- cgit v1.2.3