示例#1
0
        public void TestLinear()
        {
            Equation equation = new Equation();

            equation.AddComponent(components[1]);
            equation.AddComponent(components[2]);
            Assert.AreEqual(equation.Resolve().Length, 1);
            Assert.IsTrue(Calculating.DoubleEquals(equation.Resolve()[0], 0.7));
        }
示例#2
0
        public void TestQuadratic()
        {
            Equation equation = new Equation();

            equation.AddComponent(components[0]);
            equation.AddComponent(components[2]);
            Assert.AreEqual(equation.Resolve().Length, 0);

            equation.AddComponent(components[1]);
            Assert.AreEqual(equation.Resolve().Length, 2);
            Assert.IsTrue(Calculating.DoubleEquals(equation.Resolve()[0], 9.242640));
            Assert.IsTrue(Calculating.DoubleEquals(equation.Resolve()[1], 0.757359));
        }