Example #1
0
        public void GetSystemSolution_2()
        {
            // Log file path
            string logfilepath = "../../Test_Data/TinyMathTest/MathHelperTest/log.txt";
            MathHelper mHelper = new MathHelper(logfilepath);

            // Predefined count of linear equation in the system
            int LinearEquationCount = 2;
            // Predefined count of unknown members in the system
            int UnknownCount = 2;

            // Input strings
            string str_1 = "-6.78x+0.69y+5z=8";
            string str_2 = "-78x-12.69y+z=-28.56";

            // List with strings
            List<string> strList = new List<string>();
            strList.Add(str_1);
            strList.Add(str_2);

            // Actual value
            string actualResult =
                mHelper.TrySolveLinearEquationSystem(LinearEquationCount,
                    UnknownCount, strList);

            // Expected value
            string expectedResult = "Wrong input system. "
                                    + "Check the input data for pattern matching "
                                    + "(look at the example).";

            // Asserts
            Assert.AreEqual(expectedResult, actualResult);
        }
Example #2
0
        public void GetSystemSolution_4()
        {
            // Log file path
            string logfilepath = "../../Test_Data/TinyMathTest/MathHelperTest/log.txt";
            MathHelper mHelper = new MathHelper(logfilepath);

            // Predefined count of linear equation in the system
            int LinearEquationCount = 3;
            // Predefined count of unknown members in the system
            int UnknownCount = 3;

            // Input strings
            string str_1 = "-6x+9y+5z=8";
            string str_2 = "-7x-12y+z=-28";
            string str_3 = "5x+6y+z=-28";

            // List with strings
            List<string> strList = new List<string>();
            strList.Add(str_1);
            strList.Add(str_2);
            strList.Add(str_3);

            // Actual value
            string actualResult =
                mHelper.TrySolveLinearEquationSystem(LinearEquationCount,
                    UnknownCount, strList);

            // Expected value                                             
            string expectedResult =
                "x: -8,70588235294118 y: 5,80392156862745 z: -19,2941176470588 ";

            // Asserts
            Assert.AreEqual(expectedResult, actualResult);
        }