示例#1
0
        public void TestAddEpsilon_Double(double value, bool negativeEpsilon, double?expectedResult = null)
        {
            // ReSharper disable once InvokeAsExtensionMethod
            double result = MathExtensions.AddEpsilon(value, negativeEpsilon);

            if (expectedResult.HasValue)
            {
                Assert.Equal(expectedResult, result);
            }
            else if (value.Equals(0.0f))
            {
                Assert.Equal(negativeEpsilon ? -double.Epsilon : double.Epsilon, result);
            }
            else
            {
                Assert.True(negativeEpsilon ? result <value : result> value);
            }
        }