ComputeInt32SizeNoTag() public static method

Compute the number of bytes that would be needed to encode an int32 field, including the tag.
public static ComputeInt32SizeNoTag ( int value ) : int
value int
return int
Exemplo n.º 1
0
        public void TestNegativeEnumNoTag()
        {
            Assert.AreEqual(10, CodedOutputStream.ComputeInt32SizeNoTag(-2));
            Assert.AreEqual(10, CodedOutputStream.ComputeEnumSizeNoTag(-2));

            byte[]            bytes  = new byte[10];
            CodedOutputStream output = CodedOutputStream.CreateInstance(bytes);

            output.WriteEnumNoTag(-2);

            Assert.AreEqual(0, output.SpaceLeft);
            Assert.AreEqual("FE-FF-FF-FF-FF-FF-FF-FF-FF-01", BitConverter.ToString(bytes));
        }