public void DivRemReturnsCorrectly(uint divisor, uint testDividend) { var uInt32Divisor = new UInt32Divisor(divisor); var remainder = uInt32Divisor.DivRem(testDividend, out var quotient); Assert.Multiple(() => { Assert.AreEqual(testDividend % divisor, remainder); Assert.AreEqual(testDividend / divisor, quotient); }); }
public void DivRemReturnsCorrectlyRandomNumerators(uint divisor) { var uInt32Divisor = new UInt32Divisor(divisor); var rng = new PcgRandom(); for (ulong i = 0; i < RandomTestCount; i++) { var testDividend = rng.Next(); var remainder = uInt32Divisor.DivRem(testDividend, out var quotient); Assert.AreEqual(testDividend % divisor, remainder, $"Trying to test {testDividend} % {divisor}"); Assert.AreEqual(testDividend / divisor, quotient, $"Trying to test {testDividend} / {divisor}"); } }