| OLD | NEW |
| 1 #region Copyright notice and license | 1 #region Copyright notice and license |
| 2 // Protocol Buffers - Google's data interchange format | 2 // Protocol Buffers - Google's data interchange format |
| 3 // Copyright 2008 Google Inc. All rights reserved. | 3 // Copyright 2008 Google Inc. All rights reserved. |
| 4 // https://developers.google.com/protocol-buffers/ | 4 // https://developers.google.com/protocol-buffers/ |
| 5 // | 5 // |
| 6 // Redistribution and use in source and binary forms, with or without | 6 // Redistribution and use in source and binary forms, with or without |
| 7 // modification, are permitted provided that the following conditions are | 7 // modification, are permitted provided that the following conditions are |
| 8 // met: | 8 // met: |
| 9 // | 9 // |
| 10 // * Redistributions of source code must retain the above copyright | 10 // * Redistributions of source code must retain the above copyright |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 namespace Google.Protobuf | 36 namespace Google.Protobuf |
| 37 { | 37 { |
| 38 public class TestCornerCases | 38 public class TestCornerCases |
| 39 { | 39 { |
| 40 [Test] | 40 [Test] |
| 41 public void TestRoundTripNegativeEnums() | 41 public void TestRoundTripNegativeEnums() |
| 42 { | 42 { |
| 43 NegativeEnumMessage msg = new NegativeEnumMessage | 43 NegativeEnumMessage msg = new NegativeEnumMessage |
| 44 { | 44 { |
| 45 Value = NegativeEnum.MinusOne, | 45 Value = NegativeEnum.MinusOne, |
| 46 Values = { NegativeEnum.NEGATIVE_ENUM_ZERO, NegativeEnum.MinusOn
e, NegativeEnum.FiveBelow }, | 46 Values = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnu
m.FiveBelow }, |
| 47 PackedValues = { NegativeEnum.NEGATIVE_ENUM_ZERO, NegativeEnum.M
inusOne, NegativeEnum.FiveBelow } | 47 PackedValues = { NegativeEnum.Zero, NegativeEnum.MinusOne, Negat
iveEnum.FiveBelow } |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 Assert.AreEqual(58, msg.CalculateSize()); | 50 Assert.AreEqual(58, msg.CalculateSize()); |
| 51 | 51 |
| 52 byte[] bytes = new byte[58]; | 52 byte[] bytes = new byte[58]; |
| 53 CodedOutputStream output = new CodedOutputStream(bytes); | 53 CodedOutputStream output = new CodedOutputStream(bytes); |
| 54 | 54 |
| 55 msg.WriteTo(output); | 55 msg.WriteTo(output); |
| 56 Assert.AreEqual(0, output.SpaceLeft); | 56 Assert.AreEqual(0, output.SpaceLeft); |
| 57 | 57 |
| 58 NegativeEnumMessage copy = NegativeEnumMessage.Parser.ParseFrom(byte
s); | 58 NegativeEnumMessage copy = NegativeEnumMessage.Parser.ParseFrom(byte
s); |
| 59 Assert.AreEqual(msg, copy); | 59 Assert.AreEqual(msg, copy); |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 } | 62 } |
| OLD | NEW |