public void LevelFiveTest() { var cycleTestChainLevel5 = new Chain("adbaacbbaacaadbaa"); var reorganizer = new NullCycleSpaceReorganizer(5); var result = reorganizer.Reorganize(testChain); Assert.AreEqual(cycleTestChainLevel5, result); }
public void LevelOneTest() { var cycleTestChainLevel1 = new Chain("adbaacbbaacaa"); var rebulder = new NullCycleSpaceReorganizer(1); var result = rebulder.Reorganize(testChain); Assert.AreEqual(cycleTestChainLevel1, result); }
public void GetThirdLevelChainTest() { matrix = new Matrix(testChain.Alphabet.Cardinality, 3); var reorganizer = new NullCycleSpaceReorganizer(2); testChain = (BaseChain)reorganizer.Reorganize(testChain); var it = new IteratorStart(testChain, 3, 1); while (it.Next()) { var chain = it.Current(); var arrayToTeach = new int[chain.GetLength()]; for (var i = 0; i < chain.GetLength(); i++) { arrayToTeach[i] = testChain.Alphabet.IndexOf(chain[i]); } matrix.Add(arrayToTeach); } var toGet = new int[1]; toGet[0] = testChain.Alphabet.IndexOf((ValueString)"a"); Assert.AreEqual(6, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"b"); Assert.AreEqual(3, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"c"); Assert.AreEqual(2, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"d"); Assert.AreEqual(1, matrix.FrequencyFromObject(toGet)); toGet = new int[2]; toGet[0] = testChain.Alphabet.IndexOf((ValueString)"a"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"a"); Assert.AreEqual(3, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"a"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"b"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"a"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"c"); Assert.AreEqual(2, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"a"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"d"); Assert.AreEqual(1, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"b"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"a"); Assert.AreEqual(2, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"b"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"b"); Assert.AreEqual(1, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"b"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"c"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"b"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"d"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"c"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"a"); Assert.AreEqual(1, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"c"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"b"); Assert.AreEqual(1, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"c"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"c"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"c"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"d"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"d"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"a"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"d"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"b"); Assert.AreEqual(1, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"d"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"c"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"d"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"d"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet = new int[3]; toGet[0] = testChain.Alphabet.IndexOf((ValueString)"a"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"a"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"c"); Assert.AreEqual(2, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"a"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"a"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"d"); Assert.AreEqual(1, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"a"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"c"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"a"); Assert.AreEqual(1, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"a"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"c"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"b"); Assert.AreEqual(1, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"a"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"d"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"b"); Assert.AreEqual(1, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"a"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"b"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"b"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"b"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"a"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"a"); Assert.AreEqual(2, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"b"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"a"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"c"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"b"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"b"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"a"); Assert.AreEqual(1, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"b"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"c"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"b"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"b"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"d"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"b"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"b"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"b"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"b"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"c"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"a"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"a"); Assert.AreEqual(1, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"c"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"b"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"b"); Assert.AreEqual(1, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"c"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"b"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"a"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"c"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"c"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"b"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"c"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"d"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"b"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"c"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"d"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"c"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"d"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"b"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"a"); Assert.AreEqual(1, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"d"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"b"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"b"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"d"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"a"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"a"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"d"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"c"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"b"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"d"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"d"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"b"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); toGet[0] = testChain.Alphabet.IndexOf((ValueString)"d"); toGet[1] = testChain.Alphabet.IndexOf((ValueString)"b"); toGet[2] = testChain.Alphabet.IndexOf((ValueString)"b"); Assert.AreEqual(0, matrix.FrequencyFromObject(toGet)); }