Пример #1
0
            public static string TestDeCateOriIntra()
            {
                object[,] teste = new object[, ] {
                    { "0", "0", "0" },
                    { "1", "1", "1" },
                    { "1", "2", "2" },
                    { "1", "3", "3" },
                    { "2", "4", "2" },
                    { "6", "12", "2" },
                    { "24", "12", "0" },
                    { "113", "355", "3" },
                    { "456", "1368", "3" },
                    { "74916", "674244", "9" },
                    { "44", "1242", "28" },
                    { "51", "500", "9" }
                };

                string str = "";

                for (int i = 0; i < teste.GetLength(0); i++)
                {
                    List <int> b = new List <int>();

                    for (int j = 0; j < ((string)teste[i, 0]).Length; j++)
                    {
                        b.Add(Floatz.charToInt(((string)teste[i, 0])[j]));
                    }

                    List <int> temp = new List <int>();
                    for (int j = 0; j < ((string)teste[i, 1]).Length; j++)
                    {
                        temp.Add(Floatz.charToInt(((string)teste[i, 1])[j]));
                    }
                    List <int> resultCorrect = new List <int>();
                    for (int j = 0; j < ((string)teste[i, 2]).Length; j++)
                    {
                        resultCorrect.Add(Floatz.charToInt(((string)teste[i, 2])[j]));
                    }

                    List <int> result = Floatz.DeCateOriIntra(b, temp);
                    if (Floatz.Compare2Lists(result, resultCorrect) != 0)
                    {
                        str += String.Format(
                            "\n Test failed:DeCateOriIntra #{0} nereusita.\n \n b={1},temp={2}, result={3} |corect e: {4}\n\n",
                            i, Floatz.ListToString(b), Floatz.ListToString(temp), Floatz.ListToString(result), Floatz.ListToString(resultCorrect)
                            );
                    }
                }
                if (str == "")
                {
                    return("Nu exista probleme la DeCateOriIntra.");
                }
                return(str);
            }