public void MiscParseFailureTest() { var rootGroup = new PatternGroup(EnvironmentType.After); var group = new PatternGroup(EnvironmentType.Item); Assert.IsFalse(group.Parse(string.Empty)); Assert.IsFalse(group.Parse(null)); SetProperty(group, "RootGroup", rootGroup); Assert.IsFalse(GetBoolResult(group, "PreParseProcessing", "{[ab}]")); Assert.IsFalse(GetBoolResult(group, "PreParseProcessing", "a[bc]")); Assert.IsFalse(GetBoolResult(group, "PreParseProcessing", "{ab}c")); }
public void PatternGroupToStringTest() { // Verify an OR group var group = new PatternGroup(EnvironmentType.After); group.Parse("{[+high],[dental]}"); Assert.AreEqual("{[+high],[dental]}", group.ToString()); // Verify an AND group group = new PatternGroup(EnvironmentType.After); group.Parse("[[{a,e}{[+high][dental]}][-dors]]"); Assert.AreEqual("[[{a,e}{[+high],[dental]}][-dors]]", group.ToString()); // Verify a sequential group group = new PatternGroup(EnvironmentType.After); group.Parse("{a,e}pple{[+high][dental]}"); Assert.AreEqual("{a,e}pple{[+high],[dental]}", group.ToString()); // Verify a pattern with [C] and [V] group = new PatternGroup(EnvironmentType.After); group.Parse("[[V]{[+high],[-voice]}[C]]"); Assert.AreEqual("[[V]{[+high],[-voice]}[C]]", group.ToString()); group = new PatternGroup(EnvironmentType.Item); group.Parse("der[+high]"); Assert.AreEqual("der[+high]", group.ToString()); group = new PatternGroup(EnvironmentType.Item); group.Parse("der[+high]abc[dental]{[-voice][+dors]}"); Assert.AreEqual("der[+high]abc[dental]{[-voice],[+dors]}", group.ToString()); group = new PatternGroup(EnvironmentType.Before); group.Parse("#{[-voice],[+dors]}"); Assert.AreEqual("#{[-voice],[+dors]}", group.ToString()); group = new PatternGroup(EnvironmentType.After); group.Parse("{[-voice],[+dors]}#"); Assert.AreEqual("{[-voice],[+dors]}#", group.ToString()); // Parse any aspirated consonant string pattern = string.Format("[[C][{0}\u02B0]]", App.DottedCircle); group = new PatternGroup(EnvironmentType.Item); group.Parse(pattern); Assert.AreEqual(pattern, group.ToString()); // Parse any aspirated vowel pattern = string.Format("[[V][{0}\u02B0]]", App.DottedCircle); group = new PatternGroup(EnvironmentType.Item); group.Parse(pattern); Assert.AreEqual(pattern, group.ToString()); // Parse any aspirated consonant with zero or more diacritics pattern = string.Format("[[C][{0}\u02B0*]]", App.DottedCircle); group = new PatternGroup(EnvironmentType.Item); group.Parse(pattern); Assert.AreEqual(pattern, group.ToString()); // Parse any aspirated consonant with one or more diacritics pattern = string.Format("[[V][{0}\u02B0*]]", App.DottedCircle); group = new PatternGroup(EnvironmentType.Before); group.Parse(pattern); Assert.AreEqual(pattern, group.ToString()); }