public void TestNextFixed() { var r = new FRandom(1); var a = r.NextFixed(); Assert.AreEqual(new Fixed(995757), a); var b = r.NextFixed(Fixed.FromFraction(-102324, 1000), Fixed.FromFraction(12034, 100)); Assert.AreEqual(new Fixed(-16118036), b); }
public void TestFactory() { var a = Fixed.FromInt(10); Assert.AreEqual(Fixed.FromInt(10), a); var b = Fixed.FromFloat(3.2f); Assert.AreEqual(Fixed.FromFloat(3.2f), b); var c = Fixed.Parse("6.3"); AssertApproximately(Fixed.FromFraction(63, 10), c); var d = Fixed.FromFraction(3141592, 1000000); AssertApproximately(Fixed.FromFloat(3.141592f), d); }