Extension methods benchmarked. Slower alternatives replaced.
This commit is contained in:
1 parent
9becb8df67
commit
6e99ee39e3
40 files changed
+930
-1026
No files matched your search
@@ -13,7 +13,7 @@ public class UIntExtensionsTests
|
||||
[InlineData(uint.MaxValue)]
|
||||
public void Mod3_matches_operator(uint value)
|
||||
{
|
||||
value.Mod3().Should().Be(value % 3U);
|
||||
UIntExtensions.Mod3(value).Should().Be(value % 3U);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -27,28 +27,6 @@ public class UIntExtensionsTests
|
||||
value.Mod5().Should().Be(value % 5U);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", "Fast")]
|
||||
[InlineData(0U)]
|
||||
[InlineData(1U)]
|
||||
[InlineData(1234567890U)]
|
||||
[InlineData(uint.MaxValue)]
|
||||
public void Mod6_matches_operator(uint value)
|
||||
{
|
||||
value.Mod6().Should().Be(value % 6U);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", "Fast")]
|
||||
[InlineData(0U)]
|
||||
[InlineData(1U)]
|
||||
[InlineData(1234567890U)]
|
||||
[InlineData(uint.MaxValue)]
|
||||
public void Mod7_matches_operator(uint value)
|
||||
{
|
||||
value.Mod7().Should().Be(value % 7U);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", "Fast")]
|
||||
[InlineData(0U)]
|
||||
@@ -59,38 +37,5 @@ public class UIntExtensionsTests
|
||||
{
|
||||
value.Mod8().Should().Be(value % 8U);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", "Fast")]
|
||||
[InlineData(0U)]
|
||||
[InlineData(1U)]
|
||||
[InlineData(1234567890U)]
|
||||
[InlineData(uint.MaxValue)]
|
||||
public void Mod10_matches_operator(uint value)
|
||||
{
|
||||
value.Mod10().Should().Be(value % 10U);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", "Fast")]
|
||||
[InlineData(0U)]
|
||||
[InlineData(1U)]
|
||||
[InlineData(1234567890U)]
|
||||
[InlineData(uint.MaxValue)]
|
||||
public void Mod11_matches_operator(uint value)
|
||||
{
|
||||
value.Mod11().Should().Be(value % 11U);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", "Fast")]
|
||||
[InlineData(0U)]
|
||||
[InlineData(1U)]
|
||||
[InlineData(1234567890U)]
|
||||
[InlineData(uint.MaxValue)]
|
||||
public void Mod128_matches_operator(uint value)
|
||||
{
|
||||
value.Mod128().Should().Be(value % 128U);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,66 +21,6 @@ public class ULongExtensionsTests
|
||||
ULongExtensions.Mod10(value).Should().Be(expected);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", "Fast")]
|
||||
[InlineData(0UL)]
|
||||
[InlineData(ulong.MaxValue)]
|
||||
[InlineData(1234567890123456789UL)]
|
||||
public void Mod3_matches_operator(ulong value)
|
||||
{
|
||||
value.Mod3().Should().Be(value % 3UL);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", "Fast")]
|
||||
[InlineData(0UL)]
|
||||
[InlineData(ulong.MaxValue)]
|
||||
[InlineData(1234567890123456789UL)]
|
||||
public void Mod5_matches_operator(ulong value)
|
||||
{
|
||||
value.Mod5().Should().Be(value % 5UL);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", "Fast")]
|
||||
[InlineData(0UL)]
|
||||
[InlineData(ulong.MaxValue)]
|
||||
[InlineData(1234567890123456789UL)]
|
||||
public void Mod6_matches_operator(ulong value)
|
||||
{
|
||||
value.Mod6().Should().Be(value % 6UL);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", "Fast")]
|
||||
[InlineData(0UL)]
|
||||
[InlineData(ulong.MaxValue)]
|
||||
[InlineData(1234567890123456789UL)]
|
||||
public void Mod7_matches_operator(ulong value)
|
||||
{
|
||||
value.Mod7().Should().Be(value % 7UL);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", "Fast")]
|
||||
[InlineData(0UL)]
|
||||
[InlineData(ulong.MaxValue)]
|
||||
[InlineData(1234567890123456789UL)]
|
||||
public void Mod8_matches_operator(ulong value)
|
||||
{
|
||||
value.Mod8().Should().Be(value % 8UL);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", "Fast")]
|
||||
[InlineData(0UL)]
|
||||
[InlineData(ulong.MaxValue)]
|
||||
[InlineData(1234567890123456789UL)]
|
||||
public void Mod11_matches_operator(ulong value)
|
||||
{
|
||||
value.Mod11().Should().Be(value % 11UL);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", "Fast")]
|
||||
[InlineData(0UL)]
|
||||
@@ -111,22 +51,6 @@ public class ULongExtensionsTests
|
||||
step3.Should().Be(expected3);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", "Fast")]
|
||||
[InlineData(0UL)]
|
||||
[InlineData(1UL)]
|
||||
[InlineData(1234567890123456789UL)]
|
||||
[InlineData(ulong.MaxValue)]
|
||||
public void Mod11_7_5_3_matches_operator(ulong value)
|
||||
{
|
||||
value.Mod11_7_5_3(out ulong mod11, out ulong mod7, out ulong mod5, out ulong mod3);
|
||||
|
||||
mod11.Should().Be(value % 11UL);
|
||||
mod7.Should().Be(value % 7UL);
|
||||
mod5.Should().Be(value % 5UL);
|
||||
mod3.Should().Be(value % 3UL);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", "Fast")]
|
||||
[InlineData(2UL, true)]
|
||||
|
||||
Reference in new issue
Block a user