ADD: added new version of protobuf
This commit is contained in:
@@ -41,7 +41,9 @@ using System.Buffers;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Runtime.CompilerServices;
|
||||
#if !NET35
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
|
||||
namespace Google.Protobuf
|
||||
{
|
||||
@@ -70,7 +72,7 @@ namespace Google.Protobuf
|
||||
Assert.IsFalse(b1 != b1);
|
||||
Assert.IsFalse(b1 != b2);
|
||||
Assert.IsTrue(ByteString.Empty == ByteString.Empty);
|
||||
#pragma warning restore 1718
|
||||
#pragma warning disable 1718
|
||||
Assert.IsTrue(b1 != b3);
|
||||
Assert.IsTrue(b1 != b4);
|
||||
Assert.IsTrue(b1 != null);
|
||||
@@ -276,9 +278,12 @@ namespace Google.Protobuf
|
||||
Span<byte> s = stackalloc byte[data.Length];
|
||||
data.CopyTo(s);
|
||||
|
||||
using var manager = new UnmanagedMemoryManager<byte>(s);
|
||||
ByteString bs = ByteString.AttachBytes(manager.Memory);
|
||||
Assert.AreEqual("Hello world", bs.ToString(Encoding.UTF8));
|
||||
using (UnmanagedMemoryManager<byte> manager = new UnmanagedMemoryManager<byte>(s))
|
||||
{
|
||||
ByteString bs = ByteString.AttachBytes(manager.Memory);
|
||||
|
||||
Assert.AreEqual("Hello world", bs.ToString(Encoding.UTF8));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -312,9 +317,12 @@ namespace Google.Protobuf
|
||||
Span<byte> s = stackalloc byte[data.Length];
|
||||
data.CopyTo(s);
|
||||
|
||||
using var manager = new UnmanagedMemoryManager<byte>(s);
|
||||
ByteString bs = ByteString.AttachBytes(manager.Memory);
|
||||
Assert.AreEqual("SGVsbG8gd29ybGQ=", bs.ToBase64());
|
||||
using (UnmanagedMemoryManager<byte> manager = new UnmanagedMemoryManager<byte>(s))
|
||||
{
|
||||
ByteString bs = ByteString.AttachBytes(manager.Memory);
|
||||
|
||||
Assert.AreEqual("SGVsbG8gd29ybGQ=", bs.ToBase64());
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -341,6 +349,7 @@ namespace Google.Protobuf
|
||||
Assert.AreEqual(expected, actual, $"{expected.ToBase64()} != {actual.ToBase64()}");
|
||||
}
|
||||
|
||||
#if !NET35
|
||||
[Test]
|
||||
public async Task FromStreamAsync_Seekable()
|
||||
{
|
||||
@@ -364,6 +373,7 @@ namespace Google.Protobuf
|
||||
ByteString expected = ByteString.CopyFrom(2, 3, 4);
|
||||
Assert.AreEqual(expected, actual, $"{expected.ToBase64()} != {actual.ToBase64()}");
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
public void GetHashCode_Regression()
|
||||
|
||||
Reference in New Issue
Block a user