diff --git a/src/DotNext.Tests/Buffers/Binary/Leb128Tests.cs b/src/DotNext.Tests/Buffers/Binary/Leb128Tests.cs index cf14cbf4f..627edd60e 100644 --- a/src/DotNext.Tests/Buffers/Binary/Leb128Tests.cs +++ b/src/DotNext.Tests/Buffers/Binary/Leb128Tests.cs @@ -70,4 +70,17 @@ public static void CompatibilityWithBinaryWriter(int expected) True(Leb128.TryParse(stream.GetBuffer(), out var actual, out _)); Equal((uint)expected, actual); } + + [Fact] + public static void DifferenceBetweenSignedAndUnsignedEncoding() + { + Equal(Leb128.MaxSizeInBytes, Leb128.MaxSizeInBytes); + + Span buffer = stackalloc byte[Leb128.MaxSizeInBytes]; + True(Leb128.TryGetBytes(0x7Fu, buffer, out var bytesWritten)); + Equal(1, bytesWritten); + + True(Leb128.TryGetBytes(0x7F, buffer, out bytesWritten)); + Equal(2, bytesWritten); + } } \ No newline at end of file