MathUtils added
This commit is contained in:
1 parent
ef285bdc67
commit
858964edbc
2 files changed
+74
No files matched your search
@@ -0,0 +1,32 @@
|
||||
using FluentAssertions;
|
||||
using Recyclable.Collections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Recyclable.CollectionsTests
|
||||
{
|
||||
public class MathUtilsTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(int.MaxValue / 1024, int.MaxValue / 10 / 1024)]
|
||||
public void DivMod(long testNumber, int blockSize)
|
||||
{
|
||||
for (var testCase = testNumber; testCase >= 0; testCase--)
|
||||
{
|
||||
// Prepare
|
||||
var expectedResult = testCase / blockSize;
|
||||
var expectedRemainder = testCase % blockSize;
|
||||
|
||||
// Act
|
||||
var actualResult = MathUtils.DivMod(testCase, blockSize, out long actualRemainder);
|
||||
|
||||
// Validate
|
||||
_ = actualResult.Should().Be(expectedResult);
|
||||
_ = actualRemainder.Should().Be(expectedRemainder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user