public static void AddDataFromInput(int input, bool printAfter = true) { // Adds the data by the user's input // Prints the next section // Or starts the benchmark if it is the last section if (IsNumberValid(input)) { int inputForArray = input - 1; switch (currentSection) { case ChoosingState.ChoosingComparisons: currentBenchmarkData = new BenchmarkData(BenchmarksManager.comparisons[inputForArray]); currentSection = ChoosingState.ChoosingDuration; if (printAfter) { PrintSection(); } break; case ChoosingState.ChoosingDuration: currentBenchmarkPresetGroup = BenchmarksManager.benchmarkPresetGroups[inputForArray]; currentSection = ChoosingState.ChoosingPreset; if (printAfter) { PrintSection(); } break; case ChoosingState.ChoosingPreset: currentSection = ChoosingState.Complete; currentBenchmarkData.InputPreset(currentBenchmarkPresetGroup.presets[inputForArray], currentBenchmarkPresetGroup.Name, input); BenchmarksManager.RunBenchmark(currentBenchmarkData); break; default: break; } } else { ActiveError("Number is invalid. Number: <" + input + ">"); } }
// Section #3 public static void PrintBenchmarkPresetGroup() { BenchmarkPresetGroup group = currentBenchmarkPresetGroup; WriteLine(string.Format("These are the {0} benchmark presets:", group.Name)); for (int i = 0; i < group.presets.Length; i++) { int number = i + 1; int changesAmount = (currentBenchmarkData.ComparingStrings) ? group.presets[i].ChangesAmount / 50 : group.presets[i].ChangesAmount; string[] lines = { "", string.Format("PRESET #{0}:",number), string.Format("-{0} Tests", group.presets[i].TestsAmount), string.Format("-{0} Changes",changesAmount) }; WriteLines(lines); } }
public BenchmarkPresetGroup(BenchmarkPresetGroup benchmarkPresetGroup) : this(benchmarkPresetGroup.Name, benchmarkPresetGroup.presets) { }