public void TestAdvanceMultiplesOfTwoAndThree() { const string bsInPairsOrTriples = "a((.b.b.b)+|(.b.b)+).c"; for (int i = 1; i < 40; i++) { string[] path = new[] { "a" } .Concat(Enumerable.Range(0, i).Select(_ => new[] { "1", "b" }).SelectMany(s => s)) .Concat(i % 2 == 0 || i % 3 == 0 ? new[] { "2", "-c" } : new[] { "2", "#c" }) .ToArray(); IGraphkenState result = AdvanceToEnd(bsInPairsOrTriples, " (for i=" + i + ")", path); Assert.IsFalse(result.CountedObjects.Any()); } }
public void TestAdvanceAlternativeWithOneSuccess() { const string oneOrTwoBs = "a(.b.b|.b).c"; { IGraphkenState result = AdvanceToEnd(oneOrTwoBs, "a", "1", "b", "1", "-c"); Assert.IsFalse(result.CountedObjects.Any()); } { IGraphkenState result = AdvanceToEnd(oneOrTwoBs, "a", "1", "b", "1", "b", "1", "-c"); Assert.IsFalse(result.CountedObjects.Any()); } { IGraphkenState result = AdvanceToEnd(oneOrTwoBs, "a", "1", "b", "1", "b", "1", "#b"); Assert.IsFalse(result.CountedObjects.Any()); } }
public void TestAdvanceIndeterministicAlternativeFails() { IGraphkenState result = AdvanceToEnd(":(.b|.c)", "a", "1", "#d"); Assert.IsFalse(result.CountedObjects.Any()); }
public void TestAdvanceOneOrMore() { IGraphkenState result = AdvanceToEnd(": (. :)+", "a", "1", "-b", "2", "-c"); Assert.IsFalse(result.CountedObjects.Any()); }