Exemplo n.º 1
0
        public void DetermineCoefficientsTest1()
        {
            String        s  = "CHCl3 + O2 = CO2 + H2O + Cl2";
            ChemEqnMatrix cm = new ChemEqnMatrix(s);

            cm.Balance();
            int[] expected = { 4, 5, 4, 2, 6 };
            int[] result   = cm.DetermineCoefficients();
            for (int i = 0; i < result.Length; i++)
            {
                Assert.AreEqual(expected[i], result[i]);
            }
        }
Exemplo n.º 2
0
        public void DetermineCoefficientsTest2()
        {
            String        s  = "C6HOF2Ne = C3HOFNe + C";
            ChemEqnMatrix cm = new ChemEqnMatrix(s);

            cm.Balance();
            int[] expected = { 1, 1, 0 };
            int[] result   = cm.DetermineCoefficients();
            for (int i = 0; i < result.Length; i++)
            {
                Assert.AreEqual(expected[i], result[i]);
            }
        }
Exemplo n.º 3
0
        public void DetermineCoefficientsTest()
        {
            String        s  = "CO2 + H2O = C6H12O6 + O2";
            ChemEqnMatrix cm = new ChemEqnMatrix(s);

            cm.Balance();
            int[] expected = { 6, 6, 1, 6 };
            int[] result   = cm.DetermineCoefficients();
            for (int i = 0; i < result.Length; i++)
            {
                Assert.AreEqual(expected[i], result[i]);
            }
        }