libStatGen Software  1
CigarRollerTest.cpp
00001 /*
00002  *  Copyright (C) 2010  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 
00018 
00019 // put TEST below here, so that makedepend will see the .h, so that we
00020 // can get a clean dependency for SmithWaterman.o, so that we can at least
00021 // compile the header when we change it.
00022 
00023 
00024 #include <getopt.h>
00025 #include "Generic.h"
00026 #include "CigarRollerTest.h"
00027 
00028 //
00029 // Test the obvious cases.
00030 // Add non-obvious ones as bugs come up.
00031 //
00032 int CigarRollerTest::test(void)
00033 {
00034     int failures = 0, testNum = 0;
00035     Cigar::CigarOperator op;
00036 
00037     //   const char *str;
00038     ////////////////////////////////////
00039     // Test foundInReference static methods.
00040     check(failures, ++testNum, "foundInReference(none)", false,
00041           Cigar::foundInReference(Cigar::none));
00042     check(failures, ++testNum, "foundInReference(match)", true, 
00043           Cigar::foundInReference(Cigar::match));
00044     check(failures, ++testNum, "foundInReference(mismatch)", true, 
00045           Cigar::foundInReference(Cigar::mismatch));
00046     check(failures, ++testNum, "foundInReference(insert)", false, 
00047           Cigar::foundInReference(Cigar::insert));
00048     check(failures, ++testNum, "foundInReference(del)", true, 
00049           Cigar::foundInReference(Cigar::del));
00050     check(failures, ++testNum, "foundInReference(skip)", true, 
00051           Cigar::foundInReference(Cigar::skip));
00052     check(failures, ++testNum, "foundInReference(softClip)", false, 
00053           Cigar::foundInReference(Cigar::softClip));
00054     check(failures, ++testNum, "foundInReference(hardClip)", false, 
00055           Cigar::foundInReference(Cigar::hardClip));
00056     check(failures, ++testNum, "foundInReference(pad)", false, 
00057           Cigar::foundInReference(Cigar::pad));
00058 
00059     check(failures, ++testNum, 
00060           "foundInReference('?')", false, Cigar::foundInReference('?'));
00061     check(failures, ++testNum, 
00062           "foundInReference('z')", false, Cigar::foundInReference('z'));
00063     check(failures, ++testNum, 
00064           "foundInReference('M')", true, Cigar::foundInReference('M'));
00065     check(failures, ++testNum, 
00066           "foundInReference('X')", true, Cigar::foundInReference('X'));
00067     check(failures, ++testNum, 
00068           "foundInReference('=')", true, Cigar::foundInReference('='));
00069     check(failures, ++testNum, 
00070           "foundInReference('I')", false, Cigar::foundInReference('I'));
00071     check(failures, ++testNum, 
00072           "foundInReference('D')", true, Cigar::foundInReference('D'));
00073     check(failures, ++testNum, 
00074           "foundInReference('N')", true, Cigar::foundInReference('N'));
00075     check(failures, ++testNum, 
00076           "foundInReference('S')", false, Cigar::foundInReference('S'));
00077     check(failures, ++testNum, 
00078           "foundInReference('H')", false, Cigar::foundInReference('H'));
00079     check(failures, ++testNum, 
00080           "foundInReference('P')", false, Cigar::foundInReference('P'));
00081 
00082     op.count = 3;
00083     op.operation = Cigar::none;
00084     check(failures, ++testNum, "foundInReference(none)", false,
00085           Cigar::foundInReference(op));
00086     op.operation = Cigar::match;
00087     check(failures, ++testNum, "foundInReference(match)", true,
00088           Cigar::foundInReference(op));
00089     op.operation = Cigar::mismatch;
00090     check(failures, ++testNum, "foundInReference(mismatch)", true,
00091           Cigar::foundInReference(op));
00092     op.operation = Cigar::insert;
00093     check(failures, ++testNum, "foundInReference(insert)", false,
00094           Cigar::foundInReference(op));
00095     op.operation = Cigar::del;
00096     check(failures, ++testNum, "foundInReference(del)", true,
00097           Cigar::foundInReference(op));
00098     op.operation = Cigar::skip;
00099     check(failures, ++testNum, "foundInReference(skip)", true,
00100           Cigar::foundInReference(op));
00101     op.operation = Cigar::softClip;
00102     check(failures, ++testNum, "foundInReference(softClip)", false,
00103           Cigar::foundInReference(op));
00104     op.operation = Cigar::hardClip;
00105     check(failures, ++testNum, "foundInReference(hardClip)", false,
00106           Cigar::foundInReference(op));
00107     op.operation = Cigar::pad;
00108     check(failures, ++testNum, "foundInReference(pad)", false,
00109           Cigar::foundInReference(op));
00110 
00111     ////////////////////////////////////
00112     // Test foundInQuery static methods.
00113     check(failures, ++testNum, "foundInQuery(none)", false,
00114           Cigar::foundInQuery(Cigar::none));
00115     check(failures, ++testNum, "foundInQuery(match)", true, 
00116           Cigar::foundInQuery(Cigar::match));
00117     check(failures, ++testNum, "foundInQuery(mismatch)", true, 
00118           Cigar::foundInQuery(Cigar::mismatch));
00119     check(failures, ++testNum, "foundInQuery(insert)", true, 
00120           Cigar::foundInQuery(Cigar::insert));
00121     check(failures, ++testNum, "foundInQuery(del)", false, 
00122           Cigar::foundInQuery(Cigar::del));
00123     check(failures, ++testNum, "foundInQuery(skip)", false, 
00124           Cigar::foundInQuery(Cigar::skip));
00125     check(failures, ++testNum, "foundInQuery(softClip)", true, 
00126           Cigar::foundInQuery(Cigar::softClip));
00127     check(failures, ++testNum, "foundInQuery(hardClip)", false, 
00128           Cigar::foundInQuery(Cigar::hardClip));
00129     check(failures, ++testNum, "foundInQuery(pad)", false, 
00130           Cigar::foundInQuery(Cigar::pad));
00131 
00132     check(failures, ++testNum, 
00133           "foundInQuery('?')", false, Cigar::foundInQuery('?'));
00134     check(failures, ++testNum, 
00135           "foundInQuery('z')", false, Cigar::foundInQuery('z'));
00136     check(failures, ++testNum, 
00137           "foundInQuery('M')", true, Cigar::foundInQuery('M'));
00138     check(failures, ++testNum, 
00139           "foundInQuery('X')", true, Cigar::foundInQuery('X'));
00140     check(failures, ++testNum, 
00141           "foundInQuery('=')", true, Cigar::foundInQuery('='));
00142     check(failures, ++testNum, 
00143           "foundInQuery('I')", true, Cigar::foundInQuery('I'));
00144     check(failures, ++testNum, 
00145           "foundInQuery('D')", false, Cigar::foundInQuery('D'));
00146     check(failures, ++testNum, 
00147           "foundInQuery('N')", false, Cigar::foundInQuery('N'));
00148     check(failures, ++testNum, 
00149           "foundInQuery('S')", true, Cigar::foundInQuery('S'));
00150     check(failures, ++testNum, 
00151           "foundInQuery('H')", false, Cigar::foundInQuery('H'));
00152     check(failures, ++testNum, 
00153           "foundInQuery('P')", false, Cigar::foundInQuery('P'));
00154 
00155     op.count = 3;
00156     op.operation = Cigar::none;
00157     check(failures, ++testNum, "foundInQuery(none)", false,
00158           Cigar::foundInQuery(op));
00159     op.operation = Cigar::match;
00160     check(failures, ++testNum, "foundInQuery(match)", true,
00161           Cigar::foundInQuery(op));
00162     op.operation = Cigar::mismatch;
00163     check(failures, ++testNum, "foundInQuery(mismatch)", true,
00164           Cigar::foundInQuery(op));
00165     op.operation = Cigar::insert;
00166     check(failures, ++testNum, "foundInQuery(insert)", true,
00167           Cigar::foundInQuery(op));
00168     op.operation = Cigar::del;
00169     check(failures, ++testNum, "foundInQuery(del)", false,
00170           Cigar::foundInQuery(op));
00171     op.operation = Cigar::skip;
00172     check(failures, ++testNum, "foundInQuery(skip)", false,
00173           Cigar::foundInQuery(op));
00174     op.operation = Cigar::softClip;
00175     check(failures, ++testNum, "foundInQuery(softClip)", true,
00176           Cigar::foundInQuery(op));
00177     op.operation = Cigar::hardClip;
00178     check(failures, ++testNum, "foundInQuery(hardClip)", false,
00179           Cigar::foundInQuery(op));
00180     op.operation = Cigar::pad;
00181     check(failures, ++testNum, "foundInQuery(pad)", false,
00182           Cigar::foundInQuery(op));
00183 
00184 
00185     ////////////////////////////////////
00186     // Test isClip static methods.
00187     check(failures, ++testNum, "isClip(none)", false,
00188           Cigar::isClip(Cigar::none));
00189     check(failures, ++testNum, "isClip(match)", false, 
00190           Cigar::isClip(Cigar::match));
00191     check(failures, ++testNum, "isClip(mismatch)", false, 
00192           Cigar::isClip(Cigar::mismatch));
00193     check(failures, ++testNum, "isClip(insert)", false, 
00194           Cigar::isClip(Cigar::insert));
00195     check(failures, ++testNum, "isClip(del)", false, 
00196           Cigar::isClip(Cigar::del));
00197     check(failures, ++testNum, "isClip(skip)", false, 
00198           Cigar::isClip(Cigar::skip));
00199     check(failures, ++testNum, "isClip(softClip)", true, 
00200           Cigar::isClip(Cigar::softClip));
00201     check(failures, ++testNum, "isClip(hardClip)", true, 
00202           Cigar::isClip(Cigar::hardClip));
00203     check(failures, ++testNum, "isClip(pad)", false, 
00204           Cigar::isClip(Cigar::pad));
00205 
00206     check(failures, ++testNum, 
00207           "isClip('?')", false, Cigar::isClip('?'));
00208     check(failures, ++testNum, 
00209           "isClip('z')", false, Cigar::isClip('z'));
00210     check(failures, ++testNum, 
00211           "isClip('M')", false, Cigar::isClip('M'));
00212     check(failures, ++testNum, 
00213           "isClip('X')", false, Cigar::isClip('X'));
00214     check(failures, ++testNum, 
00215           "isClip('=')", false, Cigar::isClip('='));
00216     check(failures, ++testNum, 
00217           "isClip('I')", false, Cigar::isClip('I'));
00218     check(failures, ++testNum, 
00219           "isClip('D')", false, Cigar::isClip('D'));
00220     check(failures, ++testNum, 
00221           "isClip('N')", false, Cigar::isClip('N'));
00222     check(failures, ++testNum, 
00223           "isClip('S')", true, Cigar::isClip('S'));
00224     check(failures, ++testNum, 
00225           "isClip('H')", true, Cigar::isClip('H'));
00226     check(failures, ++testNum, 
00227           "isClip('P')", false, Cigar::isClip('P'));
00228 
00229     op.count = 3;
00230     op.operation = Cigar::none;
00231     check(failures, ++testNum, "isClip(none)", false,
00232           Cigar::isClip(op));
00233     op.operation = Cigar::match;
00234     check(failures, ++testNum, "isClip(match)", false,
00235           Cigar::isClip(op));
00236     op.operation = Cigar::mismatch;
00237     check(failures, ++testNum, "isClip(mismatch)", false,
00238           Cigar::isClip(op));
00239     op.operation = Cigar::insert;
00240     check(failures, ++testNum, "isClip(insert)", false,
00241           Cigar::isClip(op));
00242     op.operation = Cigar::del;
00243     check(failures, ++testNum, "isClip(del)", false,
00244           Cigar::isClip(op));
00245     op.operation = Cigar::skip;
00246     check(failures, ++testNum, "isClip(skip)", false,
00247           Cigar::isClip(op));
00248     op.operation = Cigar::softClip;
00249     check(failures, ++testNum, "isClip(softClip)", true,
00250           Cigar::isClip(op));
00251     op.operation = Cigar::hardClip;
00252     check(failures, ++testNum, "isClip(hardClip)", true,
00253           Cigar::isClip(op));
00254     op.operation = Cigar::pad;
00255     check(failures, ++testNum, "isClip(pad)", false,
00256           Cigar::isClip(op));
00257 
00258 
00259 
00260 
00261 
00262 
00263     ///////////////////////////////
00264 
00265     // Create the CigarRoller.
00266     CigarRoller cigar;
00267 
00268     //   const char *str;
00269     String str;
00270     std::string result;
00271     
00272     cigar.getCigarString(str);
00273     result = str.c_str();
00274     //    result = str = cigar.getString(); delete str;
00275 
00276     check(failures, ++testNum, "constructor", result, "");    // test empty case
00277 
00278     op.operation = CigarRoller::match;
00279     op.count = 10;
00280 
00281     cigar += op;
00282 
00283     op.count=5;
00284 
00285     cigar += op;
00286 
00287     op.count=5; op.operation = CigarRoller::mismatch;   // test that match/mismatch get combined
00288 
00289     cigar += op;
00290 
00291     op.count=5; op.operation = CigarRoller::insert;
00292 
00293     cigar += op;
00294 
00295     op.count=5; op.operation = CigarRoller::insert;
00296 
00297     cigar += op;
00298 
00299     op.count=5; op.operation = CigarRoller::del;
00300 
00301     cigar += op;
00302 
00303     op.count=5; op.operation = CigarRoller::mismatch;
00304 
00305     cigar += op;
00306 
00307     op.count=5; op.operation = CigarRoller::match;
00308 
00309     cigar += op;
00310 
00311     op.count=5; op.operation = CigarRoller::skip;
00312 
00313     cigar += op;
00314 
00315     op.count=5; op.operation = CigarRoller::match;
00316 
00317     cigar += op;
00318 
00319     op.count=2; op.operation = CigarRoller::pad;
00320 
00321     cigar += op;
00322 
00323     op.count=3; op.operation = CigarRoller::match;
00324 
00325     cigar += op;
00326 
00327     cigar.getCigarString(str);
00328     result = str.c_str();
00329     //    result = str = cigar.getString();  delete str;
00330 
00331     check(failures, ++testNum, "match combining", "20M10I5D10M5N5M2P3M", result);
00332     check(failures, ++testNum, "length check", 8, cigar.size());
00333 
00334     //////////////////////////////////////////////////////////////////////////////////////////////////////////
00335     // Test getRefOffset, getQueryIndex, getRefPosition, & getQueryIndex(that takes ref position)
00336 
00337     // Validate the reference offsets when passing in a query index,
00338     // and the query offsets when passing in a query index.
00339     // Spot check the offsets out of order - to verify order doesn't matter.
00340     check(failures, ++testNum, "getRefOffset(20)", -1, cigar.getRefOffset(20));
00341     check(failures, ++testNum, "getRefOffset(30)", 25, cigar.getRefOffset(30));
00342     check(failures, ++testNum, "getRefOffset(46)", 46, cigar.getRefOffset(46));
00343     check(failures, ++testNum, "getRefOffset(0)", 0, cigar.getRefOffset(0));
00344     check(failures, ++testNum, "getRefPosition(20, 5)", -1, cigar.getRefPosition(20, 5));
00345     check(failures, ++testNum, "getRefPosition(30, 5)", 30, cigar.getRefPosition(30, 5));
00346     check(failures, ++testNum, "getRefPosition(46, 5)", 51, cigar.getRefPosition(46, 5));
00347     check(failures, ++testNum, "getRefPosition(0, 5)", 5, cigar.getRefPosition(0, 5));
00348     check(failures, ++testNum, "getQueryIndex(20)", CigarRoller::INDEX_NA, cigar.getQueryIndex(20));
00349     check(failures, ++testNum, "getQueryIndex(30)", 35, cigar.getQueryIndex(30));
00350     check(failures, ++testNum, "getQueryIndex(35)", Cigar::INDEX_NA, cigar.getQueryIndex(35));
00351     check(failures, ++testNum, "getQueryIndex(46)", 46, cigar.getQueryIndex(46));
00352     check(failures, ++testNum, "getQueryIndex(0)", 0, cigar.getQueryIndex(0));
00353     check(failures, ++testNum, "getQueryIndex(25, 5)", -1, cigar.getQueryIndex(20));
00354     check(failures, ++testNum, "getQueryIndex(35, 5)", 35, cigar.getQueryIndex(30));
00355     check(failures, ++testNum, "getQueryIndex(40, 5)", -1, cigar.getQueryIndex(35));
00356     check(failures, ++testNum, "getQueryIndex(51, 5)", 46, cigar.getQueryIndex(46));
00357     check(failures, ++testNum, "getQueryIndex(5, 5)", 0, cigar.getQueryIndex(0));
00358 
00359     int i = 0;
00360     int queryIndex = 0;
00361     int refOffset = 0;
00362     // Validate the 20 matches.
00363     for(i = 0; i < 20; i++)
00364     {
00365         check(failures, ++testNum, "getRefOffset(queryIndex)", refOffset, cigar.getRefOffset(queryIndex));
00366         check(failures, ++testNum, "getQueryIndex(refOffset)", queryIndex, cigar.getQueryIndex(refOffset));
00367         check(failures, ++testNum, "getRefPosition(queryIndex, 5)", refOffset + 5, cigar.getRefPosition(queryIndex, 5));
00368         check(failures, ++testNum, "getQueryIndex(refPosition, 5)", queryIndex, cigar.getQueryIndex(refOffset + 5, 5));
00369         ++queryIndex;
00370         ++refOffset;
00371     }
00372     // Validate the 10 Inserts - exist in query, but not in the reference.
00373     for(i = 0; i < 10; i++)
00374     {
00375         check(failures, ++testNum, "getRefOffset(queryIndex)", -1, cigar.getRefOffset(queryIndex));
00376         check(failures, ++testNum, "getRefPosition(queryIndex, 5)", -1, cigar.getRefPosition(queryIndex, 5));
00377         ++queryIndex;
00378     }
00379     // Validate the 5 Deletions - exist in the reference, but not the query.
00380     for(i = 0; i < 5; i++)
00381     {
00382         check(failures, ++testNum, "getQueryIndex(refOffset)", -1, cigar.getQueryIndex(refOffset));
00383         check(failures, ++testNum, "getQueryIndex(refPosition, 5)", -1, cigar.getQueryIndex(refOffset + 5, 5));
00384         refOffset++;
00385     }
00386     // Validate the 10 matches.
00387     for(i = 0; i < 10; i++)
00388     {
00389         check(failures, ++testNum, "getRefOffset(queryIndex)", refOffset, cigar.getRefOffset(queryIndex));
00390         check(failures, ++testNum, "getQueryIndex(refOffset)", queryIndex, cigar.getQueryIndex(refOffset));
00391         check(failures, ++testNum, "getRefPosition(queryIndex, 5)", refOffset + 5, cigar.getRefPosition(queryIndex, 5));
00392         check(failures, ++testNum, "getQueryIndex(refPosition, 5)", queryIndex, cigar.getQueryIndex(refOffset + 5, 5));
00393         ++queryIndex;
00394         ++refOffset;
00395     }
00396     // Validate the 5 Skips - exist in the reference, but not the query.
00397     for(i = 0; i < 5; i++)
00398     {
00399         check(failures, ++testNum, "getQueryIndex(refOffset)", -1, cigar.getQueryIndex(refOffset));
00400         check(failures, ++testNum, "getQueryIndex(refPosition, 5)", -1, cigar.getQueryIndex(refOffset + 5, 5));
00401         refOffset++;
00402     }
00403     // Validate the 5 matches.
00404     for(i = 0; i < 5; i++)
00405     {
00406         check(failures, ++testNum, "getRefOffset(queryIndex)", refOffset, cigar.getRefOffset(queryIndex));
00407         check(failures, ++testNum, "getQueryIndex(refOffset)", queryIndex, cigar.getQueryIndex(refOffset));
00408         check(failures, ++testNum, "getRefPosition(queryIndex, 5)", refOffset + 5, cigar.getRefPosition(queryIndex, 5));
00409         check(failures, ++testNum, "getQueryIndex(refPosition, 5)", queryIndex, cigar.getQueryIndex(refOffset + 5, 5));
00410         ++queryIndex;
00411         ++refOffset;
00412     }
00413     // Nothing to validate for the 2 pads since they do not show up in either the reference or the query.
00414     // Validate the 3 matches.
00415     for(i = 0; i < 3; i++)
00416     {
00417         check(failures, ++testNum, "getRefOffset(queryIndex)", refOffset, cigar.getRefOffset(queryIndex));
00418         check(failures, ++testNum, "getQueryIndex(refOffset)", queryIndex, cigar.getQueryIndex(refOffset));
00419         check(failures, ++testNum, "getRefPosition(queryIndex, 5)", refOffset + 5, cigar.getRefPosition(queryIndex, 5));
00420         check(failures, ++testNum, "getQueryIndex(refPosition, 5)", queryIndex, cigar.getQueryIndex(refOffset + 5, 5));
00421         ++queryIndex;
00422         ++refOffset;
00423     }
00424 
00425     // Validate that if you go beyond the end, -1 is returned.
00426     check(failures, ++testNum, "getRefOffset(queryIndex)", -1, cigar.getRefOffset(queryIndex));
00427     check(failures, ++testNum, "getQueryIndex(refOffset)", -1, cigar.getQueryIndex(refOffset));
00428     check(failures, ++testNum, "getRefPosition(queryIndex, 5)", -1, cigar.getRefPosition(queryIndex, 5));
00429     check(failures, ++testNum, "getQueryIndex(refPosition, 5)", -1, cigar.getQueryIndex(refOffset + 5, 5));
00430     ++queryIndex;
00431     ++refOffset;
00432     check(failures, ++testNum, "getRefOffset(queryIndex)", -1, cigar.getRefOffset(queryIndex));
00433     check(failures, ++testNum, "getQueryIndex(refOffset)", -1, cigar.getQueryIndex(refOffset));
00434     check(failures, ++testNum, "getRefPosition(queryIndex, 5)", -1, cigar.getRefPosition(queryIndex, 5));
00435     check(failures, ++testNum, "getQueryIndex(refPosition, 5)", -1, cigar.getQueryIndex(refOffset + 5, 5));
00436 
00437     ////////////////////////////////////////////////////////////////////////
00438     // Test getNumOverlaps
00439     
00440     // When query starts at position 5:
00441     // Overlaps are at 5-24, 30-39, 45-49, 50-52
00442 
00443     // Test with region [1-5) where query starts at position 5 = 0 overlaps.
00444     check(failures, ++testNum, "getNumOverlaps(1, 5, 5)", (uint32_t)0, cigar.getNumOverlaps(1, 5, 5));
00445 
00446     // Test with region [53-101) where query starts at position 5 = 0 overlaps.
00447     check(failures, ++testNum, "getNumOverlaps(53, 101, 5)", (uint32_t)0, cigar.getNumOverlaps(53, 101, 5));
00448 
00449     // Test with region [53-10) where query starts at position 5 = 0 overlaps.
00450     check(failures, ++testNum, "getNumOverlaps(53, 10, 5)", (uint32_t)0, cigar.getNumOverlaps(53, 10, 5));
00451 
00452     // Test with region [35-10) where query starts at position 5 = 0 overlaps.
00453     check(failures, ++testNum, "getNumOverlaps(35, 10, 5)", (uint32_t)0, cigar.getNumOverlaps(35, 10, 5));
00454 
00455     // Test with region [35-1) where query starts at position 5 = 0 overlaps.
00456     check(failures, ++testNum, "getNumOverlaps(35, 1, 5)", (uint32_t)0, cigar.getNumOverlaps(35, 1, 5));
00457 
00458     // Test with region [1-6) where query starts at position 5 - 1 overlap = pos 5.
00459     check(failures, ++testNum, "getNumOverlaps(1, 6, 5)", (uint32_t)1, cigar.getNumOverlaps(1, 6, 5));
00460 
00461     // Test with region [25-30) where query has only DELETIONS from the reference = 0 overlaps.
00462     check(failures, ++testNum, "getNumOverlaps(25, 30, 5)", (uint32_t)0, cigar.getNumOverlaps(25, 30, 5));
00463 
00464     // Test with region [24-30) where query has only a match at position 24 = 1 overlap.
00465     check(failures, ++testNum, "getNumOverlaps(24, 30, 5)", (uint32_t)1, cigar.getNumOverlaps(24, 30, 5));
00466 
00467     // Test with region [25-31) where query has only a match at position 30 = 1 overlap.
00468     check(failures, ++testNum, "getNumOverlaps(25, 31, 5)", (uint32_t)1, cigar.getNumOverlaps(25, 31, 5));
00469 
00470     // Test with region [1-31), match pos 5-24 & 30 = 21 overlaps
00471     check(failures, ++testNum, "getNumOverlaps(1, 31, 5)", (uint32_t)21, cigar.getNumOverlaps(1, 31, 5));
00472 
00473     // Test a region that covers the entire range [1-101), match pos 5-24, 30-39, 45-49, & 50-52 = 38 overlaps
00474     check(failures, ++testNum, "getNumOverlaps(1, 101, 5)", (uint32_t)38, cigar.getNumOverlaps(1, 101, 5));
00475 
00476     // Test a region that covers the entire range [-1--1), (whole region) match pos 5-24, 30-39, 45-49, & 50-52 = 38 overlaps
00477     check(failures, ++testNum, "getNumOverlaps(-1, -1, 5)", (uint32_t)38, cigar.getNumOverlaps(-1, -1, 5));
00478 
00479     // Test a region that covers the entire range [6-52), match pos 6-24, 30-39, 45-49, & 50-51 = 36 overlaps
00480     check(failures, ++testNum, "getNumOverlaps(6, 52, 5)", (uint32_t)36, cigar.getNumOverlaps(6, 52, 5));
00481 
00482     // Test with region [40-45) where query has only SKIPS from the reference = 0 overlaps.
00483     check(failures, ++testNum, "getNumOverlaps(40, 45, 5)", (uint32_t)0, cigar.getNumOverlaps(40, 45, 5));
00484 
00485     // Test a region that covers the range [-1-10), (whole region) match pos 5-9 = 5 overlaps
00486     check(failures, ++testNum, "getNumOverlaps(-1, 10, 5)", (uint32_t)5, cigar.getNumOverlaps(-1, 10, 5));
00487 
00488     // Test a region that covers the range [50--1), (whole region) match pos 50-52 = 3 overlaps
00489     check(failures, ++testNum, "getNumOverlaps(50, -1, 5)", (uint32_t)3, cigar.getNumOverlaps(50, -1, 5));
00490 
00491     ////////////////////////////////////////////////////////////////////////////
00492     // Test a new CIGAR.
00493     cigar.Set("4M10N4M3I2M4D3M");
00494     String expectedResult = "4M10N4M3I2M4D3M";
00495     String cigarString = "HI";
00496     cigar.getCigarString(cigarString);
00497     check(failures, ++testNum, "getCigarString", expectedResult, cigarString);
00498 
00499     // 4M10N4M3I2M4D3M
00500     //                     11111111112222222222
00501     // ExtIndex: 012345678901234567890123456789
00502     // ExtCigar: MMMMNNNNNNNNNNMMMMIIIMMDDDDMMM
00503     //                               111    111
00504     // QueryIndx:0123          456789012    345
00505     //                     11111111   112222222
00506     // RefOffset:012345678901234567   890123456
00507     //                1111111111222   222222233
00508     // RefPos:   567890123456789012   345678901
00509 
00510     // Test getExpandedCigarIndex & getCigar op
00511     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(0, 5)", -1, cigar.getExpandedCigarIndexFromRefPos(0,5));
00512     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(1, 5)", -1, cigar.getExpandedCigarIndexFromRefPos(1,5));
00513     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(2, 5)", -1, cigar.getExpandedCigarIndexFromRefPos(2,5));
00514     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(3, 5)", -1, cigar.getExpandedCigarIndexFromRefPos(3,5));
00515     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(4, 5)", -1, cigar.getExpandedCigarIndexFromRefPos(4,5));
00516     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(5, 5)", 0, cigar.getExpandedCigarIndexFromRefPos(5,5));
00517     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(6, 5)", 1, cigar.getExpandedCigarIndexFromRefPos(6,5));
00518     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(7, 5)", 2, cigar.getExpandedCigarIndexFromRefPos(7,5));
00519     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(8, 5)", 3, cigar.getExpandedCigarIndexFromRefPos(8,5));
00520     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(9, 5)", 4, cigar.getExpandedCigarIndexFromRefPos(9,5));
00521     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(10, 5)", 5, cigar.getExpandedCigarIndexFromRefPos(10,5));
00522     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(11, 5)", 6, cigar.getExpandedCigarIndexFromRefPos(11,5));
00523     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(12, 5)", 7, cigar.getExpandedCigarIndexFromRefPos(12,5));
00524     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(13, 5)", 8, cigar.getExpandedCigarIndexFromRefPos(13,5));
00525     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(14, 5)", 9, cigar.getExpandedCigarIndexFromRefPos(14,5));
00526     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(15, 5)", 10, cigar.getExpandedCigarIndexFromRefPos(15,5));
00527     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(16, 5)", 11, cigar.getExpandedCigarIndexFromRefPos(16,5));
00528     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(17, 5)", 12, cigar.getExpandedCigarIndexFromRefPos(17,5));
00529     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(18, 5)", 13, cigar.getExpandedCigarIndexFromRefPos(18,5));
00530     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(19, 5)", 14, cigar.getExpandedCigarIndexFromRefPos(19,5));
00531     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(20, 5)", 15, cigar.getExpandedCigarIndexFromRefPos(20,5));
00532     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(21, 5)", 16, cigar.getExpandedCigarIndexFromRefPos(21,5));
00533     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(22, 5)", 17, cigar.getExpandedCigarIndexFromRefPos(22,5));
00534     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(23, 5)", 21, cigar.getExpandedCigarIndexFromRefPos(23,5));
00535     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(24, 5)", 22, cigar.getExpandedCigarIndexFromRefPos(24,5));
00536     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(25, 5)", 23, cigar.getExpandedCigarIndexFromRefPos(25,5));
00537     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(26, 5)", 24, cigar.getExpandedCigarIndexFromRefPos(26,5));
00538     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(27, 5)", 25, cigar.getExpandedCigarIndexFromRefPos(27,5));
00539     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(28, 5)", 26, cigar.getExpandedCigarIndexFromRefPos(28,5));
00540     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(29, 5)", 27, cigar.getExpandedCigarIndexFromRefPos(29,5));
00541     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(30, 5)", 28, cigar.getExpandedCigarIndexFromRefPos(30,5));
00542     check(failures, ++testNum, "getExpandedCigarIndexFromRefPos(31, 5)", 29, cigar.getExpandedCigarIndexFromRefPos(31,5));
00543 
00544     // 
00545     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(0)", 0, cigar.getExpandedCigarIndexFromRefOffset(0));
00546     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(1)", 1, cigar.getExpandedCigarIndexFromRefOffset(1));
00547     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(2)", 2, cigar.getExpandedCigarIndexFromRefOffset(2));
00548     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(3)", 3, cigar.getExpandedCigarIndexFromRefOffset(3));
00549     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(4)", 4, cigar.getExpandedCigarIndexFromRefOffset(4));
00550     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(5)", 5, cigar.getExpandedCigarIndexFromRefOffset(5));
00551     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(6)", 6, cigar.getExpandedCigarIndexFromRefOffset(6));
00552     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(7)", 7, cigar.getExpandedCigarIndexFromRefOffset(7));
00553     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(8)", 8, cigar.getExpandedCigarIndexFromRefOffset(8));
00554     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(9)", 9, cigar.getExpandedCigarIndexFromRefOffset(9));
00555     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(10)", 10, cigar.getExpandedCigarIndexFromRefOffset(10));
00556     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(11)", 11, cigar.getExpandedCigarIndexFromRefOffset(11));
00557     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(12)", 12, cigar.getExpandedCigarIndexFromRefOffset(12));
00558     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(13)", 13, cigar.getExpandedCigarIndexFromRefOffset(13));
00559     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(14)", 14, cigar.getExpandedCigarIndexFromRefOffset(14));
00560     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(15)", 15, cigar.getExpandedCigarIndexFromRefOffset(15));
00561     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(16)", 16, cigar.getExpandedCigarIndexFromRefOffset(16));
00562     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(17)", 17, cigar.getExpandedCigarIndexFromRefOffset(17));
00563     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(18)", 21, cigar.getExpandedCigarIndexFromRefOffset(18));
00564     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(19)", 22, cigar.getExpandedCigarIndexFromRefOffset(19));
00565     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(20)", 23, cigar.getExpandedCigarIndexFromRefOffset(20));
00566     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(21)", 24, cigar.getExpandedCigarIndexFromRefOffset(21));
00567     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(22)", 25, cigar.getExpandedCigarIndexFromRefOffset(22));
00568     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(23)", 26, cigar.getExpandedCigarIndexFromRefOffset(23));
00569     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(24)", 27, cigar.getExpandedCigarIndexFromRefOffset(24));
00570     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(25)", 28, cigar.getExpandedCigarIndexFromRefOffset(25));
00571     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(26)", 29, cigar.getExpandedCigarIndexFromRefOffset(26));
00572     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(27)", -1, cigar.getExpandedCigarIndexFromRefOffset(27));
00573     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(28)", -1, cigar.getExpandedCigarIndexFromRefOffset(28));
00574     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(29)", -1, cigar.getExpandedCigarIndexFromRefOffset(29));
00575     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(30)", -1, cigar.getExpandedCigarIndexFromRefOffset(30));
00576     check(failures, ++testNum, "getExpandedCigarIndexFromRefOffset(31)", -1, cigar.getExpandedCigarIndexFromRefOffset(31));
00577 
00578     // 
00579     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(0)", 0, cigar.getExpandedCigarIndexFromQueryIndex(0));
00580     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(1)", 1, cigar.getExpandedCigarIndexFromQueryIndex(1));
00581     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(2)", 2, cigar.getExpandedCigarIndexFromQueryIndex(2));
00582     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(3)", 3, cigar.getExpandedCigarIndexFromQueryIndex(3));
00583     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(4)", 14, cigar.getExpandedCigarIndexFromQueryIndex(4));
00584     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(5)", 15, cigar.getExpandedCigarIndexFromQueryIndex(5));
00585     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(6)", 16, cigar.getExpandedCigarIndexFromQueryIndex(6));
00586     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(7)", 17, cigar.getExpandedCigarIndexFromQueryIndex(7));
00587     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(8)", 18, cigar.getExpandedCigarIndexFromQueryIndex(8));
00588     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(9)", 19, cigar.getExpandedCigarIndexFromQueryIndex(9));
00589     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(10)", 20, cigar.getExpandedCigarIndexFromQueryIndex(10));
00590     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(11)", 21, cigar.getExpandedCigarIndexFromQueryIndex(11));
00591     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(12)", 22, cigar.getExpandedCigarIndexFromQueryIndex(12));
00592     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(13)", 27, cigar.getExpandedCigarIndexFromQueryIndex(13));
00593     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(14)", 28, cigar.getExpandedCigarIndexFromQueryIndex(14));
00594     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(15)", 29, cigar.getExpandedCigarIndexFromQueryIndex(15));
00595     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(16)", -1, cigar.getExpandedCigarIndexFromQueryIndex(16));
00596     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(17)", -1, cigar.getExpandedCigarIndexFromQueryIndex(17));
00597     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(18)", -1, cigar.getExpandedCigarIndexFromQueryIndex(18));
00598     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(19)", -1, cigar.getExpandedCigarIndexFromQueryIndex(19));
00599     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(20)", -1, cigar.getExpandedCigarIndexFromQueryIndex(20));
00600     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(21)", -1, cigar.getExpandedCigarIndexFromQueryIndex(21));
00601     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(22)", -1, cigar.getExpandedCigarIndexFromQueryIndex(22));
00602     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(23)", -1, cigar.getExpandedCigarIndexFromQueryIndex(23));
00603     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(24)", -1, cigar.getExpandedCigarIndexFromQueryIndex(24));
00604     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(25)", -1, cigar.getExpandedCigarIndexFromQueryIndex(25));
00605     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(26)", -1, cigar.getExpandedCigarIndexFromQueryIndex(26));
00606     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(27)", -1, cigar.getExpandedCigarIndexFromQueryIndex(27));
00607     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(28)", -1, cigar.getExpandedCigarIndexFromQueryIndex(28));
00608     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(29)", -1, cigar.getExpandedCigarIndexFromQueryIndex(29));
00609     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(30)", -1, cigar.getExpandedCigarIndexFromQueryIndex(30));
00610     check(failures, ++testNum, "getExpandedCigarIndexFromQueryIndex(31)", -1, cigar.getExpandedCigarIndexFromQueryIndex(31));
00611 
00612     // Test getCigarCharOp.
00613     check(failures, ++testNum, "getCigarCharOp(-1)", '?', cigar.getCigarCharOp(-1));
00614     check(failures, ++testNum, "getCigarCharOp(0)", 'M', cigar.getCigarCharOp(0));
00615     check(failures, ++testNum, "getCigarCharOp(1)", 'M', cigar.getCigarCharOp(1));
00616     check(failures, ++testNum, "getCigarCharOp(2)", 'M', cigar.getCigarCharOp(2));
00617     check(failures, ++testNum, "getCigarCharOp(3)", 'M', cigar.getCigarCharOp(3));
00618     check(failures, ++testNum, "getCigarCharOp(4)", 'N', cigar.getCigarCharOp(4));
00619     check(failures, ++testNum, "getCigarCharOp(5)", 'N', cigar.getCigarCharOp(5));
00620     check(failures, ++testNum, "getCigarCharOp(6)", 'N', cigar.getCigarCharOp(6));
00621     check(failures, ++testNum, "getCigarCharOp(7)", 'N', cigar.getCigarCharOp(7));
00622     check(failures, ++testNum, "getCigarCharOp(8)", 'N', cigar.getCigarCharOp(8));
00623     check(failures, ++testNum, "getCigarCharOp(9)", 'N', cigar.getCigarCharOp(9));
00624     check(failures, ++testNum, "getCigarCharOp(10)", 'N', cigar.getCigarCharOp(10));
00625     check(failures, ++testNum, "getCigarCharOp(11)", 'N', cigar.getCigarCharOp(11));
00626     check(failures, ++testNum, "getCigarCharOp(12)", 'N', cigar.getCigarCharOp(12));
00627     check(failures, ++testNum, "getCigarCharOp(13)", 'N', cigar.getCigarCharOp(13));
00628     check(failures, ++testNum, "getCigarCharOp(14)", 'M', cigar.getCigarCharOp(14));
00629     check(failures, ++testNum, "getCigarCharOp(15)", 'M', cigar.getCigarCharOp(15));
00630     check(failures, ++testNum, "getCigarCharOp(16)", 'M', cigar.getCigarCharOp(16));
00631     check(failures, ++testNum, "getCigarCharOp(17)", 'M', cigar.getCigarCharOp(17));
00632     check(failures, ++testNum, "getCigarCharOp(18)", 'I', cigar.getCigarCharOp(18));
00633     check(failures, ++testNum, "getCigarCharOp(19)", 'I', cigar.getCigarCharOp(19));
00634     check(failures, ++testNum, "getCigarCharOp(20)", 'I', cigar.getCigarCharOp(20));
00635     check(failures, ++testNum, "getCigarCharOp(21)", 'M', cigar.getCigarCharOp(21));
00636     check(failures, ++testNum, "getCigarCharOp(22)", 'M', cigar.getCigarCharOp(22));
00637     check(failures, ++testNum, "getCigarCharOp(23)", 'D', cigar.getCigarCharOp(23));
00638     check(failures, ++testNum, "getCigarCharOp(24)", 'D', cigar.getCigarCharOp(24));
00639     check(failures, ++testNum, "getCigarCharOp(25)", 'D', cigar.getCigarCharOp(25));
00640     check(failures, ++testNum, "getCigarCharOp(26)", 'D', cigar.getCigarCharOp(26));
00641     check(failures, ++testNum, "getCigarCharOp(27)", 'M', cigar.getCigarCharOp(27));
00642     check(failures, ++testNum, "getCigarCharOp(28)", 'M', cigar.getCigarCharOp(28));
00643     check(failures, ++testNum, "getCigarCharOp(29)", 'M', cigar.getCigarCharOp(29));
00644     check(failures, ++testNum, "getCigarCharOp(30)", '?', cigar.getCigarCharOp(30));
00645 
00646 
00647     // Test getCigarCharOpFromQueryIndex.
00648     check(failures, ++testNum, "getCigarCharOpFromQueryIndex(-1)", '?', cigar.getCigarCharOpFromQueryIndex(-1));
00649     check(failures, ++testNum, "getCigarCharOpFromQueryIndex(0)", 'M', cigar.getCigarCharOpFromQueryIndex(0));
00650     check(failures, ++testNum, "getCigarCharOpFromQueryIndex(1)", 'M', cigar.getCigarCharOpFromQueryIndex(1));
00651     check(failures, ++testNum, "getCigarCharOpFromQueryIndex(2)", 'M', cigar.getCigarCharOpFromQueryIndex(2));
00652     check(failures, ++testNum, "getCigarCharOpFromQueryIndex(3)", 'M', cigar.getCigarCharOpFromQueryIndex(3));
00653     check(failures, ++testNum, "getCigarCharOpFromQueryIndex(4)", 'M', cigar.getCigarCharOpFromQueryIndex(4));
00654     check(failures, ++testNum, "getCigarCharOpFromQueryIndex(5)", 'M', cigar.getCigarCharOpFromQueryIndex(5));
00655     check(failures, ++testNum, "getCigarCharOpFromQueryIndex(6)", 'M', cigar.getCigarCharOpFromQueryIndex(6));
00656     check(failures, ++testNum, "getCigarCharOpFromQueryIndex(7)", 'M', cigar.getCigarCharOpFromQueryIndex(7));
00657     check(failures, ++testNum, "getCigarCharOpFromQueryIndex(8)", 'I', cigar.getCigarCharOpFromQueryIndex(8));
00658     check(failures, ++testNum, "getCigarCharOpFromQueryIndex(9)", 'I', cigar.getCigarCharOpFromQueryIndex(9));
00659     check(failures, ++testNum, "getCigarCharOpFromQueryIndex(10)", 'I', cigar.getCigarCharOpFromQueryIndex(10));
00660     check(failures, ++testNum, "getCigarCharOpFromQueryIndex(11)", 'M', cigar.getCigarCharOpFromQueryIndex(11));
00661     check(failures, ++testNum, "getCigarCharOpFromQueryIndex(12)", 'M', cigar.getCigarCharOpFromQueryIndex(12));
00662     check(failures, ++testNum, "getCigarCharOpFromQueryIndex(13)", 'M', cigar.getCigarCharOpFromQueryIndex(13));
00663     check(failures, ++testNum, "getCigarCharOpFromQueryIndex(14)", 'M', cigar.getCigarCharOpFromQueryIndex(14));
00664     check(failures, ++testNum, "getCigarCharOpFromQueryIndex(15)", 'M', cigar.getCigarCharOpFromQueryIndex(15));
00665     check(failures, ++testNum, "getCigarCharOpFromQueryIndex(16)", '?', cigar.getCigarCharOpFromQueryIndex(16));
00666     check(failures, ++testNum, "getCigarCharOpFromQueryIndex(17)", '?', cigar.getCigarCharOpFromQueryIndex(17));
00667 
00668     // Test getCigarCharOpFromRefOffset.
00669     check(failures, ++testNum, "getCigarCharOpFromRefOffset(-1)", '?', cigar.getCigarCharOpFromRefOffset(-1));
00670     check(failures, ++testNum, "getCigarCharOpFromRefOffset(0)", 'M', cigar.getCigarCharOpFromRefOffset(0));
00671     check(failures, ++testNum, "getCigarCharOpFromRefOffset(1)", 'M', cigar.getCigarCharOpFromRefOffset(1));
00672     check(failures, ++testNum, "getCigarCharOpFromRefOffset(2)", 'M', cigar.getCigarCharOpFromRefOffset(2));
00673     check(failures, ++testNum, "getCigarCharOpFromRefOffset(3)", 'M', cigar.getCigarCharOpFromRefOffset(3));
00674     check(failures, ++testNum, "getCigarCharOpFromRefOffset(4)", 'N', cigar.getCigarCharOpFromRefOffset(4));
00675     check(failures, ++testNum, "getCigarCharOpFromRefOffset(5)", 'N', cigar.getCigarCharOpFromRefOffset(5));
00676     check(failures, ++testNum, "getCigarCharOpFromRefOffset(6)", 'N', cigar.getCigarCharOpFromRefOffset(6));
00677     check(failures, ++testNum, "getCigarCharOpFromRefOffset(7)", 'N', cigar.getCigarCharOpFromRefOffset(7));
00678     check(failures, ++testNum, "getCigarCharOpFromRefOffset(8)", 'N', cigar.getCigarCharOpFromRefOffset(8));
00679     check(failures, ++testNum, "getCigarCharOpFromRefOffset(9)", 'N', cigar.getCigarCharOpFromRefOffset(9));
00680     check(failures, ++testNum, "getCigarCharOpFromRefOffset(10)", 'N', cigar.getCigarCharOpFromRefOffset(10));
00681     check(failures, ++testNum, "getCigarCharOpFromRefOffset(11)", 'N', cigar.getCigarCharOpFromRefOffset(11));
00682     check(failures, ++testNum, "getCigarCharOpFromRefOffset(12)", 'N', cigar.getCigarCharOpFromRefOffset(12));
00683     check(failures, ++testNum, "getCigarCharOpFromRefOffset(13)", 'N', cigar.getCigarCharOpFromRefOffset(13));
00684     check(failures, ++testNum, "getCigarCharOpFromRefOffset(14)", 'M', cigar.getCigarCharOpFromRefOffset(14));
00685     check(failures, ++testNum, "getCigarCharOpFromRefOffset(15)", 'M', cigar.getCigarCharOpFromRefOffset(15));
00686     check(failures, ++testNum, "getCigarCharOpFromRefOffset(16)", 'M', cigar.getCigarCharOpFromRefOffset(16));
00687     check(failures, ++testNum, "getCigarCharOpFromRefOffset(17)", 'M', cigar.getCigarCharOpFromRefOffset(17));
00688     check(failures, ++testNum, "getCigarCharOpFromRefOffset(18)", 'M', cigar.getCigarCharOpFromRefOffset(18));
00689     check(failures, ++testNum, "getCigarCharOpFromRefOffset(19)", 'M', cigar.getCigarCharOpFromRefOffset(19));
00690     check(failures, ++testNum, "getCigarCharOpFromRefOffset(20)", 'D', cigar.getCigarCharOpFromRefOffset(20));
00691     check(failures, ++testNum, "getCigarCharOpFromRefOffset(21)", 'D', cigar.getCigarCharOpFromRefOffset(21));
00692     check(failures, ++testNum, "getCigarCharOpFromRefOffset(22)", 'D', cigar.getCigarCharOpFromRefOffset(22));
00693     check(failures, ++testNum, "getCigarCharOpFromRefOffset(23)", 'D', cigar.getCigarCharOpFromRefOffset(23));
00694     check(failures, ++testNum, "getCigarCharOpFromRefOffset(24)", 'M', cigar.getCigarCharOpFromRefOffset(24));
00695     check(failures, ++testNum, "getCigarCharOpFromRefOffset(25)", 'M', cigar.getCigarCharOpFromRefOffset(25));
00696     check(failures, ++testNum, "getCigarCharOpFromRefOffset(26)", 'M', cigar.getCigarCharOpFromRefOffset(26));
00697     check(failures, ++testNum, "getCigarCharOpFromRefOffset(27)", '?', cigar.getCigarCharOpFromRefOffset(27));
00698     check(failures, ++testNum, "getCigarCharOpFromRefOffset(28)", '?', cigar.getCigarCharOpFromRefOffset(28));
00699     check(failures, ++testNum, "getCigarCharOpFromRefOffset(29)", '?', cigar.getCigarCharOpFromRefOffset(29));
00700     check(failures, ++testNum, "getCigarCharOpFromRefOffset(30)", '?', cigar.getCigarCharOpFromRefOffset(30));
00701 
00702 
00703     // Test getCigarCharOpFromRefPos.
00704     check(failures, ++testNum, "getCigarCharOpFromRefPos(-1, 5)", '?', cigar.getCigarCharOpFromRefPos(-1,5));
00705     check(failures, ++testNum, "getCigarCharOpFromRefPos(0, 5)", '?', cigar.getCigarCharOpFromRefPos(0,5));
00706     check(failures, ++testNum, "getCigarCharOpFromRefPos(1, 5)", '?', cigar.getCigarCharOpFromRefPos(1,5));
00707     check(failures, ++testNum, "getCigarCharOpFromRefPos(2, 5)", '?', cigar.getCigarCharOpFromRefPos(2,5));
00708     check(failures, ++testNum, "getCigarCharOpFromRefPos(3, 5)", '?', cigar.getCigarCharOpFromRefPos(3,5));
00709     check(failures, ++testNum, "getCigarCharOpFromRefPos(4, 5)", '?', cigar.getCigarCharOpFromRefPos(4,5));
00710     check(failures, ++testNum, "getCigarCharOpFromRefPos(5, 5)", 'M', cigar.getCigarCharOpFromRefPos(5,5));
00711     check(failures, ++testNum, "getCigarCharOpFromRefPos(6, 5)", 'M', cigar.getCigarCharOpFromRefPos(6,5));
00712     check(failures, ++testNum, "getCigarCharOpFromRefPos(7, 5)", 'M', cigar.getCigarCharOpFromRefPos(7,5));
00713     check(failures, ++testNum, "getCigarCharOpFromRefPos(8, 5)", 'M', cigar.getCigarCharOpFromRefPos(8,5));
00714     check(failures, ++testNum, "getCigarCharOpFromRefPos(9, 5)", 'N', cigar.getCigarCharOpFromRefPos(9,5));
00715     check(failures, ++testNum, "getCigarCharOpFromRefPos(10, 5)", 'N', cigar.getCigarCharOpFromRefPos(10,5));
00716     check(failures, ++testNum, "getCigarCharOpFromRefPos(11, 5)", 'N', cigar.getCigarCharOpFromRefPos(11,5));
00717     check(failures, ++testNum, "getCigarCharOpFromRefPos(12, 5)", 'N', cigar.getCigarCharOpFromRefPos(12,5));
00718     check(failures, ++testNum, "getCigarCharOpFromRefPos(13, 5)", 'N', cigar.getCigarCharOpFromRefPos(13,5));
00719     check(failures, ++testNum, "getCigarCharOpFromRefPos(14, 5)", 'N', cigar.getCigarCharOpFromRefPos(14,5));
00720     check(failures, ++testNum, "getCigarCharOpFromRefPos(15, 5)", 'N', cigar.getCigarCharOpFromRefPos(15,5));
00721     check(failures, ++testNum, "getCigarCharOpFromRefPos(16, 5)", 'N', cigar.getCigarCharOpFromRefPos(16,5));
00722     check(failures, ++testNum, "getCigarCharOpFromRefPos(17, 5)", 'N', cigar.getCigarCharOpFromRefPos(17,5));
00723     check(failures, ++testNum, "getCigarCharOpFromRefPos(18, 5)", 'N', cigar.getCigarCharOpFromRefPos(18,5));
00724     check(failures, ++testNum, "getCigarCharOpFromRefPos(19, 5)", 'M', cigar.getCigarCharOpFromRefPos(19,5));
00725     check(failures, ++testNum, "getCigarCharOpFromRefPos(20, 5)", 'M', cigar.getCigarCharOpFromRefPos(20,5));
00726     check(failures, ++testNum, "getCigarCharOpFromRefPos(21, 5)", 'M', cigar.getCigarCharOpFromRefPos(21,5));
00727     check(failures, ++testNum, "getCigarCharOpFromRefPos(22, 5)", 'M', cigar.getCigarCharOpFromRefPos(22,5));
00728     check(failures, ++testNum, "getCigarCharOpFromRefPos(23, 5)", 'M', cigar.getCigarCharOpFromRefPos(23,5));
00729     check(failures, ++testNum, "getCigarCharOpFromRefPos(24, 5)", 'M', cigar.getCigarCharOpFromRefPos(24,5));
00730     check(failures, ++testNum, "getCigarCharOpFromRefPos(25, 5)", 'D', cigar.getCigarCharOpFromRefPos(25,5));
00731     check(failures, ++testNum, "getCigarCharOpFromRefPos(26, 5)", 'D', cigar.getCigarCharOpFromRefPos(26,5));
00732     check(failures, ++testNum, "getCigarCharOpFromRefPos(27, 5)", 'D', cigar.getCigarCharOpFromRefPos(27,5));
00733     check(failures, ++testNum, "getCigarCharOpFromRefPos(28, 5)", 'D', cigar.getCigarCharOpFromRefPos(28,5));
00734     check(failures, ++testNum, "getCigarCharOpFromRefPos(29, 5)", 'M', cigar.getCigarCharOpFromRefPos(29,5));
00735     check(failures, ++testNum, "getCigarCharOpFromRefPos(30, 5)", 'M', cigar.getCigarCharOpFromRefPos(30,5));
00736     check(failures, ++testNum, "getCigarCharOpFromRefPos(31, 5)", 'M', cigar.getCigarCharOpFromRefPos(31,5));
00737     check(failures, ++testNum, "getCigarCharOpFromRefPos(32, 5)", '?', cigar.getCigarCharOpFromRefPos(32,5));
00738     check(failures, ++testNum, "getCigarCharOpFromRefPos(33, 5)", '?', cigar.getCigarCharOpFromRefPos(33,5));
00739 
00740 
00741 
00742 
00743     ////////////////////////
00744     // Test getNumOverlaps.
00745     check(failures, ++testNum, "getNumOverlaps(5,32,5)", (uint32_t)13, cigar.getNumOverlaps(5,32,5));
00746     check(failures, ++testNum, "getNumOverlaps(5,31,5)", (uint32_t)12, cigar.getNumOverlaps(5,31,5));
00747     check(failures, ++testNum, "getNumOverlaps(0,100,5)", (uint32_t)13, cigar.getNumOverlaps(0,100,5));
00748     check(failures, ++testNum, "getNumOverlaps(-1, -1,5)", (uint32_t)13, cigar.getNumOverlaps(-1, -1,5));
00749     check(failures, ++testNum, "getNumOverlaps(-1,10,5)", (uint32_t)4, cigar.getNumOverlaps(-1,10,5));
00750     check(failures, ++testNum, "getNumOverlaps(10,-1,5)", (uint32_t)9, cigar.getNumOverlaps(10,-1,5));
00751     check(failures, ++testNum, "getNumOverlaps(9,19,5)", (uint32_t)0, cigar.getNumOverlaps(9,19,5));
00752     check(failures, ++testNum, "getNumOverlaps(9,20,5)", (uint32_t)1, cigar.getNumOverlaps(9,20,5));
00753     check(failures, ++testNum, "getNumOverlaps(9,6,5)", (uint32_t)0, cigar.getNumOverlaps(9,6,5));
00754     check(failures, ++testNum, "getNumOverlaps(0,5,5)", (uint32_t)0, cigar.getNumOverlaps(0,5,5));
00755     check(failures, ++testNum, "getNumOverlaps(32,40,5)", (uint32_t)0, cigar.getNumOverlaps(32,40,5));
00756     check(failures, ++testNum, "getNumOverlaps(0,5,1)", (uint32_t)4, cigar.getNumOverlaps(0,5,1));
00757     check(failures, ++testNum, "getNumOverlaps(32,40,32)", (uint32_t)4, cigar.getNumOverlaps(32,40,32));
00758 
00759     // Get Query Index for reference offset 0 - 27
00760     // 4M
00761     check(failures, ++testNum, "getQueryIndex(0)", 0, cigar.getQueryIndex(0));
00762     check(failures, ++testNum, "getQueryIndex(1)", 1, cigar.getQueryIndex(1));
00763     check(failures, ++testNum, "getQueryIndex(2)", 2, cigar.getQueryIndex(2));
00764     check(failures, ++testNum, "getQueryIndex(3)", 3, cigar.getQueryIndex(3));
00765     // 10N
00766     check(failures, ++testNum, "getQueryIndex(4)", -1, cigar.getQueryIndex(4));
00767     check(failures, ++testNum, "getQueryIndex(5)", -1, cigar.getQueryIndex(5));
00768     check(failures, ++testNum, "getQueryIndex(6)", -1, cigar.getQueryIndex(6));
00769     check(failures, ++testNum, "getQueryIndex(7)", -1, cigar.getQueryIndex(7));
00770     check(failures, ++testNum, "getQueryIndex(8)", -1, cigar.getQueryIndex(8));
00771     check(failures, ++testNum, "getQueryIndex(9)", -1, cigar.getQueryIndex(9));
00772     check(failures, ++testNum, "getQueryIndex(10)", -1, cigar.getQueryIndex(10));
00773     check(failures, ++testNum, "getQueryIndex(11)", -1, cigar.getQueryIndex(11));
00774     check(failures, ++testNum, "getQueryIndex(12)", -1, cigar.getQueryIndex(12));
00775     check(failures, ++testNum, "getQueryIndex(13)", -1, cigar.getQueryIndex(13));
00776     // 4M
00777     check(failures, ++testNum, "getQueryIndex(14)", 4, cigar.getQueryIndex(14));
00778     check(failures, ++testNum, "getQueryIndex(15)", 5, cigar.getQueryIndex(15));
00779     check(failures, ++testNum, "getQueryIndex(16)", 6, cigar.getQueryIndex(16));
00780     check(failures, ++testNum, "getQueryIndex(17)", 7, cigar.getQueryIndex(17));
00781     // 3I - nothing to check - not in reference - covers query indices  8-10
00782     // 2M
00783     check(failures, ++testNum, "getQueryIndex(18)", 11, cigar.getQueryIndex(18));
00784     check(failures, ++testNum, "getQueryIndex(19)", 12, cigar.getQueryIndex(19));
00785     // 4D
00786     check(failures, ++testNum, "getQueryIndex(20)", -1, cigar.getQueryIndex(20));
00787     check(failures, ++testNum, "getQueryIndex(21)", -1, cigar.getQueryIndex(21));
00788     check(failures, ++testNum, "getQueryIndex(22)", -1, cigar.getQueryIndex(22));
00789     check(failures, ++testNum, "getQueryIndex(23)", -1, cigar.getQueryIndex(23));
00790     // 3M
00791     check(failures, ++testNum, "getQueryIndex(24)", 13, cigar.getQueryIndex(24));
00792     check(failures, ++testNum, "getQueryIndex(25)", 14, cigar.getQueryIndex(25));
00793     check(failures, ++testNum, "getQueryIndex(26)", 15, cigar.getQueryIndex(26));
00794 
00795     //  Get Query Index for reference positions 0-33
00796     // N/A
00797     check(failures, ++testNum, "getQueryIndex(0, 5)", -1, cigar.getQueryIndex(0, 5));
00798     check(failures, ++testNum, "getQueryIndex(1, 5)", -1, cigar.getQueryIndex(1, 5));
00799     check(failures, ++testNum, "getQueryIndex(2, 5)", -1, cigar.getQueryIndex(2, 5));
00800     check(failures, ++testNum, "getQueryIndex(3, 5)", -1, cigar.getQueryIndex(3, 5));
00801     check(failures, ++testNum, "getQueryIndex(4, 5)", -1, cigar.getQueryIndex(4, 5));
00802     // 4M
00803     check(failures, ++testNum, "getQueryIndex(5, 5)", 0, cigar.getQueryIndex(5, 5));
00804     check(failures, ++testNum, "getQueryIndex(6, 5)", 1, cigar.getQueryIndex(6, 5));
00805     check(failures, ++testNum, "getQueryIndex(7, 5)", 2, cigar.getQueryIndex(7, 5));
00806     check(failures, ++testNum, "getQueryIndex(8, 5)", 3, cigar.getQueryIndex(8, 5));
00807     // 10N
00808     check(failures, ++testNum, "getQueryIndex(9, 5)", -1, cigar.getQueryIndex(9, 5));
00809     check(failures, ++testNum, "getQueryIndex(10, 5)", -1, cigar.getQueryIndex(10, 5));
00810     check(failures, ++testNum, "getQueryIndex(11, 5)", -1, cigar.getQueryIndex(11, 5));
00811     check(failures, ++testNum, "getQueryIndex(12, 5)", -1, cigar.getQueryIndex(12, 5));
00812     check(failures, ++testNum, "getQueryIndex(13, 5)", -1, cigar.getQueryIndex(13, 5));
00813     check(failures, ++testNum, "getQueryIndex(14, 5)", -1, cigar.getQueryIndex(14, 5));
00814     check(failures, ++testNum, "getQueryIndex(15, 5)", -1, cigar.getQueryIndex(15, 5));
00815     check(failures, ++testNum, "getQueryIndex(16, 5)", -1, cigar.getQueryIndex(16, 5));
00816     check(failures, ++testNum, "getQueryIndex(17, 5)", -1, cigar.getQueryIndex(17, 5));
00817     check(failures, ++testNum, "getQueryIndex(18, 5)", -1, cigar.getQueryIndex(18, 5));
00818     // 4M
00819     check(failures, ++testNum, "getQueryIndex(19, 5)", 4, cigar.getQueryIndex(19, 5));
00820     check(failures, ++testNum, "getQueryIndex(20, 5)", 5, cigar.getQueryIndex(20, 5));
00821     check(failures, ++testNum, "getQueryIndex(21, 5)", 6, cigar.getQueryIndex(21, 5));
00822     check(failures, ++testNum, "getQueryIndex(22, 5)", 7, cigar.getQueryIndex(22, 5));
00823     // 3I - nothing to check - not in reference - covers query indices  8-10
00824     // 2M
00825     check(failures, ++testNum, "getQueryIndex(23, 5)", 11, cigar.getQueryIndex(23, 5));
00826     check(failures, ++testNum, "getQueryIndex(24, 5)", 12, cigar.getQueryIndex(24, 5));
00827     // 4D
00828     check(failures, ++testNum, "getQueryIndex(25, 5)", -1, cigar.getQueryIndex(25, 5));
00829     check(failures, ++testNum, "getQueryIndex(26, 5)", -1, cigar.getQueryIndex(26, 5));
00830     check(failures, ++testNum, "getQueryIndex(27, 5)", -1, cigar.getQueryIndex(27, 5));
00831     check(failures, ++testNum, "getQueryIndex(28, 5)", -1, cigar.getQueryIndex(28, 5));
00832     // 3M
00833     check(failures, ++testNum, "getQueryIndex(29, 5)", 13, cigar.getQueryIndex(29, 5));
00834     check(failures, ++testNum, "getQueryIndex(30, 5)", 14, cigar.getQueryIndex(30, 5));
00835     check(failures, ++testNum, "getQueryIndex(31, 5)", 15, cigar.getQueryIndex(31, 5));
00836 
00837     // Get reference offset for query index 0 - 17
00838     // 4M
00839     check(failures, ++testNum, "getRefOffset(0)", 0, cigar.getRefOffset(0));
00840     check(failures, ++testNum, "getRefOffset(1)", 1, cigar.getRefOffset(1));
00841     check(failures, ++testNum, "getRefOffset(2)", 2, cigar.getRefOffset(2));
00842     check(failures, ++testNum, "getRefOffset(3)", 3, cigar.getRefOffset(3));
00843     // 10N - nothing to check - not in query - covers ref offsets 4-13
00844     // 4M
00845     check(failures, ++testNum, "getRefOffset(4)", 14, cigar.getRefOffset(4));
00846     check(failures, ++testNum, "getRefOffset(5)", 15, cigar.getRefOffset(5));
00847     check(failures, ++testNum, "getRefOffset(6)", 16, cigar.getRefOffset(6));
00848     check(failures, ++testNum, "getRefOffset(7)", 17, cigar.getRefOffset(7));
00849     // 3I
00850     check(failures, ++testNum, "getRefOffset(8)", -1, cigar.getRefOffset(8));
00851     check(failures, ++testNum, "getRefOffset(9)", -1, cigar.getRefOffset(9));
00852     check(failures, ++testNum, "getRefOffset(10)", -1, cigar.getRefOffset(10));
00853     // 2M
00854     check(failures, ++testNum, "getRefOffset(11)", 18, cigar.getRefOffset(11));
00855     check(failures, ++testNum, "getRefOffset(12)", 19, cigar.getRefOffset(12));
00856     // 4D - nothing to check - not in query - covers ref offsets 20-23
00857     // 3M
00858     check(failures, ++testNum, "getRefOffset(13)", 24, cigar.getRefOffset(13));
00859     check(failures, ++testNum, "getRefOffset(14)", 25, cigar.getRefOffset(14));
00860     check(failures, ++testNum, "getRefOffset(15)", 26, cigar.getRefOffset(15));
00861 
00862 
00863     // Get reference position for query index 0 - 17
00864     // 4M
00865     check(failures, ++testNum, "getRefPosition(0, 5)", 5, cigar.getRefPosition(0, 5));
00866     check(failures, ++testNum, "getRefPosition(1, 5)", 6, cigar.getRefPosition(1, 5));
00867     check(failures, ++testNum, "getRefPosition(2, 5)", 7, cigar.getRefPosition(2, 5));
00868     check(failures, ++testNum, "getRefPosition(3, 5)", 8, cigar.getRefPosition(3, 5));
00869     // 10N - nothing to check - not in query - covers ref offsets 4-13
00870     // 4M
00871     check(failures, ++testNum, "getRefPosition(4, 5)", 19, cigar.getRefPosition(4, 5));
00872     check(failures, ++testNum, "getRefPosition(5, 5)", 20, cigar.getRefPosition(5, 5));
00873     check(failures, ++testNum, "getRefPosition(6, 5)", 21, cigar.getRefPosition(6, 5));
00874     check(failures, ++testNum, "getRefPosition(7, 5)", 22, cigar.getRefPosition(7, 5));
00875     // 3I
00876     check(failures, ++testNum, "getRefPosition(8, 5)", -1, cigar.getRefPosition(8, 5));
00877     check(failures, ++testNum, "getRefPosition(9, 5)", -1, cigar.getRefPosition(9, 5));
00878     check(failures, ++testNum, "getRefPosition(10, 5)", -1, cigar.getRefPosition(10, 5));
00879     // 2M
00880     check(failures, ++testNum, "getRefPosition(11, 5)", 23, cigar.getRefPosition(11, 5));
00881     check(failures, ++testNum, "getRefPosition(12, 5)", 24, cigar.getRefPosition(12, 5));
00882     // 4D - nothing to check - not in query - covers ref pos 25-28
00883     // 3M
00884     check(failures, ++testNum, "getRefPosition(13, 5)", 29, cigar.getRefPosition(13, 5));
00885     check(failures, ++testNum, "getRefPosition(14, 5)", 30, cigar.getRefPosition(14, 5));
00886     check(failures, ++testNum, "getRefPosition(15, 5)", 31, cigar.getRefPosition(15, 5));
00887 
00888 
00889 
00890     ////////////////////////////////////////////////////////////////////////////
00891     // Test a new CIGAR set by buffer.
00892     // 2S 3M 1I 2M 1D 1M 2P 1M 3N 1M 3H
00893     uint32_t cigarBuf[] = {0x24,  // 2S = 2 << 4 | 4
00894                            0x30,  // 3M = 3 << 4 | 0
00895                            0x11,  // 1I = 1 << 4 | 1
00896                            0x20,  // 2M = 2 << 4 | 0
00897                            0x12,  // 1D = 1 << 4 | 2
00898                            0x10,  // 1M = 1 << 4 | 0
00899                            0x26,  // 2P = 2 << 4 | 6
00900                            0x10,  // 1m = 1 << 4 | 0
00901                            0x33,  // 3N = 3 << 4 | 3
00902                            0x10,  // 1M = 1 << 4 | 0
00903                            0x35}; // 3H = 3 << 4 | 5
00904     cigar.Set(cigarBuf, 11);
00905     cigarString = "HI";
00906     cigar.getCigarString(cigarString);
00907     expectedResult = "2S3M1I2M1D1M2P1M3N1M3H";
00908     check(failures, ++testNum, "getCigarString", expectedResult, cigarString);
00909     check(failures, ++testNum, "getNumEndClips", 3, cigar.getNumEndClips());
00910     check(failures, ++testNum, "getNumBeginClips", 2, cigar.getNumBeginClips());
00911 
00912     std::cout << "\nCigarRoller PASS: " << testNum - failures << "  FAIL: " << failures << std::endl;
00913     // return the number of failures.
00914     return(failures);
00915 }
00916 
00917 
00918 int main(int argc, const char **argv)
00919 {
00920     CigarRollerTest roller;
00921     
00922     bool showAllCasesFlag = false;
00923     int opt;
00924 
00925     while(( opt = getopt(argc, (char **) argv, "v")) != -1) {
00926         switch(opt) {
00927             case 'v':
00928                 showAllCasesFlag = true;
00929                 break;
00930             default:
00931                 std::cerr << "usage: testSW [-v]" << std::endl;
00932                 exit(1);
00933         }
00934     }
00935     if(showAllCasesFlag)
00936     {
00937     }
00938 
00939     //
00940     // do cigar roller tests first
00941     //
00942     return(roller.test());
00943 
00944     // CIGAR explanation - for backward SW runs, the corresponding
00945     // CIGAR string is generated from the back of the string to the
00946     // front.  Recall that the soft clipping is only done at the
00947     // "end" of the string, taking direction into account.
00948 
00949     // Comment out this result since it doesn't refelct the results of test.
00950     //    cout << endl << "Total Errors found: " << errors << endl;
00951 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends