Ejemplo n.º 1
0
        public void GetMate()
        {
            var finder = new AlignmentMateFinder();
            
            var read1 = CreateAlignment(100, 500, "1");
            var read1Mate = CreateAlignment(500, 100, "1");
            var read2 = CreateAlignment(200, 400, "2");
            var read2Mate = CreateAlignment(400, 200, "2");
            var read3 = CreateAlignment(201, 600, "3");
            var read3Mate = CreateAlignment(600, 201, "3");
            var read4 = CreateAlignment(1000, 2000, "4");
            var read4Mate = CreateAlignment(2000, 1000, "4");
            var read5 = CreateAlignment(2500, 3501, "5");
            var read5Mate = CreateAlignment(3501, 2500, "5");

            Assert.Equal(finder.LastClearedPosition, null);
            Assert.Equal(finder.NextMatePosition, null);

            Assert.Equal(finder.GetMate(read1), null);
            Assert.Equal(finder.LastClearedPosition, 99);
            Assert.Equal(finder.NextMatePosition, 500);

            Assert.Equal(finder.GetMate(read2), null);
            Assert.Equal(finder.LastClearedPosition, 99);
            Assert.Equal(finder.NextMatePosition, 400);

            Assert.Equal(finder.GetMate(read3), null);
            Assert.Equal(finder.LastClearedPosition, 99);

            ReadTests.CompareReads(finder.GetMate(read2Mate), read2);
            Assert.Equal(finder.LastClearedPosition, 99);
            Assert.Equal(finder.NextMatePosition, 500);

            ReadTests.CompareReads(finder.GetMate(read1Mate), read1);
            Assert.Equal(finder.LastClearedPosition, 200);
            Assert.Equal(finder.NextMatePosition, 600);

            ReadTests.CompareReads(finder.GetMate(read3Mate), read3);
            Assert.Equal(finder.LastClearedPosition, null);

            Assert.Equal(finder.GetMate(read4), null);
            Assert.Equal(finder.LastClearedPosition, 999);

            ReadTests.CompareReads(finder.GetMate(read4Mate), read4);
            Assert.Equal(finder.LastClearedPosition, null);

            Assert.Equal(finder.GetMate(read5), null);
            Assert.Equal(finder.LastClearedPosition, 2499);

            Assert.Equal(finder.GetMate(read5Mate), null); // out of window gets tossed
            Assert.Equal(finder.LastClearedPosition, null);
            Assert.Equal(finder.NextMatePosition, null);
            Assert.Equal(2, finder.ReadsUnpairable);
            
            Assert.Throws<ArgumentException>(() => finder.GetMate(CreateAlignment(2500, 2500, null))); // null name
            Assert.Throws<ArgumentException>(() => finder.GetMate(CreateAlignment(2500, 2500, ""))); // empty name
            Assert.Throws<ArgumentException>(() => finder.GetMate(CreateAlignment(2500, -1, null))); // invalid mate position


        }
Ejemplo n.º 2
0
        private static void RunMemoryTests()
        {
            var reads = new ReadTests();

            reads.TestSynchronousRead(ReadTestSize);
            Console.WriteLine();
            Console.WriteLine("------------------------");
            Console.WriteLine();

            reads.TestAsynchronousRead(ReadTestSize).Wait();
        }