public void TestMatch() { Sequence seq = new Sequence(AlphabetType.DNA, "acctccgg"); RegularExp regx = new RegularExp("test","ctc."); Match myMatch = regx.Match(seq, 1); Assert.AreEqual(null, myMatch); myMatch = regx.Match(seq, 3); Assert.AreEqual(3, myMatch.Start); Assert.AreEqual(4, myMatch.Length); Assert.AreEqual(1, myMatch.Strand); Assert.AreEqual(1.0, myMatch.Similarity, 1e-2); regx = new RegularExp("test", "acc"); myMatch = regx.Match(seq, 1); Assert.AreEqual(1, myMatch.Start); regx = new RegularExp("test", "cgg"); myMatch = regx.Match(seq, 6); Assert.AreEqual(8, myMatch.End); //last test //ISSUE: could be star problem regx = new RegularExp("test", "c.*g"); FeatureList matches = seq.Search(0, 0, regx); Assert.AreEqual(4, matches.Count); Assert.AreEqual("cctccgg", matches[0].Letters()); Assert.AreEqual("ctccgg", matches[1].Letters()); Assert.AreEqual("ccgg", matches[2].Letters()); Assert.AreEqual("cgg", matches[3].Letters()); }
/** test for case insensitivity of a match */ public void TestCaseInsensitivity() { RegularExp regx; regx = new RegularExp("test", "act", true); Assert.IsNotNull(regx.Match(new Sequence(AlphabetType.DNA, "act"), 1)); regx = new RegularExp("test", "act", true); Assert.IsNotNull(regx.Match(new Sequence(AlphabetType.DNA, "ACT"), 1)); regx = new RegularExp("test", "ACT", true); Assert.IsNull(regx.Match(new Sequence(AlphabetType.DNA, "act"), 1)); //--- regx = new RegularExp("test", "Act", true); Assert.IsNull(regx.Match(new Sequence(AlphabetType.DNA, "ACT"), 1)); regx = new RegularExp("test", "Act", false); Assert.IsNotNull(regx.Match(new Sequence(AlphabetType.DNA, "act"), 1)); regx = new RegularExp("test", "Act", false); Assert.IsNotNull(regx.Match(new Sequence(AlphabetType.DNA, "ACT"), 1)); }
public void TestTest() { Sequence seq = new Sequence(AlphabetType.DNA, "acctccctcccgacgg"); RegularExp regx = new RegularExp("test","ctc."); Match myMatch = regx.Match(seq, 3); Assert.IsNotNull(myMatch); FeatureList matches = seq.Search(0, 0, regx); Assert.IsNotNull(matches); }