public void ClampTest() { var range = new DoubleRange(-1.2, +3.4); Assert.AreEqual(-1.2, range.Clamp(double.NegativeInfinity)); Assert.AreEqual(-1.2, range.Clamp(-10)); Assert.AreEqual(-1.2, range.Clamp(-1.2)); Assert.AreEqual(0.0, range.Clamp(0.0)); Assert.AreEqual(+3.4, range.Clamp(+3.4)); Assert.AreEqual(+3.4, range.Clamp(+10)); Assert.AreEqual(+3.4, range.Clamp(double.PositiveInfinity)); Assert.IsTrue(double.IsNaN(range.Clamp(double.NaN))); }
public void ClampTest() { var range = new DoubleRange(-1.2, +3.4); Assert.AreEqual(-1.2, range.Clamp(double.NegativeInfinity)); Assert.AreEqual(-1.2, range.Clamp(-10)); Assert.AreEqual(-1.2, range.Clamp(-1.2)); Assert.AreEqual(0.0, range.Clamp(0.0)); Assert.AreEqual(+3.4, range.Clamp(+3.4)); Assert.AreEqual(+3.4, range.Clamp(+10)); Assert.AreEqual(+3.4, range.Clamp(double.PositiveInfinity)); Assert.IsTrue(double.IsNaN(range.Clamp(double.NaN))); }