コード例 #1
0
        public void RunTests()
        {
            // Read graphs to test from files
            ReadGraphsFromFile();

            // Prepare table printing
            PrettyPrinter printer = new PrettyPrinter(Logger);
            TableBuilder  table   = printer.BuildTable(new string[] { "Graph", "Algorithm", "Route Costs", "Time" });

            // Perform tests
            Logger.LogInformation("Run TSP tests...");
            foreach (KeyValuePair <string, IWeightedGraph <int, double> > graph in Graphs)
            {
                foreach (TspAlgorithm algorithm in AlgorithmsToTest)
                {
                    TestResult result = RunTest(graph.Key, graph.Value, algorithm);
                    table.AddLine(new string[] { graph.Key, algorithm.ToString(), result.Weight.ToString(), result.Time.ToString() });
                }
            }
            Logger.LogInformation("Done TSP tree tests.\n");

            // Display times as table
            table.Print();
        }
コード例 #2
0
ファイル: TestRunner.cs プロジェクト: alex-c/Graft
        public void RunTests()
        {
            // Read graphs to test from files
            ReadGraphsFromFile();

            // Prepare table printing
            PrettyPrinter printer = new PrettyPrinter(Logger);
            TableBuilder  table   = printer.BuildTable(new string[] { "Graph", "Algorithm", "Time" }, "Execution Times");

            // Perform tests
            Logger.LogInformation("Run minimum spanning tree tests...");
            foreach (KeyValuePair <string, IWeightedGraph <int, double> > graph in Graphs)
            {
                foreach (ALGORITHM algorithm in AlgorithmsToTest)
                {
                    TimeSpan time = RunTest(graph.Key, graph.Value, algorithm);
                    table.AddLine(new string[] { graph.Key, algorithm.ToString(), time.ToString() });
                }
            }
            Logger.LogInformation("Done running minimum spanning tree tests.\n");

            // Display times as table
            table.Print();
        }