CFGLibTest.Unit.TestCFGToCNF.TestAccepts07 C# (CSharp) Method

TestAccepts07() private method

private TestAccepts07 ( ) : void
return void
		public void TestAccepts07() {
			var productions = new HashSet<Production> {
				CFGParser.Production("<A> -> 'a'"),
				CFGParser.Production("<A> -> <B>"),
				CFGParser.Production("<B> -> 'b'"),
				CFGParser.Production("<B> -> <A>"),
			};
			var g = new Grammar(productions, Nonterminal.Of("A"));
			var h = g.ToCNF();

			Assert.IsTrue(h.Accepts(Sentence.FromWords("a")));
			Assert.IsTrue(h.Accepts(Sentence.FromWords("b")));
		}