libStatGen Software  1
TestPileup.cpp
00001 /*
00002  *  Copyright (C) 2011  Regents of the University of Michigan
00003  *
00004  *   This program is free software: you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as published by
00006  *   the Free Software Foundation, either version 3 of the License, or
00007  *   (at your option) any later version.
00008  *
00009  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU General Public License
00015  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 #include "TestPileup.h"
00018 
00019 void testPileup()
00020 {
00021     TestPileup pileupTest;
00022     pileupTest.testPileupPosition();
00023 }
00024 
00025 void TestPileupElement::analyze()
00026 {
00027     assert(strcmp(getChromosome(), "") == 0);
00028     assert(getRefPosition() == 14000);
00029 }
00030 
00031 
00032 void TestPileup::testPileupPosition()
00033 {
00034     assert(pileupPosition(14000) == 0);
00035     assert(pileupHead == 14000);
00036     assert(pileupStart == 14000);
00037     assert(pileupTail == 14000);
00038 
00039     bool caught = false;
00040     try
00041     {
00042         pileupPosition(13999);
00043     }
00044     catch(std::exception& e)
00045     {
00046         caught = true;
00047         assert(strcmp(e.what(), "Overflow on the pileup buffer: specifiedPosition = 13999, pileup buffer start position: 14000, pileup buffer end position: 15024") == 0);
00048     }
00049     assert(caught);
00050 
00051     caught = false;
00052     try
00053     {
00054         pileupPosition(15025);
00055     }
00056     catch(std::exception& e)
00057     {
00058         caught = true;
00059         assert(strcmp(e.what(), "Overflow on the pileup buffer: specifiedPosition = 15025, pileup buffer start position: 14000, pileup buffer end position: 15024") == 0);
00060     }
00061     assert(caught);
00062 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends