Esempio n. 1
0
        /// <summary>
        /// Tests the support of a character distribution.
        /// </summary>
        /// <param name="distributionName">The name of the distribution.</param>
        /// <param name="distribution">The distribution.</param>
        /// <param name="included">A list of characters that must be included in the support of the distribution.</param>
        /// <param name="excluded">A list of characters that must not be included in the support of the distribution.</param>
        private static void TestSupport(
            string distributionName,
            DiscreteChar distribution,
            IEnumerable <char> included,
            IEnumerable <char> excluded)
        {
            Console.WriteLine(distributionName.PadLeft(12) + ":" + distribution);

            foreach (var ch in included)
            {
                Assert.True(!double.IsNegativeInfinity(distribution.GetLogProb(ch)), distribution + " should contain " + ch);
            }

            foreach (var ch in excluded)
            {
                Assert.True(double.IsNegativeInfinity(distribution.GetLogProb(ch)), distribution + " should not contain " + ch);
            }
        }