Ejemplo n.º 1
0
        public void CanGet()
        {
            const int MIN_VALUE = 0;
            const int MAX_VALUE = 1;

            float value  = 0.5f;
            var   suffix = new ClampSetSuffix <float>(() => value, i => value = i, MIN_VALUE, MAX_VALUE);

            Assert.AreEqual(value, suffix.Get());
        }
Ejemplo n.º 2
0
        public void CanGet()
        {
            const int MIN_VALUE = 0;
            const int MAX_VALUE = 1;

            float value = 0.5f;
            var suffix = new ClampSetSuffix<float>(() => value, i => value = i, MIN_VALUE, MAX_VALUE);

            Assert.AreEqual(value, suffix.Get());
        }
Ejemplo n.º 3
0
        public void CanGet()
        {
            const int MIN_VALUE = 0;
            const int MAX_VALUE = 1;

            float value = 0.5f;
            var suffix = new ClampSetSuffix<ScalarDoubleValue>(() => value, i => value = i, MIN_VALUE, MAX_VALUE);

            Assert.AreEqual(new ScalarDoubleValue(value), suffix.Get().Value);
        }
Ejemplo n.º 4
0
        public void CanGet()
        {
            const int MIN_VALUE = 0;
            const int MAX_VALUE = 1;

            float value  = 0.5f;
            var   suffix = new ClampSetSuffix <ScalarDoubleValue>(() => value, i => value = i, MIN_VALUE, MAX_VALUE);

            Assert.AreEqual(new ScalarDoubleValue(value), suffix.Get().Value);
        }
Ejemplo n.º 5
0
        public void CanSet()
        {
            const int MIN_VALUE = 0;
            const int MAX_VALUE = 1;
            ScalarValue SET_VALUE = 0.5f;

            ScalarValue value = 0;
            var suffix = new ClampSetSuffix<ScalarValue>(() => value, i => value = i, MIN_VALUE, MAX_VALUE);

            suffix.Set(SET_VALUE);

            Assert.AreEqual(value, suffix.Get().Value);
            Assert.AreEqual(value, SET_VALUE);
        }
Ejemplo n.º 6
0
        public void CanSet()
        {
            const int   MIN_VALUE = 0;
            const int   MAX_VALUE = 1;
            ScalarValue SET_VALUE = 0.5f;

            ScalarValue value  = 0;
            var         suffix = new ClampSetSuffix <ScalarValue>(() => value, i => value = i, MIN_VALUE, MAX_VALUE);

            suffix.Set(SET_VALUE);

            Assert.AreEqual(value, suffix.Get().Value);
            Assert.AreEqual(value, SET_VALUE);
        }
Ejemplo n.º 7
0
        public void CanSimpleClamp()
        {
            const int MIN_VALUE = 0;
            const int MAX_VALUE = 1;
            const float SET_VALUE = 1.5f;

            float value = 0;
            var suffix = new ClampSetSuffix<float>(() => value, i => value = i, MIN_VALUE, MAX_VALUE);

            suffix.Set(SET_VALUE);

            Assert.AreEqual(value, suffix.Get());
            Assert.AreNotEqual(SET_VALUE, value);
            Assert.AreEqual(MAX_VALUE, value);
        }
Ejemplo n.º 8
0
        public void CanSimpleClamp()
        {
            const int   MIN_VALUE = 0;
            const int   MAX_VALUE = 1;
            const float SET_VALUE = 1.5f;

            float value  = 0;
            var   suffix = new ClampSetSuffix <float>(() => value, i => value = i, MIN_VALUE, MAX_VALUE);

            suffix.Set(SET_VALUE);

            Assert.AreEqual(value, suffix.Get());
            Assert.AreNotEqual(SET_VALUE, value);
            Assert.AreEqual(MAX_VALUE, value);
        }
Ejemplo n.º 9
0
        public void CanComplexStepClamp()
        {
            const int MIN_VALUE = 0;
            const int MAX_VALUE = 1;
            const float SET_VALUE = 1.4f;
            const float EXPECTED_VALUE = MAX_VALUE;
            const float STEP_VALUE = 0.5f;

            float value = 0;
            var suffix = new ClampSetSuffix<float>(() => value, i => value = i, MIN_VALUE, MAX_VALUE, STEP_VALUE);

            suffix.Set(SET_VALUE);

            Assert.AreEqual(value, suffix.Get());
            Assert.AreNotEqual(SET_VALUE, value);
            Assert.AreEqual(EXPECTED_VALUE, value);
        }
Ejemplo n.º 10
0
        public void CanComplexStepClamp()
        {
            const int   MIN_VALUE      = 0;
            const int   MAX_VALUE      = 1;
            const float SET_VALUE      = 1.4f;
            const float EXPECTED_VALUE = MAX_VALUE;
            const float STEP_VALUE     = 0.5f;

            float value  = 0;
            var   suffix = new ClampSetSuffix <float>(() => value, i => value = i, MIN_VALUE, MAX_VALUE, STEP_VALUE);

            suffix.Set(SET_VALUE);

            Assert.AreEqual(value, suffix.Get());
            Assert.AreNotEqual(SET_VALUE, value);
            Assert.AreEqual(EXPECTED_VALUE, value);
        }
Ejemplo n.º 11
0
        public void CanStepClamp()
        {
            const int   MIN_VALUE      = 0;
            const int   MAX_VALUE      = 1;
            const float SET_VALUE      = 0.4f;
            const float EXPECTED_VALUE = 0.5f;
            const float STEP_VALUE     = 0.5f;

            float value  = 0;
            var   suffix = new ClampSetSuffix <ScalarValue>(() => value, i => value = i, MIN_VALUE, MAX_VALUE, STEP_VALUE);

            suffix.Set(SET_VALUE);

            Assert.AreEqual(ScalarValue.Create(value), suffix.Get().Value);
            Assert.AreNotEqual(SET_VALUE, value);
            Assert.AreEqual(EXPECTED_VALUE, value);
        }
Ejemplo n.º 12
0
        public void CanStepClamp()
        {
            const int MIN_VALUE = 0;
            const int MAX_VALUE = 1;
            const float SET_VALUE = 0.4f;
            const float EXPECTED_VALUE = 0.5f;
            const float STEP_VALUE = 0.5f;

            float value = 0;
            var suffix = new ClampSetSuffix<ScalarValue>(() => value, i => value = i, MIN_VALUE, MAX_VALUE, STEP_VALUE);

            suffix.Set(SET_VALUE);

            Assert.AreEqual(ScalarValue.Create(value), suffix.Get().Value);
            Assert.AreNotEqual(SET_VALUE, value);
            Assert.AreEqual(EXPECTED_VALUE, value);
        }