Ejemplo n.º 1
0
        public void OddPowerPositiveTest()
        {
            var p     = new CSP();
            var a     = new FloatVariable("a", p, -3, 3);
            var power = a ^ 3;

            a.MustEqual(2f);

            p.TestConsistency();
            AssertUnique(power, 8f);
        }
Ejemplo n.º 2
0
        public void OddPowerNegativeATest()
        {
            var p     = new CSP();
            var a     = new FloatVariable("a", p, -3, 3);
            var power = a ^ 3;

            power.MustEqual(-8f);

            p.TestConsistency();
            AssertUnique(a, -2f);
        }
Ejemplo n.º 3
0
        public void EvenPowerPositiveATest()
        {
            var p     = new CSP();
            var a     = new FloatVariable("a", p, 0, 3);
            var power = a ^ 2;

            power.MustEqual(4f);

            p.TestConsistency();
            AssertUnique(a, 2f);
        }
Ejemplo n.º 4
0
        public void EvenPowerNegativeTest()
        {
            var p     = new CSP();
            var a     = new FloatVariable("a", p, -3, 0);
            var power = a ^ 2;

            a.MustEqual(-2f);

            p.TestConsistency();
            AssertUnique(power, 4f);
        }
Ejemplo n.º 5
0
        public void EvenPowerZeroCrossingATest()
        {
            var p     = new CSP();
            var a     = new FloatVariable("a", p, -3, 3);
            var power = a ^ 2;

            power.MustEqual(4f);

            p.TestConsistency();
            Assert.AreEqual(new Interval(-2, 2), a.Value);
        }
Ejemplo n.º 6
0
        public void DifferenceTest()
        {
            var p = new CSP();
            var a = new FloatVariable("a", p, 0, 1);
            var b = new FloatVariable("b", p, 0, 1);
            var difference = a - b;
            a.MustEqual(0.5f);
            b.MustEqual(0.25f);

            p.TestConsistency();
            AssertUnique(difference, 0.25f);
        }
Ejemplo n.º 7
0
        public void DifferenceBTest()
        {
            var p          = new CSP();
            var a          = new FloatVariable("a", p, 0, 1);
            var b          = new FloatVariable("b", p, 0, 1);
            var difference = a - b;

            a.MustEqual(0.5f);
            difference.MustEqual(0.25f);

            p.TestConsistency();
            AssertUnique(b, 0.25f);
        }
Ejemplo n.º 8
0
        public void SumTest()
        {
            var p   = new CSP();
            var a   = new FloatVariable("a", p, 0, 1);
            var b   = new FloatVariable("b", p, 0, 1);
            var sum = a + b;

            a.MustEqual(0.5f);
            b.MustEqual(0.25f);

            p.TestConsistency();
            AssertUnique(sum, 0.75f);
        }
Ejemplo n.º 9
0
        public void QuotientBTest()
        {
            var p        = new CSP();
            var a        = new FloatVariable("a", p, 0, 3);
            var b        = new FloatVariable("b", p, 0, 3);
            var quotient = a / b;

            a.MustEqual(0.5f);
            quotient.MustEqual(0.25f);

            p.TestConsistency();
            AssertUnique(b, 2f);
        }
Ejemplo n.º 10
0
        public void ProductBTest()
        {
            var p       = new CSP();
            var a       = new FloatVariable("a", p, 0, 1);
            var b       = new FloatVariable("b", p, 0, 1);
            var product = a * b;

            a.MustEqual(0.5f);
            product.MustEqual(0.25f);

            p.TestConsistency();
            AssertUnique(b, 0.5f);
        }
Ejemplo n.º 11
0
        public void EvenPowerPositiveATest()
        {
            var p = new CSP();
            var a = new FloatVariable("a", p, 0, 3);
            var power = a ^ 2;
            power.MustEqual(4f);

            p.TestConsistency();
            AssertUnique(a, 2f);
        }
Ejemplo n.º 12
0
        public void OddPowerNegativeATest()
        {
            var p = new CSP();
            var a = new FloatVariable("a", p, -3, 3);
            var power = a ^ 3;
            power.MustEqual(-8f);

            p.TestConsistency();
            AssertUnique(a, -2f);
        }
Ejemplo n.º 13
0
        public void OddPowerPositiveTest()
        {
            var p = new CSP();
            var a = new FloatVariable("a", p, -3, 3);
            var power = a ^ 3;
            a.MustEqual(2f);

            p.TestConsistency();
            AssertUnique(power, 8f);
        }
Ejemplo n.º 14
0
        public void ProductTest()
        {
            var p = new CSP();
            var a = new FloatVariable("a", p, 0, 1);
            var b = new FloatVariable("b", p, 0, 1);
            var product = a * b;
            a.MustEqual(0.5f);
            b.MustEqual(0.5f);

            p.TestConsistency();
            AssertUnique(product, 0.25f);
        }
Ejemplo n.º 15
0
        public void QuotientTest()
        {
            var p = new CSP();
            var a = new FloatVariable("a", p, 0, 1);
            var b = new FloatVariable("b", p, 0, 1);
            var quotient = a / b;
            a.MustEqual(0.5f);
            b.MustEqual(0.5f);

            p.TestConsistency();
            AssertUnique(quotient, 1);
        }
Ejemplo n.º 16
0
        public void SumTest()
        {
            var p = new CSP();
            var a = new FloatVariable("a", p, 0, 1);
            var b = new FloatVariable("b", p, 0, 1);
            var sum = a + b;
            a.MustEqual(0.5f);
            b.MustEqual(0.25f);

            p.TestConsistency();
            AssertUnique(sum, 0.75f);
        }
Ejemplo n.º 17
0
        public void EvenPowerZeroCrossingATest()
        {
            var p = new CSP();
            var a = new FloatVariable("a", p, -3, 3);
            var power = a ^ 2;
            power.MustEqual(4f);

            p.TestConsistency();
            Assert.AreEqual(new Interval(-2,2), a.Value);
        }
Ejemplo n.º 18
0
        public void EvenPowerNegativeTest()
        {
            var p = new CSP();
            var a = new FloatVariable("a", p, -3, 0);
            var power = a ^ 2;
            a.MustEqual(-2f);

            p.TestConsistency();
            AssertUnique(power, 4f);
        }