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