public static void Main(string[] args) { var alphabet = new Dictionary <string, string> { { "(", ")" }, { "[", "]" }, { "{", "}" } }; Console.WriteLine(Dyck.IsDyckString("((()))")); Console.WriteLine(IsDickStringMain.IsDyckString("()", alphabet)); }
public void TestIsDyckString() { var alphabet = new Dictionary <string, string> { { "(", ")" }, { "[", "]" }, { "{", "}" } }; alphabet.Add("<", ">"); alphabet.Add("*", "/"); // test to see if program is doing what we want him doing // Assert.AreEqual(expected response, method of class to be tested) Assert.AreEqual(true, IsDickStringMain.IsDyckString("[(())]", alphabet)); Assert.AreEqual(false, IsDickStringMain.IsDyckString("[((/*))]", alphabet)); Assert.AreEqual(true, IsDickStringMain.IsDyckString("[(({}{}))]", alphabet)); Assert.AreEqual(false, IsDickStringMain.IsDyckString("[((}))]", alphabet)); Assert.AreEqual(true, IsDickStringMain.IsDyckString("[((<>))]", alphabet)); Assert.AreEqual(true, IsDickStringMain.IsDyckString("[((*/))]", alphabet)); Assert.AreEqual(false, IsDickStringMain.IsDyckString(")", alphabet)); }