示例#1
0
        public void DoubleClamp()
        {
            double min   = 3;
            double max   = 6;
            double value = 5;

            Assert.AreEqual(value, NumericExtensions.Clamp(value, min, max));
        }
示例#2
0
        public void IntClamp()
        {
            int min   = 3;
            int max   = 6;
            int value = 5;

            Assert.AreEqual(value, NumericExtensions.Clamp(value, min, max));
        }
示例#3
0
        public void Clamp()
        {
            tlog.Debug(tag, $"Clamp START");
            double d             = 1.0;
            var    testingTarget = NumericExtensions.Clamp(d, 0, 10);

            Assert.AreEqual(d, testingTarget, "Should be equal.");

            float f = 1.0f;
            var   testingTarget2 = NumericExtensions.Clamp(f, 0, 10);

            Assert.AreEqual(f, testingTarget2, "Should be equal.");

            int i = 1;
            var testingTarget3 = NumericExtensions.Clamp(i, 0, 10);

            Assert.AreEqual(i, testingTarget3, "Should be equal.");

            tlog.Debug(tag, $"Clamp END");
        }