From 52b8e30437e235817ed534dec860e781bb0468c0 Mon Sep 17 00:00:00 2001 From: vnugent Date: Sat, 14 Jan 2023 16:24:28 -0500 Subject: MemoryUtil native integer size update + tests --- lib/Utils/tests/Memory/MemoryHandleTest.cs | 25 +-- lib/Utils/tests/Memory/MemoryTests.cs | 244 --------------------- lib/Utils/tests/Memory/MemoryUtilTests.cs | 333 +++++++++++++++++++++++++++++ lib/Utils/tests/Memory/VnTableTests.cs | 51 ++--- lib/Utils/tests/VnEncodingTests.cs | 6 +- 5 files changed, 364 insertions(+), 295 deletions(-) delete mode 100644 lib/Utils/tests/Memory/MemoryTests.cs create mode 100644 lib/Utils/tests/Memory/MemoryUtilTests.cs (limited to 'lib/Utils/tests') diff --git a/lib/Utils/tests/Memory/MemoryHandleTest.cs b/lib/Utils/tests/Memory/MemoryHandleTest.cs index 02ef1f1..34dbb60 100644 --- a/lib/Utils/tests/Memory/MemoryHandleTest.cs +++ b/lib/Utils/tests/Memory/MemoryHandleTest.cs @@ -25,10 +25,9 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; -using VNLib.Utils; using VNLib.Utils.Extensions; -using static VNLib.Utils.Memory.Memory; +using static VNLib.Utils.Memory.MemoryUtil; namespace VNLib.Utils.Memory.Tests { @@ -43,7 +42,7 @@ namespace VNLib.Utils.Memory.Tests Assert.ThrowsException(() => Shared.Alloc(-1)); //Make sure over-alloc throws - Assert.ThrowsException(() => Shared.Alloc(ulong.MaxValue, false)); + Assert.ThrowsException(() => Shared.Alloc(nuint.MaxValue, false)); } #if TARGET_64_BIT [TestMethod] @@ -54,9 +53,9 @@ namespace VNLib.Utils.Memory.Tests using MemoryHandle handle = Shared.Alloc(bigHandleSize); //verify size - Assert.AreEqual(handle.ByteLength, (ulong)bigHandleSize); + Assert.IsTrue(handle.ByteLength, (ulong)bigHandleSize); //Since handle is byte, should also match - Assert.AreEqual(handle.Length, (ulong)bigHandleSize); + Assert.IsTrue(handle.Length, (ulong)bigHandleSize); //Should throw overflow Assert.ThrowsException(() => _ = handle.Span); @@ -68,8 +67,6 @@ namespace VNLib.Utils.Memory.Tests Assert.ThrowsException(() => _ = handle.GetOffsetSpan((long)int.MaxValue + 1, 1024)); } -#else - #endif [TestMethod] @@ -77,15 +74,15 @@ namespace VNLib.Utils.Memory.Tests { using MemoryHandle handle = Shared.Alloc(128, true); - Assert.AreEqual(handle.IntLength, 128); + Assert.IsTrue(handle.Length == 128); - Assert.AreEqual(handle.Length, (ulong)128); + Assert.IsTrue(handle.Length == 128); //Check span against base pointer deref handle.Span[120] = 10; - Assert.AreEqual(*handle.GetOffset(120), 10); + Assert.IsTrue(*handle.GetOffset(120) == 10); } @@ -153,14 +150,14 @@ namespace VNLib.Utils.Memory.Tests { using MemoryHandle handle = Shared.Alloc(1024); - Assert.AreEqual(handle.IntLength, 1024); + Assert.IsTrue(handle.Length == 1024); Assert.ThrowsException(() => handle.Resize(-1)); //Resize the handle handle.Resize(2048); - Assert.AreEqual(handle.IntLength, 2048); + Assert.IsTrue(handle.Length == 2048); Assert.IsTrue(handle.AsSpan(2048).IsEmpty); @@ -173,11 +170,11 @@ namespace VNLib.Utils.Memory.Tests //test resize handle.ResizeIfSmaller(100); //Handle should be unmodified - Assert.AreEqual(handle.IntLength, 2048); + Assert.IsTrue(handle.Length == 2048); //test working handle.ResizeIfSmaller(4096); - Assert.AreEqual(handle.IntLength, 4096); + Assert.IsTrue(handle.Length == 4096); } } } diff --git a/lib/Utils/tests/Memory/MemoryTests.cs b/lib/Utils/tests/Memory/MemoryTests.cs deleted file mode 100644 index 5b68cf5..0000000 --- a/lib/Utils/tests/Memory/MemoryTests.cs +++ /dev/null @@ -1,244 +0,0 @@ -/* -* Copyright (c) 2022 Vaughn Nugent -* -* Library: VNLib -* Package: VNLib.UtilsTests -* File: MemoryTests.cs -* -* MemoryTests.cs is part of VNLib.UtilsTests which is part of the larger -* VNLib collection of libraries and utilities. -* -* VNLib.UtilsTests is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published -* by the Free Software Foundation, either version 2 of the License, -* or (at your option) any later version. -* -* VNLib.UtilsTests is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with VNLib.UtilsTests. If not, see http://www.gnu.org/licenses/. -*/ - -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Runtime.InteropServices; - -using VNLib.Utils.Extensions; - -namespace VNLib.Utils.Memory.Tests -{ - [TestClass()] - public class MemoryTests - { - [TestMethod] - public void MemorySharedHeapLoadedTest() - { - Assert.IsNotNull(Memory.Shared); - } - - [TestMethod()] - public void UnsafeAllocTest() - { - //test against negative number - Assert.ThrowsException(() => Memory.UnsafeAlloc(-1)); - - //Alloc large block test (100mb) - const int largTestSize = 100000 * 1024; - //Alloc super small block - const int smallTestSize = 5; - - using (UnsafeMemoryHandle buffer = Memory.UnsafeAlloc(largTestSize, false)) - { - Assert.AreEqual(largTestSize, buffer.IntLength); - Assert.AreEqual(largTestSize, buffer.Span.Length); - - buffer.Span[0] = 254; - Assert.AreEqual(buffer.Span[0], 254); - } - - using (UnsafeMemoryHandle buffer = Memory.UnsafeAlloc(smallTestSize, false)) - { - Assert.AreEqual(smallTestSize, buffer.IntLength); - Assert.AreEqual(smallTestSize, buffer.Span.Length); - - buffer.Span[0] = 254; - Assert.AreEqual(buffer.Span[0], 254); - } - - //Different data type - - using(UnsafeMemoryHandle buffer = Memory.UnsafeAlloc(largTestSize, false)) - { - Assert.AreEqual(largTestSize, buffer.IntLength); - Assert.AreEqual(largTestSize, buffer.Span.Length); - - buffer.Span[0] = long.MaxValue; - Assert.AreEqual(buffer.Span[0], long.MaxValue); - } - - using (UnsafeMemoryHandle buffer = Memory.UnsafeAlloc(smallTestSize, false)) - { - Assert.AreEqual(smallTestSize, buffer.IntLength); - Assert.AreEqual(smallTestSize, buffer.Span.Length); - - buffer.Span[0] = long.MaxValue; - Assert.AreEqual(buffer.Span[0], long.MaxValue); - } - } - - [TestMethod()] - public void UnsafeZeroMemoryAsSpanTest() - { - //Alloc test buffer - Span test = new byte[1024]; - test.Fill(0); - //test other empty span - Span verify = new byte[1024]; - verify.Fill(0); - - //Fill test buffer with random values - Random.Shared.NextBytes(test); - - //make sure buffers are not equal - Assert.IsFalse(test.SequenceEqual(verify)); - - //Zero buffer - Memory.UnsafeZeroMemory(test); - - //Make sure buffers are equal - Assert.IsTrue(test.SequenceEqual(verify)); - } - - [TestMethod()] - public void UnsafeZeroMemoryAsMemoryTest() - { - //Alloc test buffer - Memory test = new byte[1024]; - test.Span.Fill(0); - //test other empty span - Memory verify = new byte[1024]; - verify.Span.Fill(0); - - //Fill test buffer with random values - Random.Shared.NextBytes(test.Span); - - //make sure buffers are not equal - Assert.IsFalse(test.Span.SequenceEqual(verify.Span)); - - //Zero buffer - Memory.UnsafeZeroMemory(test); - - //Make sure buffers are equal - Assert.IsTrue(test.Span.SequenceEqual(verify.Span)); - } - - [TestMethod()] - public void InitializeBlockAsSpanTest() - { - //Alloc test buffer - Span test = new byte[1024]; - test.Fill(0); - //test other empty span - Span verify = new byte[1024]; - verify.Fill(0); - - //Fill test buffer with random values - Random.Shared.NextBytes(test); - - //make sure buffers are not equal - Assert.IsFalse(test.SequenceEqual(verify)); - - //Zero buffer - Memory.InitializeBlock(test); - - //Make sure buffers are equal - Assert.IsTrue(test.SequenceEqual(verify)); - } - - [TestMethod()] - public void InitializeBlockMemoryTest() - { - //Alloc test buffer - Memory test = new byte[1024]; - test.Span.Fill(0); - //test other empty span - Memory verify = new byte[1024]; - verify.Span.Fill(0); - - //Fill test buffer with random values - Random.Shared.NextBytes(test.Span); - - //make sure buffers are not equal - Assert.IsFalse(test.Span.SequenceEqual(verify.Span)); - - //Zero buffer - Memory.InitializeBlock(test); - - //Make sure buffers are equal - Assert.IsTrue(test.Span.SequenceEqual(verify.Span)); - } - - #region structmemory tests - - [StructLayout(LayoutKind.Sequential)] - struct TestStruct - { - public int X; - public int Y; - } - - [TestMethod()] - public unsafe void ZeroStructAsPointerTest() - { - TestStruct* s = Memory.Shared.StructAlloc(); - s->X = 10; - s->Y = 20; - Assert.AreEqual(10, s->X); - Assert.AreEqual(20, s->Y); - //zero struct - Memory.ZeroStruct(s); - //Verify data was zeroed - Assert.AreEqual(0, s->X); - Assert.AreEqual(0, s->Y); - //Free struct - Memory.Shared.StructFree(s); - } - - [TestMethod()] - public unsafe void ZeroStructAsVoidPointerTest() - { - TestStruct* s = Memory.Shared.StructAlloc(); - s->X = 10; - s->Y = 20; - Assert.AreEqual(10, s->X); - Assert.AreEqual(20, s->Y); - //zero struct - Memory.ZeroStruct((void*)s); - //Verify data was zeroed - Assert.AreEqual(0, s->X); - Assert.AreEqual(0, s->Y); - //Free struct - Memory.Shared.StructFree(s); - } - - [TestMethod()] - public unsafe void ZeroStructAsIntPtrTest() - { - TestStruct* s = Memory.Shared.StructAlloc(); - s->X = 10; - s->Y = 20; - Assert.AreEqual(10, s->X); - Assert.AreEqual(20, s->Y); - //zero struct - Memory.ZeroStruct((IntPtr)s); - //Verify data was zeroed - Assert.AreEqual(0, s->X); - Assert.AreEqual(0, s->Y); - //Free struct - Memory.Shared.StructFree(s); - } - #endregion - } -} \ No newline at end of file diff --git a/lib/Utils/tests/Memory/MemoryUtilTests.cs b/lib/Utils/tests/Memory/MemoryUtilTests.cs new file mode 100644 index 0000000..fb3700e --- /dev/null +++ b/lib/Utils/tests/Memory/MemoryUtilTests.cs @@ -0,0 +1,333 @@ +using System.Buffers; +using System.Runtime.InteropServices; +using System.Security.Cryptography; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using VNLib.Utils.Extensions; + +namespace VNLib.Utils.Memory.Tests +{ + [TestClass()] + public class MemoryUtilTests + { + const int ZERO_TEST_LOOP_ITERATIONS = 1000000; + const int ZERO_TEST_MAX_BUFFER_SIZE = 10 * 1024; + + [TestMethod()] + public void InitializeNewHeapForProcessTest() + { + //Check if rpmalloc is loaded + if (MemoryUtil.IsRpMallocLoaded) + { + //Initialize the heap + using IUnmangedHeap heap = MemoryUtil.InitializeNewHeapForProcess(); + + //Confirm that the heap is actually a rpmalloc heap + Assert.IsInstanceOfType(heap, typeof(RpMallocPrivateHeap)); + } + else + { + //Confirm that Rpmalloc will throw DLLNotFound if the lib is not loaded + Assert.ThrowsException(() => _ = RpMallocPrivateHeap.GlobalHeap.Alloc(1, 1, false)); + } + } + + [TestMethod()] + public void UnsafeZeroMemoryTest() + { + //Get random data buffer as a readonly span + ReadOnlyMemory buffer = RandomNumberGenerator.GetBytes(1024); + + //confirm buffer is not all zero + Assert.IsFalse(AllZero(buffer.Span)); + + //Zero readonly memory + MemoryUtil.UnsafeZeroMemory(buffer); + + //Confirm all zero + Assert.IsTrue(AllZero(buffer.Span)); + } + + private static bool AllZero(ReadOnlySpan span) + { + for (int i = 0; i < span.Length; i++) + { + if (span[i] != 0) + { + return false; + } + } + return true; + } + + [TestMethod()] + public void UnsafeZeroMemoryTest1() + { + //Get random data buffer as a readonly span + ReadOnlySpan buffer = RandomNumberGenerator.GetBytes(1024); + + //confirm buffer is not all zero + Assert.IsFalse(AllZero(buffer)); + + //Zero readonly span + MemoryUtil.UnsafeZeroMemory(buffer); + + //Confirm all zero + Assert.IsTrue(AllZero(buffer)); + } + + + [TestMethod()] + public void InitializeBlockAsSpanTest() + { + //Get random data buffer as a readonly span + Span buffer = RandomNumberGenerator.GetBytes(1024); + + //confirm buffer is not all zero + Assert.IsFalse(AllZero(buffer)); + + //Zero readonly span + MemoryUtil.InitializeBlock(buffer); + + //Confirm all zero + Assert.IsTrue(AllZero(buffer)); + } + + [TestMethod()] + public void InitializeBlockMemoryTest() + { + //Get random data buffer as a readonly span + Memory buffer = RandomNumberGenerator.GetBytes(1024); + + //confirm buffer is not all zero + Assert.IsFalse(AllZero(buffer.Span)); + + //Zero readonly span + MemoryUtil.InitializeBlock(buffer); + + //Confirm all zero + Assert.IsTrue(AllZero(buffer.Span)); + } + + + [TestMethod()] + public unsafe void UnsafeAllocTest() + { + //No fail + using (UnsafeMemoryHandle handle = MemoryUtil.UnsafeAlloc(1024)) + { + _ = handle.Span; + _ = handle.Length; + _ = handle.IntLength; + + //Test span pointer against pinned handle + using (MemoryHandle pinned = handle.Pin(0)) + { + fixed (void* ptr = &MemoryMarshal.GetReference(handle.Span)) + { + Assert.IsTrue(ptr == pinned.Pointer); + } + } + + //Test negative pin + Assert.ThrowsException(() => _ = handle.Pin(-1)); + + //Test pinned outsie handle size + Assert.ThrowsException(() => _ = handle.Pin(1024)); + } + + //test against negative number + Assert.ThrowsException(() => MemoryUtil.UnsafeAlloc(-1)); + + //Alloc large block test (100mb) + const int largTestSize = 100000 * 1024; + //Alloc super small block + const int smallTestSize = 5; + + using (UnsafeMemoryHandle buffer = MemoryUtil.UnsafeAlloc(largTestSize, false)) + { + Assert.IsTrue(largTestSize == buffer.IntLength); + Assert.IsTrue(largTestSize == buffer.Span.Length); + + buffer.Span[0] = 254; + Assert.IsTrue(buffer.Span[0] == 254); + } + + using (UnsafeMemoryHandle buffer = MemoryUtil.UnsafeAlloc(smallTestSize, false)) + { + Assert.IsTrue(smallTestSize == buffer.IntLength); + Assert.IsTrue(smallTestSize == buffer.Span.Length); + + buffer.Span[0] = 254; + Assert.IsTrue(buffer.Span[0] == 254); + } + + //Different data type + using (UnsafeMemoryHandle buffer = MemoryUtil.UnsafeAlloc(largTestSize, false)) + { + Assert.IsTrue(largTestSize == buffer.IntLength); + Assert.IsTrue(largTestSize == buffer.Span.Length); + + buffer.Span[0] = long.MaxValue; + Assert.IsTrue(buffer.Span[0] == long.MaxValue); + } + + using (UnsafeMemoryHandle buffer = MemoryUtil.UnsafeAlloc(smallTestSize, false)) + { + Assert.IsTrue(smallTestSize == buffer.IntLength); + Assert.IsTrue(smallTestSize == buffer.Span.Length); + + buffer.Span[0] = long.MaxValue; + Assert.IsTrue(buffer.Span[0] == long.MaxValue); + } + + //Test empty handle + using (UnsafeMemoryHandle empty = new()) + { + Assert.IsTrue(0 == empty.Length); + Assert.IsTrue(0 == empty.IntLength); + + //Test pinning while empty + Assert.ThrowsException(() => _ = empty.Pin(0)); + } + + //Negative value + Assert.ThrowsException(() => _ = MemoryUtil.UnsafeAlloc(-1)); + + + /* + * Alloc random sized blocks in a loop, confirm they are empty + * then fill the block with random data before freeing it back to + * the pool. This confirms that if blocks are allocated from a shared + * pool are properly zeroed when requestd + */ + + for (int i = 0; i < ZERO_TEST_LOOP_ITERATIONS; i++) + { + int randBufferSize = Random.Shared.Next(1024, ZERO_TEST_MAX_BUFFER_SIZE); + + //Alloc block, check if all zero, then free + using UnsafeMemoryHandle handle = MemoryUtil.UnsafeAlloc(randBufferSize, true); + + //Confirm all zero + Assert.IsTrue(AllZero(handle.Span)); + + //Fill with random data + Random.Shared.NextBytes(handle.Span); + } + } + + [TestMethod()] + public unsafe void SafeAllocTest() + { + //No fail + using (IMemoryHandle handle = MemoryUtil.SafeAlloc(1024)) + { + _ = handle.Span; + _ = handle.Length; + _ = handle.GetIntLength(); + + //Test span pointer against pinned handle + using (MemoryHandle pinned = handle.Pin(0)) + { + fixed (void* ptr = &MemoryMarshal.GetReference(handle.Span)) + { + Assert.IsTrue(ptr == pinned.Pointer); + } + } + + //Test negative pin + Assert.ThrowsException(() => _ = handle.Pin(-1)); + + //Test pinned outsie handle size + Assert.ThrowsException(() => _ = handle.Pin(1024)); + } + + + //Negative value + Assert.ThrowsException(() => _ = MemoryUtil.SafeAlloc(-1)); + + + /* + * Alloc random sized blocks in a loop, confirm they are empty + * then fill the block with random data before freeing it back to + * the pool. This confirms that if blocks are allocated from a shared + * pool are properly zeroed when requestd + */ + + for (int i = 0; i < ZERO_TEST_LOOP_ITERATIONS; i++) + { + int randBufferSize = Random.Shared.Next(1024, ZERO_TEST_MAX_BUFFER_SIZE); + + //Alloc block, check if all zero, then free + using IMemoryHandle handle = MemoryUtil.SafeAlloc(randBufferSize, true); + + //Confirm all zero + Assert.IsTrue(AllZero(handle.Span)); + + //Fill with random data + Random.Shared.NextBytes(handle.Span); + } + } + + + [StructLayout(LayoutKind.Sequential)] + struct TestStruct + { + public int X; + public int Y; + } + + [TestMethod()] + public unsafe void ZeroStructAsPointerTest() + { + TestStruct* s = MemoryUtil.Shared.StructAlloc(); + s->X = 10; + s->Y = 20; + Assert.IsTrue(10 == s->X); + Assert.IsTrue(20 == s->Y); + //zero struct + MemoryUtil.ZeroStruct(s); + //Verify data was zeroed + Assert.IsTrue(0 == s->X); + Assert.IsTrue(0 == s->Y); + //Free struct + MemoryUtil.Shared.StructFree(s); + } + + [TestMethod()] + public unsafe void ZeroStructAsVoidPointerTest() + { + TestStruct* s = MemoryUtil.Shared.StructAlloc(); + s->X = 10; + s->Y = 20; + Assert.IsTrue(10 == s->X); + Assert.IsTrue(20 == s->Y); + //zero struct + MemoryUtil.ZeroStruct((void*)s); + //Verify data was zeroed + Assert.IsTrue(0 == s->X); + Assert.IsTrue(0 == s->Y); + //Free struct + MemoryUtil.Shared.StructFree(s); + } + + [TestMethod()] + public unsafe void ZeroStructAsIntPtrTest() + { + TestStruct* s = MemoryUtil.Shared.StructAlloc(); + s->X = 10; + s->Y = 20; + Assert.IsTrue(10 == s->X); + Assert.IsTrue(20 == s->Y); + //zero struct + MemoryUtil.ZeroStruct((IntPtr)s); + //Verify data was zeroed + Assert.IsTrue(0 == s->X); + Assert.IsTrue(0 == s->Y); + //Free struct + MemoryUtil.Shared.StructFree(s); + } + } +} \ No newline at end of file diff --git a/lib/Utils/tests/Memory/VnTableTests.cs b/lib/Utils/tests/Memory/VnTableTests.cs index 11350d4..c9f99ea 100644 --- a/lib/Utils/tests/Memory/VnTableTests.cs +++ b/lib/Utils/tests/Memory/VnTableTests.cs @@ -33,26 +33,13 @@ namespace VNLib.Utils.Memory.Tests [TestMethod()] public void VnTableTest() { - Assert.ThrowsException(() => - { - using VnTable table = new(-1, 0); - }); - Assert.ThrowsException(() => - { - using VnTable table = new(0, -1); - }); - Assert.ThrowsException(() => - { - using VnTable table = new(-1, -1); - }); - //Empty table using (VnTable empty = new(0, 0)) { Assert.IsTrue(empty.Empty); //Test 0 rows/cols - Assert.AreEqual(0, empty.Rows); - Assert.AreEqual(0, empty.Cols); + Assert.IsTrue(0 == empty.Rows); + Assert.IsTrue(0 == empty.Cols); } using (VnTable table = new(40000, 10000)) @@ -60,8 +47,8 @@ namespace VNLib.Utils.Memory.Tests Assert.IsFalse(table.Empty); //Test table size - Assert.AreEqual(40000, table.Rows); - Assert.AreEqual(10000, table.Cols); + Assert.IsTrue(40000 == table.Rows); + Assert.IsTrue(10000 == table.Cols); } @@ -89,41 +76,41 @@ namespace VNLib.Utils.Memory.Tests [TestMethod()] public void GetSetTest() { - static void TestIndexAt(VnTable table, int row, int col, int value) + static void TestIndexAt(VnTable table, uint row, uint col, int value) { table[row, col] = value; - Assert.AreEqual(value, table[row, col]); - Assert.AreEqual(value, table.Get(row, col)); + Assert.IsTrue(value == table[row, col]); + Assert.IsTrue(value == table.Get(row, col)); } - static void TestSetAt(VnTable table, int row, int col, int value) + static void TestSetAt(VnTable table, uint row, uint col, int value) { table.Set(row, col, value); - Assert.AreEqual(value, table[row, col]); - Assert.AreEqual(value, table.Get(row, col)); + Assert.IsTrue(value == table[row, col]); + Assert.IsTrue(value == table.Get(row, col)); } - static void TestSetDirectAccess(VnTable table, int row, int col, int value) + static void TestSetDirectAccess(VnTable table, uint row, uint col, int value) { - int address = row * table.Cols + col; - table[(uint)address] = value; + uint address = row * table.Cols + col; + table[address] = value; //Get value using indexer - Assert.AreEqual(value, table[row, col]); + Assert.IsTrue(value == table[row, col]); } - static void TestGetDirectAccess(VnTable table, int row, int col, int value) + static void TestGetDirectAccess(VnTable table, uint row, uint col, int value) { table[row, col] = value; - int address = row * table.Cols + col; + uint address = row * table.Cols + col; //Test direct access - Assert.AreEqual(value, table[(uint)address]); + Assert.IsTrue(value == table[address]); //Get value using indexer - Assert.AreEqual(value, table[row, col]); - Assert.AreEqual(value, table.Get(row, col)); + Assert.IsTrue(value == table[row, col]); + Assert.IsTrue(value == table.Get(row, col)); } diff --git a/lib/Utils/tests/VnEncodingTests.cs b/lib/Utils/tests/VnEncodingTests.cs index a4e52f0..373b834 100644 --- a/lib/Utils/tests/VnEncodingTests.cs +++ b/lib/Utils/tests/VnEncodingTests.cs @@ -23,16 +23,12 @@ */ using System; +using System.Text; using System.Buffers; using System.Buffers.Text; -using System.Collections.Generic; -using System.Linq; using System.Security.Cryptography; -using System.Text; -using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; -using VNLib.Utils; namespace VNLib.Utils.Tests { -- cgit