public void CalculatesFloorCorrectly(uint divisor, uint testDividend) { var uInt32Divisor = new UInt32Divisor(divisor); var rounded = uInt32Divisor.Floor(testDividend); Assert.AreEqual(testDividend / divisor * divisor, rounded); }
public void CalculatesFloorCorrectlyRandomNumerators(uint divisor) { var uInt32Divisor = new UInt32Divisor(divisor); var rng = new PcgRandom(); for (ulong i = 0; i < RandomTestCount; i++) { var testDividend = rng.Next(); var rounded = uInt32Divisor.Floor(testDividend); Assert.AreEqual(testDividend / divisor * divisor, rounded, $"Trying to test {testDividend} / {divisor} * {divisor}"); } }