Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
        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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
        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);
        }
        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);
        }
        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);
        }
        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);
        }
        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);
        }
        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);
        }
        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);
        }
        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);
        }