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

TestCNFNoNull03() private method

private TestCNFNoNull03 ( ) : void
return void
		public void TestCNFNoNull03() {
			var productions = new HashSet<Production> {
				CFGParser.Production("<S> -> <A>"),
				CFGParser.Production("<S> -> <B>"),
				CFGParser.Production("<A> -> <B>"),
				CFGParser.Production("<B> -> <A>"),
				CFGParser.Production("<A> -> 'a'"),
				CFGParser.Production("<B> -> 'b'"),
			};

			Grammar g = new Grammar(productions, Nonterminal.Of("S"));
			CNFGrammar h = g.ToCNF();

			Helpers.AssertNear(0, h.Cyk(Sentence.FromLetters("")));
			Helpers.AssertNear(0.5, h.Cyk(Sentence.FromLetters("a")));
			Helpers.AssertNear(0.5, h.Cyk(Sentence.FromLetters("b")));
		}