/// <summary> /// Test a particular enum (file) /// </summary> /// <param name="coloredGraphEnum">enum (file)</param> /// <returns>report</returns> public StringBuilder Test(ColoredGraphEnum coloredGraphEnum) { stringBuilder.Clear(); Testing(coloredGraphEnum); return(stringBuilder); }
private void Testing(ColoredGraphEnum coloredGraphEnum) { try { testPath = ReaderWriter.ReaderWriter.CreateTestFile(testsDictionary[coloredGraphEnum]); reader = new ReaderWriter.ReaderGraph(testPath, false); graph = reader.ReadFile(); stringBuilder.AppendLine(coloredGraphEnum.ToString()); stringBuilder.AppendLine("Graph created."); stringBuilder.AppendLine(graph.ToString()); switch (coloredGraphEnum) { case ColoredGraphEnum.valid: Valid(graph); stringBuilder.AppendLine("Graph modified."); break; case ColoredGraphEnum.invalid: Invalid(graph); stringBuilder.AppendLine("Graph modified."); break; case ColoredGraphEnum.interchange1: case ColoredGraphEnum.interchange2: case ColoredGraphEnum.interchange3: case ColoredGraphEnum.interchange4: case ColoredGraphEnum.interchange5: graph.GetColoredGraph().GreedyColoring(graph.AllVertices(), GraphColoringAlgorithm.GraphColoringAlgorithm.GraphColoringAlgorithInterchangeEnum.interchange); stringBuilder.AppendLine("Graph colored."); break; default: throw new MyException.TestsException.TestsMissingTestException(coloredGraphEnum.ToString()); } stringBuilder.AppendLine(graph.GetColoredGraph().ToString()); } catch (KeyNotFoundException) { throw new MyException.TestsException.TestsMissingTestException(coloredGraphEnum.ToString()); } catch (MyException.GraphException.GraphException e) { stringBuilder.AppendLine(e.ToString()); } }