public void GreatestCommonDivisor() { var rules = new List<MarkovRule>() { new MarkovRule("|A", "A|"), new MarkovRule("|#|", "A#"), new MarkovRule("|#", "#B"), new MarkovRule("B", "|"), new MarkovRule("A", "C"), new MarkovRule("C", "|"), new MarkovRule("#", "t"), new MarkovRule("t", "", true) }; var algo = new MarkovAlgorithm(rules); Assert.That(algo.Compile("||#|||"), Is.EqualTo("|")); Assert.That(algo.Compile("|||#|||"), Is.EqualTo("|||")); }
public void LoopsTest1() { var algo = new MarkovAlgorithm(); algo.Rules.AddRange( new List<MarkovRule>() { new MarkovRule("a", "aa") } ); Assert.Throws<AlgorithmException>(delegate { string s = algo.Compile("a"); }); }
public void BinaryToUnary() { var algo = new MarkovAlgorithm(); algo.Rules.AddRange( new List<MarkovRule>() { new MarkovRule("|0", "0||"), new MarkovRule("1", "0|"), new MarkovRule("0", "") } ); Assert.That(algo.Compile("110"), Is.EqualTo("||||||")); }