Beispiel #1
0
        public void SolveMatrixTest()
        {
            String        s1 = "CO2 + H2O = C6H12O6 + O2";
            ChemEqnMatrix cm = new ChemEqnMatrix(s1);

            cm.SolveMatrix();
            double[,] expected = { { 1, 0, 0, 0, 1 }, { 0, 1, 0, 0, 1 }, { 0, 0, 6, 0, 1 }, { 0, 0, 0, 1, 1 } };
            for (int i = 0; i < cm.matrix.GetLength(0); i++)
            {
                for (int j = 0; j < cm.matrix.GetLength(1); j++)
                {
                    Assert.AreEqual(expected[i, j], cm.matrix[i, j]);
                }
            }
        }