Пример #1
0
        public void Calculate_With_Power_Symbolic(string value)
        {
            string        exponent      = "Bar";
            PrimitiveUnit power         = new PrimitiveUnit(exponent);
            PrimitiveUnit symbolicValue = new PrimitiveUnit(value, power);

            Assert.That(symbolicValue.Calculate(), Is.EqualTo(0));

            symbolicValue = new PrimitiveUnit(value + Query.POWER + exponent);

            Assert.That(symbolicValue.Calculate(), Is.EqualTo(0));
        }
Пример #2
0
        public void Calculate_With_Power_Root(string value, double expectedResult)
        {
            string        exponent      = "0.5";
            PrimitiveUnit power         = new PrimitiveUnit(exponent);
            PrimitiveUnit symbolicValue = new PrimitiveUnit(value, power);

            Assert.That(symbolicValue.Calculate(), Is.EqualTo(expectedResult));

            symbolicValue = new PrimitiveUnit(value + Query.POWER + exponent);

            Assert.That(symbolicValue.Calculate(), Is.EqualTo(expectedResult));
        }
Пример #3
0
        [TestCase("2^(3^-2)", 1.08006)]      //(42a)
        public void Calculate_With_Power_Various(string value, double expectedResult)
        {
            PrimitiveUnit symbolicValue = new PrimitiveUnit(value);

            Assert.That(symbolicValue.Calculate(), Is.EqualTo(expectedResult).Within(0.000001));
        }
Пример #4
0
        public void Calculate_With_No_Exponent(string value, double expectedResult)
        {
            PrimitiveUnit symbolicValue = new PrimitiveUnit(value);

            Assert.That(symbolicValue.Calculate(), Is.EqualTo(expectedResult));
        }