From 1c5a78ce78935a1533660fd0827c4f5354defd60 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Sat, 3 Sep 2022 11:00:40 +0200 Subject: [PATCH] Removed unit tests. --- .../ImageSharp.Tests/Common/NumericsTests.cs | 60 +------------------ 1 file changed, 1 insertion(+), 59 deletions(-) diff --git a/tests/ImageSharp.Tests/Common/NumericsTests.cs b/tests/ImageSharp.Tests/Common/NumericsTests.cs index 30345390ae..6f5df43135 100644 --- a/tests/ImageSharp.Tests/Common/NumericsTests.cs +++ b/tests/ImageSharp.Tests/Common/NumericsTests.cs @@ -2,7 +2,6 @@ // Licensed under the Six Labors Split License. using System; -using System.Numerics; using Xunit; using Xunit.Abstractions; @@ -12,67 +11,10 @@ namespace SixLabors.ImageSharp.Tests.Common { private ITestOutputHelper Output { get; } - public NumericsTests(ITestOutputHelper output) - { - this.Output = output; - } + public NumericsTests(ITestOutputHelper output) => this.Output = output; public static TheoryData IsOutOfRangeTestData = new() { int.MinValue, -1, 0, 1, 6, 7, 8, 91, 92, 93, int.MaxValue }; - private static int Log2_ReferenceImplementation(uint value) - { - int n = 0; - while ((value >>= 1) != 0) - { - ++n; - } - - return n; - } - - [Fact] - public void Log2_ZeroConvention() - { - uint value = 0; - int expected = 0; - int actual = BitOperations.Log2(value); - - Assert.Equal(expected, actual); - } - - [Fact] - public void Log2_PowersOfTwo() - { - for (int i = 0; i < sizeof(int) * 8; i++) - { - // from 2^0 to 2^32 - uint value = (uint)(1 << i); - int expected = i; - int actual = BitOperations.Log2(value); - - Assert.Equal(expected, actual); - } - } - - [Theory] - [InlineData(1, 100)] - [InlineData(2, 100)] - public void Log2_RandomValues(int seed, int count) - { - var rng = new Random(seed); - byte[] bytes = new byte[4]; - - for (int i = 0; i < count; i++) - { - rng.NextBytes(bytes); - uint value = BitConverter.ToUInt32(bytes, 0); - int expected = Log2_ReferenceImplementation(value); - int actual = BitOperations.Log2(value); - - Assert.Equal(expected, actual); - } - } - private static uint DivideCeil_ReferenceImplementation(uint value, uint divisor) => (uint)MathF.Ceiling((float)value / divisor); [Fact]