Esempio n. 1
0
        public void CopySequence2()
        {
            const int CopyCount   = 10;
            const int LetterCount = 20;

            StringTransducer copy = StringTransducer.Copy();

            for (int i = 0; i < CopyCount - 1; ++i)
            {
                copy.AppendInPlace(StringTransducer.Copy());
            }

            var             sequence         = new string(Enumerable.Repeat('a', LetterCount).ToArray());
            StringAutomaton result           = copy.ProjectSource(sequence);
            var             expectedLogValue = Math.Log(StringInferenceTestUtilities.Partitions(LetterCount, CopyCount));

            Assert.Equal(expectedLogValue, result.GetLogValue(sequence), 1e-8);
        }