public void AllPossibleConnectionsTest() { InitBitString(); string tempFilename = Path.GetTempFileName(); const long sequenceLength = 5; const ulong itself = Links.Itself; using (var links = new Links(tempFilename, LinksSizeStep)) { var sequence = new ulong[sequenceLength]; for (int i = 0; i < sequenceLength; i++) sequence[i] = links.Create(itself, itself); var sequences = new Sequences(links); var createResults = sequences.CreateAllVariants2(sequence); var reverseResults = sequences.CreateAllVariants2(sequence.Reverse().ToArray()); for (var i = 0; i < 1; i++) { var sw1 = Stopwatch.StartNew(); var searchResults1 = sequences.GetAllConnections(sequence); sw1.Stop(); var sw2 = Stopwatch.StartNew(); var searchResults2 = sequences.GetAllConnections1(sequence); sw2.Stop(); var sw3 = Stopwatch.StartNew(); var searchResults3 = sequences.GetAllConnections2(sequence); sw3.Stop(); var sw4 = Stopwatch.StartNew(); var searchResults4 = sequences.GetAllConnections3(sequence); sw4.Stop(); Global.Trash = searchResults3; Global.Trash = searchResults4; var intersection1 = createResults.Intersect(searchResults1).ToList(); Assert.IsTrue(intersection1.Count == createResults.Length); var intersection2 = reverseResults.Intersect(searchResults1).ToList(); Assert.IsTrue(intersection2.Count == reverseResults.Length); var intersection0 = searchResults1.Intersect(searchResults2).ToList(); Assert.IsTrue(intersection0.Count == searchResults2.Count); var intersection3 = searchResults2.Intersect(searchResults3).ToList(); Assert.IsTrue(intersection3.Count == searchResults3.Count); var intersection4 = searchResults3.Intersect(searchResults4).ToList(); Assert.IsTrue(intersection4.Count == searchResults4.Count); } for (int i = 0; i < sequenceLength; i++) links.Delete(sequence[i]); } File.Delete(tempFilename); }