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))); }
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))); }
public void CalculateSize_VariableSizeNonPacked() { var list = new RepeatedField <int> { 1, 500, 1 }; var tag = WireFormat.MakeTag(1, WireFormat.WireType.Varint); // 2 bytes for the first entry, 3 bytes for the second, 2 bytes for the third Assert.AreEqual(7, list.CalculateSize(FieldCodec.ForInt32(tag))); }
public void CalculateSize_VariableSizePacked() { 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, // 1 byte for the first entry, 2 bytes for the second, 1 byte for the third Assert.AreEqual(6, list.CalculateSize(FieldCodec.ForInt32(tag))); }