feat(batch1): implement proto varint encoder parity
This commit is contained in:
@@ -74,4 +74,41 @@ public class ProtoWireTests
|
||||
typ.ShouldBe(2);
|
||||
size.ShouldBe(5);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(1UL << 7, 2)]
|
||||
[InlineData(1UL << 14, 3)]
|
||||
[InlineData(1UL << 21, 4)]
|
||||
[InlineData(1UL << 28, 5)]
|
||||
[InlineData(1UL << 35, 6)]
|
||||
[InlineData(1UL << 42, 7)]
|
||||
[InlineData(1UL << 49, 8)]
|
||||
[InlineData(1UL << 56, 9)]
|
||||
[InlineData(1UL << 63, 10)]
|
||||
public void ProtoEncodeVarint_BoundaryValues_ReturnsExpectedLength(ulong value, int expectedLength)
|
||||
{
|
||||
var encoded = ProtoWire.ProtoEncodeVarint(value);
|
||||
|
||||
encoded.Length.ShouldBe(expectedLength);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(1UL << 7)]
|
||||
[InlineData(1UL << 14)]
|
||||
[InlineData(1UL << 21)]
|
||||
[InlineData(1UL << 28)]
|
||||
[InlineData(1UL << 35)]
|
||||
[InlineData(1UL << 42)]
|
||||
[InlineData(1UL << 49)]
|
||||
[InlineData(1UL << 56)]
|
||||
[InlineData(1UL << 63)]
|
||||
public void ProtoEncodeVarint_BoundaryValues_RoundTripThroughProtoScanVarint(ulong value)
|
||||
{
|
||||
var encoded = ProtoWire.ProtoEncodeVarint(value);
|
||||
var (decoded, size, err) = ProtoWire.ProtoScanVarint(encoded);
|
||||
|
||||
err.ShouldBeNull();
|
||||
size.ShouldBe(encoded.Length);
|
||||
decoded.ShouldBe(value);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user