Exemplo n.º 1
0
        public void CalculateSize_FixedSizePacked()
        {
            var list = new RepeatedField <int> {
                1, 500, 1
            };
            var tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited);

            // 1 byte for the tag, 1 byte for the length, 4 bytes per entry
            Assert.AreEqual(14, list.CalculateSize(FieldCodec.ForSFixed32(tag)));
        }
Exemplo n.º 2
0
        public void CalculateSize_FixedSizeNonPacked()
        {
            var list = new RepeatedField <int> {
                1, 500, 1
            };
            var tag = WireFormat.MakeTag(1, WireFormat.WireType.Fixed32);

            // 5 bytes for the each entry
            Assert.AreEqual(15, list.CalculateSize(FieldCodec.ForSFixed32(tag)));
        }