public void ShouldGetDistinctOneNonTerminalInputs() { DistinctInputFactory distinctInputFactory; IActionInput <Token>[] inputs; distinctInputFactory = new DistinctInputFactory(new RangeValueProvider()); inputs = distinctInputFactory.GetDistinctInputs(new IInput <Token>[] { new NonTerminalInput("A"), new NonTerminalInput("A"), new NonTerminalInput("A") }).ToArray(); Assert.AreEqual(1, inputs.Length); Assert.AreEqual("A", ((INonTerminalInput <Token>)inputs[0]).Name); }
public void ShouldGetDistinctOneNextInputs() { DistinctInputFactory distinctInputFactory; IActionInput <Token>[] inputs; distinctInputFactory = new DistinctInputFactory(new RangeValueProvider()); inputs = distinctInputFactory.GetDistinctInputs(new IInput <Token>[] { new TerminalInput(new Token("C", "a")), new TerminalInput(new Token("C", "a")), new TerminalInput(new Token("C", "a")) }).ToArray(); Assert.AreEqual(1, inputs.Length); Assert.AreEqual(new Token("C", "a"), ((ITerminalInput <Token>)inputs[0]).Value); }
public void ShouldGetDistinctTwoNextInputs() { DistinctInputFactory distinctInputFactory; IActionInput <char>[] inputs; distinctInputFactory = new DistinctInputFactory(new RangeValueProvider()); inputs = distinctInputFactory.GetDistinctInputs(new IInput <char>[] { new TerminalInput('a'), new TerminalInput('a'), new TerminalInput('b') }).ToArray(); Assert.AreEqual(2, inputs.Length); Assert.AreEqual('a', ((ITerminalInput <char>)inputs[0]).Value); Assert.AreEqual('b', ((ITerminalInput <char>)inputs[1]).Value); }
public void ShouldSplitLettersRangesUsingOneLetter() { DistinctInputFactory distinctInputFactory; IActionInput <char>[] inputs; distinctInputFactory = new DistinctInputFactory(new RangeValueProvider()); inputs = distinctInputFactory.GetDistinctInputs(new IInput <char>[] { new TerminalRangeInput('a', 'g'), new TerminalInput('c') }).ToArray(); Assert.AreEqual(3, inputs.Length); Assert.AreEqual('a', ((TerminalRangeInput)inputs[0]).FirstValue); Assert.AreEqual('b', ((TerminalRangeInput)inputs[0]).LastValue); Assert.AreEqual('c', ((TerminalInput)inputs[1]).Value); Assert.AreEqual('d', ((TerminalRangeInput)inputs[2]).FirstValue); Assert.AreEqual('g', ((TerminalRangeInput)inputs[2]).LastValue); }