1 /*
2 * Copyright (C) 2011 Regents of the University of Michigan
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17 #include "TestPileup.h"
18
testPileup()19 void testPileup()
20 {
21 TestPileup pileupTest;
22 pileupTest.testPileupPosition();
23 }
24
analyze()25 void TestPileupElement::analyze()
26 {
27 assert(strcmp(getChromosome(), "") == 0);
28 assert(getRefPosition() == 14000);
29 }
30
31
testPileupPosition()32 void TestPileup::testPileupPosition()
33 {
34 assert(pileupPosition(14000) == 0);
35 assert(pileupHead == 14000);
36 assert(pileupStart == 14000);
37 assert(pileupTail == 14000);
38
39 bool caught = false;
40 try
41 {
42 pileupPosition(13999);
43 }
44 catch(std::exception& e)
45 {
46 caught = true;
47 assert(strcmp(e.what(), "Overflow on the pileup buffer: specifiedPosition = 13999, pileup buffer start position: 14000, pileup buffer end position: 15024") == 0);
48 }
49 assert(caught);
50
51 caught = false;
52 try
53 {
54 pileupPosition(15025);
55 }
56 catch(std::exception& e)
57 {
58 caught = true;
59 assert(strcmp(e.what(), "Overflow on the pileup buffer: specifiedPosition = 15025, pileup buffer start position: 14000, pileup buffer end position: 15024") == 0);
60 }
61 assert(caught);
62 }
63