private static void TestUnif(string name, IDistribution <string> dist, params string[] vals)
        {
            var sa = (StringDistribution)dist;

            Console.WriteLine(name + "=" + sa);
            var unifLogProb = -Math.Log(vals.Length);

            foreach (var s in vals)
            {
                StringInferenceTestUtilities.TestLogProbability(sa, unifLogProb, s);
            }
        }
        public void InferSubstringFromStringTest()
        {
            Variable <string> str    = Variable.Observed("Hello");
            Variable <string> substr = Variable.Substring(str, 0, 2);

            var engine          = new InferenceEngine();
            var substrPosterior = engine.Infer <StringDistribution>(substr);

            StringInferenceTestUtilities.TestLogProbability(substrPosterior, 0, "He");

            Variable <string> str2    = Variable.Random(StringDistribution.Any());
            Variable <string> substr2 = Variable.Substring(str2, 0, 2);

            var substr2Posterior = engine.Infer <StringDistribution>(substr2);

            StringInferenceTestUtilities.TestIfIncludes(substr2Posterior, "ab", "  ", "dd");
            StringInferenceTestUtilities.TestIfExcludes(substr2Posterior, "abc", " ", string.Empty);
        }