Skip to content

Commit

Permalink
Move tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
wasabii committed Apr 3, 2024
1 parent b0124fe commit 09c37b6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
11 changes: 0 additions & 11 deletions src/IKVM.ByteCode.Tests/Text/MUTF8EncodingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
27 changes: 27 additions & 0 deletions src/IKVM.Tests/Runtime/Extensions/MemoryMarshalExtensionsTests.cs
Original file line number Diff line number Diff line change
@@ -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);
}

}

}

0 comments on commit 09c37b6

Please sign in to comment.