diff --git a/src/IKVM.ByteCode.Tests/Text/MUTF8EncodingTests.cs b/src/IKVM.ByteCode.Tests/Text/MUTF8EncodingTests.cs index ea79075aab..1b297c7227 100644 --- a/src/IKVM.ByteCode.Tests/Text/MUTF8EncodingTests.cs +++ b/src/IKVM.ByteCode.Tests/Text/MUTF8EncodingTests.cs @@ -53,17 +53,6 @@ public void CanDecodeNullByte() s[0].Should().Be('\0'); } - [TestMethod] - public unsafe void CanFindNullByte() - { - fixed (byte* ptr = new byte[] { 0x01, 0x00 }) - MUTF8Encoding.GetMUTF8(48).IndexOfNull(ptr).Should().Be(1); - fixed (byte* ptr = new byte[] { 0x00, 0x00 }) - MUTF8Encoding.GetMUTF8(48).IndexOfNull(ptr).Should().Be(0); - fixed (byte* ptr = new byte[] { 0x01, 0x01, 0x00 }) - MUTF8Encoding.GetMUTF8(48).IndexOfNull(ptr).Should().Be(2); - } - [TestMethod] public void CanEncodeNull() { diff --git a/src/IKVM.Tests/Runtime/Extensions/MemoryMarshalExtensionsTests.cs b/src/IKVM.Tests/Runtime/Extensions/MemoryMarshalExtensionsTests.cs new file mode 100644 index 0000000000..4e7df4d7f2 --- /dev/null +++ b/src/IKVM.Tests/Runtime/Extensions/MemoryMarshalExtensionsTests.cs @@ -0,0 +1,27 @@ +using FluentAssertions; + +using IKVM.Runtime.Extensions; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.Tests.Runtime.Extensions +{ + + [TestClass] + public class MemoryMarshalExtensionsTests + { + + [TestMethod] + public unsafe void CanFindNullByte() + { + fixed (byte* ptr = new byte[] { 0x01, 0x00 }) + MemoryMarshalExtensions.GetIndexOfNull(ptr).Should().Be(1); + fixed (byte* ptr = new byte[] { 0x00, 0x00 }) + MemoryMarshalExtensions.GetIndexOfNull(ptr).Should().Be(0); + fixed (byte* ptr = new byte[] { 0x01, 0x01, 0x00 }) + MemoryMarshalExtensions.GetIndexOfNull(ptr).Should().Be(2); + } + + } + +}