public void TestMatchIncrement()
        {
            Sequence seq = new Sequence(AlphabetType.DNA, "actgactg");
			Composition composition = new Composition( "Composition", AlphabetType.DNA, 1, 7, 1.7, Composition.MatchMode.ALL, 0.0 );
            Match match;
            match = composition.Match(seq, 1);
            Assert.AreEqual(1, match.Length);
            Assert.AreEqual(0, composition.Increment);
            Assert.AreEqual("a", match.Letters());
            match = composition.Match(seq, 1);
            Assert.AreEqual(3, match.Length);
            Assert.AreEqual(0, composition.Increment);
            Assert.AreEqual("act", match.Letters());
            match = composition.Match(seq, 1);
            Assert.AreEqual(4, match.Length);
            Assert.AreEqual(0, composition.Increment);
            Assert.AreEqual("actg", match.Letters());
            match = composition.Match(seq, 1);
            Assert.AreEqual(6, match.Length);
            Assert.AreEqual(0, composition.Increment);
            Assert.AreEqual("actgac", match.Letters());
            match = composition.Match(seq, 1);
            Assert.AreEqual(7, match.Length);
            Assert.AreEqual(1, composition.Increment);
            Assert.AreEqual("actgact", match.Letters());
        }
        public void TestMatchBest()
        {
            Sequence seq = new Sequence(AlphabetType.DNA, "actcctctg");
            Composition composition = new Composition("Composition", AlphabetType.DNA, 3, 8, 1.7, Composition.MatchMode.BEST, 0.0);
            composition.Add('a', 1.0);
            composition.Add('c', 2.0);
            composition.Add('t', 3.0);
            composition.DefaultWeight = (1.0);

            Match match = composition.Match(seq, 1);
            Assert.AreEqual(1, match.Start);
            Assert.AreEqual(8, match.End);
            Assert.AreEqual("actcctct", match.Letters());
            Assert.AreEqual(0.75, match.Similarity, 1e-2);

            match = seq.SearchBest(0, 0, composition);
            Assert.AreEqual(6, match.Start);
            Assert.AreEqual("tct", match.Letters());
            Assert.AreEqual(0.88, match.Similarity, 1e-2);
        }
        /** Test for match method from pattern interface */
        public void TestMatchAll()
        {
            Sequence seq = new Sequence(AlphabetType.DNA, "act");
			Composition composition = new Composition( "Composition", AlphabetType.DNA, 2, 3, 1, Composition.MatchMode.ALL, 0.0 );
            composition.Add('a', 1.0);
            composition.Add('c', 2.0);
            composition.DefaultWeight = (3.0);
            Match match = composition.Match(seq, 1);
            Assert.AreEqual(2, match.Length);
            Assert.AreEqual(1, match.Start);
            Assert.AreEqual(2, match.End);
            Assert.AreEqual("ac", match.Letters());
            Assert.AreEqual(0.5, match.Similarity, 1e-2);

            match = seq.SearchBest(0, 0, composition);
            Assert.AreEqual(2, match.Start);
            Assert.AreEqual("ct", match.Letters());
            Assert.AreEqual(0.83, match.Similarity, 1e-2);

            FeatureList matches = seq.Search(0, 0, composition);
            Assert.AreEqual(3, matches.Count);
            Assert.AreEqual("ac", matches[0].Letters());
            Assert.AreEqual("act", matches[1].Letters());
            Assert.AreEqual("ct", matches[2].Letters());
        }