/// <summary> /// Run tests tagged with a particular attribute, and invoke them using reflection. /// Currently, only tests from this class are invoked. /// </summary> public static void Main(string[] args) { bool isDone = false; while (!isDone) { Console.Write("Enter input string with unique final character: "); Console.Out.Flush(); string word = Console.ReadLine(); SuffixTree.Verbosity = StVerbosityLevel.Verbose; SuffixTree tree = null; bool isCreationSuccessful = true; try { tree = new SuffixTree(word); Console.WriteLine("Final suffix tree:"); Console.WriteLine(tree.ToString()); } catch (Exception ex) { isCreationSuccessful = false; Console.WriteLine(); Console.WriteLine(String.Format( "Suffix tree creation: Caught exception: {0;s}", ex.Message)); } Console.WriteLine(); if (isCreationSuccessful) { Console.Write("Press 'Enter' to proceed with validation: "); Console.Out.Flush(); Console.ReadLine(); try { runTests(tree); } catch (Exception ex) { Console.WriteLine(); Console.WriteLine(String.Format( "Suffix tree testing: Caught exception: {0;s}", ex.Message)); } } Console.Write("Continue (y or n)? "); Console.Out.Flush(); string continueStr = Console.ReadLine(); if (continueStr == null || continueStr.Length > 0 && continueStr.ToLower()[0] != 'y') { isDone = true; } } }