00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <getopt.h>
00025 #include "Generic.h"
00026 #include "CigarRollerTest.h"
00027
00028
00029
00030
00031
00032 int CigarRollerTest::test(void)
00033 {
00034
00035 CigarRoller cigar;
00036
00037 int failures = 0, testNum = 0;
00038
00039
00040 String str;
00041 std::string result;
00042
00043 cigar.getCigarString(str);
00044 result = str.c_str();
00045
00046
00047 check(failures, ++testNum, "constructor", result, "");
00048
00049 CigarRoller::CigarOperator op;
00050
00051 op.operation = CigarRoller::match;
00052 op.count = 10;
00053
00054 cigar += op;
00055
00056 op.count=5;
00057
00058 cigar += op;
00059
00060 op.count=5; op.operation = CigarRoller::mismatch;
00061
00062 cigar += op;
00063
00064 op.count=5; op.operation = CigarRoller::insert;
00065
00066 cigar += op;
00067
00068 op.count=5; op.operation = CigarRoller::insert;
00069
00070 cigar += op;
00071
00072 op.count=5; op.operation = CigarRoller::del;
00073
00074 cigar += op;
00075
00076 op.count=5; op.operation = CigarRoller::mismatch;
00077
00078 cigar += op;
00079
00080 op.count=5; op.operation = CigarRoller::match;
00081
00082 cigar += op;
00083
00084 op.count=5; op.operation = CigarRoller::skip;
00085
00086 cigar += op;
00087
00088 op.count=5; op.operation = CigarRoller::match;
00089
00090 cigar += op;
00091
00092 op.count=2; op.operation = CigarRoller::pad;
00093
00094 cigar += op;
00095
00096 op.count=3; op.operation = CigarRoller::match;
00097
00098 cigar += op;
00099
00100 cigar.getCigarString(str);
00101 result = str.c_str();
00102
00103
00104 check(failures, ++testNum, "match combining", "20M10I5D10M5N5M2P3M", result);
00105 check(failures, ++testNum, "length check", 8, cigar.size());
00106
00107
00108
00109
00110
00111
00112
00113 check(failures, ++testNum, "getRefOffset(20)", -1, cigar.getRefOffset(20));
00114 check(failures, ++testNum, "getRefOffset(30)", 25, cigar.getRefOffset(30));
00115 check(failures, ++testNum, "getRefOffset(46)", 46, cigar.getRefOffset(46));
00116 check(failures, ++testNum, "getRefOffset(0)", 0, cigar.getRefOffset(0));
00117 check(failures, ++testNum, "getRefPosition(20, 5)", -1, cigar.getRefPosition(20, 5));
00118 check(failures, ++testNum, "getRefPosition(30, 5)", 30, cigar.getRefPosition(30, 5));
00119 check(failures, ++testNum, "getRefPosition(46, 5)", 51, cigar.getRefPosition(46, 5));
00120 check(failures, ++testNum, "getRefPosition(0, 5)", 5, cigar.getRefPosition(0, 5));
00121 check(failures, ++testNum, "getQueryIndex(20)", CigarRoller::INDEX_NA, cigar.getQueryIndex(20));
00122 check(failures, ++testNum, "getQueryIndex(30)", 35, cigar.getQueryIndex(30));
00123 check(failures, ++testNum, "getQueryIndex(35)", Cigar::INDEX_NA, cigar.getQueryIndex(35));
00124 check(failures, ++testNum, "getQueryIndex(46)", 46, cigar.getQueryIndex(46));
00125 check(failures, ++testNum, "getQueryIndex(0)", 0, cigar.getQueryIndex(0));
00126 check(failures, ++testNum, "getQueryIndex(25, 5)", -1, cigar.getQueryIndex(20));
00127 check(failures, ++testNum, "getQueryIndex(35, 5)", 35, cigar.getQueryIndex(30));
00128 check(failures, ++testNum, "getQueryIndex(40, 5)", -1, cigar.getQueryIndex(35));
00129 check(failures, ++testNum, "getQueryIndex(51, 5)", 46, cigar.getQueryIndex(46));
00130 check(failures, ++testNum, "getQueryIndex(5, 5)", 0, cigar.getQueryIndex(0));
00131
00132 int i = 0;
00133 int queryIndex = 0;
00134 int refOffset = 0;
00135
00136 for(i = 0; i < 20; i++)
00137 {
00138 check(failures, ++testNum, "getRefOffset(queryIndex)", refOffset, cigar.getRefOffset(queryIndex));
00139 check(failures, ++testNum, "getQueryIndex(refOffset)", queryIndex, cigar.getQueryIndex(refOffset));
00140 check(failures, ++testNum, "getRefPosition(queryIndex, 5)", refOffset + 5, cigar.getRefPosition(queryIndex, 5));
00141 check(failures, ++testNum, "getQueryIndex(refPosition, 5)", queryIndex, cigar.getQueryIndex(refOffset + 5, 5));
00142 ++queryIndex;
00143 ++refOffset;
00144 }
00145
00146 for(i = 0; i < 10; i++)
00147 {
00148 check(failures, ++testNum, "getRefOffset(queryIndex)", -1, cigar.getRefOffset(queryIndex));
00149 check(failures, ++testNum, "getRefPosition(queryIndex, 5)", -1, cigar.getRefPosition(queryIndex, 5));
00150 ++queryIndex;
00151 }
00152
00153 for(i = 0; i < 5; i++)
00154 {
00155 check(failures, ++testNum, "getQueryIndex(refOffset)", -1, cigar.getQueryIndex(refOffset));
00156 check(failures, ++testNum, "getQueryIndex(refPosition, 5)", -1, cigar.getQueryIndex(refOffset + 5, 5));
00157 refOffset++;
00158 }
00159
00160 for(i = 0; i < 10; i++)
00161 {
00162 check(failures, ++testNum, "getRefOffset(queryIndex)", refOffset, cigar.getRefOffset(queryIndex));
00163 check(failures, ++testNum, "getQueryIndex(refOffset)", queryIndex, cigar.getQueryIndex(refOffset));
00164 check(failures, ++testNum, "getRefPosition(queryIndex, 5)", refOffset + 5, cigar.getRefPosition(queryIndex, 5));
00165 check(failures, ++testNum, "getQueryIndex(refPosition, 5)", queryIndex, cigar.getQueryIndex(refOffset + 5, 5));
00166 ++queryIndex;
00167 ++refOffset;
00168 }
00169
00170 for(i = 0; i < 5; i++)
00171 {
00172 check(failures, ++testNum, "getQueryIndex(refOffset)", -1, cigar.getQueryIndex(refOffset));
00173 check(failures, ++testNum, "getQueryIndex(refPosition, 5)", -1, cigar.getQueryIndex(refOffset + 5, 5));
00174 refOffset++;
00175 }
00176
00177 for(i = 0; i < 5; i++)
00178 {
00179 check(failures, ++testNum, "getRefOffset(queryIndex)", refOffset, cigar.getRefOffset(queryIndex));
00180 check(failures, ++testNum, "getQueryIndex(refOffset)", queryIndex, cigar.getQueryIndex(refOffset));
00181 check(failures, ++testNum, "getRefPosition(queryIndex, 5)", refOffset + 5, cigar.getRefPosition(queryIndex, 5));
00182 check(failures, ++testNum, "getQueryIndex(refPosition, 5)", queryIndex, cigar.getQueryIndex(refOffset + 5, 5));
00183 ++queryIndex;
00184 ++refOffset;
00185 }
00186
00187
00188 for(i = 0; i < 3; i++)
00189 {
00190 check(failures, ++testNum, "getRefOffset(queryIndex)", refOffset, cigar.getRefOffset(queryIndex));
00191 check(failures, ++testNum, "getQueryIndex(refOffset)", queryIndex, cigar.getQueryIndex(refOffset));
00192 check(failures, ++testNum, "getRefPosition(queryIndex, 5)", refOffset + 5, cigar.getRefPosition(queryIndex, 5));
00193 check(failures, ++testNum, "getQueryIndex(refPosition, 5)", queryIndex, cigar.getQueryIndex(refOffset + 5, 5));
00194 ++queryIndex;
00195 ++refOffset;
00196 }
00197
00198
00199 check(failures, ++testNum, "getRefOffset(queryIndex)", -1, cigar.getRefOffset(queryIndex));
00200 check(failures, ++testNum, "getQueryIndex(refOffset)", -1, cigar.getQueryIndex(refOffset));
00201 check(failures, ++testNum, "getRefPosition(queryIndex, 5)", -1, cigar.getRefPosition(queryIndex, 5));
00202 check(failures, ++testNum, "getQueryIndex(refPosition, 5)", -1, cigar.getQueryIndex(refOffset + 5, 5));
00203 ++queryIndex;
00204 ++refOffset;
00205 check(failures, ++testNum, "getRefOffset(queryIndex)", -1, cigar.getRefOffset(queryIndex));
00206 check(failures, ++testNum, "getQueryIndex(refOffset)", -1, cigar.getQueryIndex(refOffset));
00207 check(failures, ++testNum, "getRefPosition(queryIndex, 5)", -1, cigar.getRefPosition(queryIndex, 5));
00208 check(failures, ++testNum, "getQueryIndex(refPosition, 5)", -1, cigar.getQueryIndex(refOffset + 5, 5));
00209
00210
00211
00212
00213
00214
00215
00216
00217 check(failures, ++testNum, "getNumOverlaps(1, 5, 5)", (uint32_t)0, cigar.getNumOverlaps(1, 5, 5));
00218
00219
00220 check(failures, ++testNum, "getNumOverlaps(53, 101, 5)", (uint32_t)0, cigar.getNumOverlaps(53, 101, 5));
00221
00222
00223 check(failures, ++testNum, "getNumOverlaps(53, 10, 5)", (uint32_t)0, cigar.getNumOverlaps(53, 10, 5));
00224
00225
00226 check(failures, ++testNum, "getNumOverlaps(35, 10, 5)", (uint32_t)0, cigar.getNumOverlaps(35, 10, 5));
00227
00228
00229 check(failures, ++testNum, "getNumOverlaps(35, 1, 5)", (uint32_t)0, cigar.getNumOverlaps(35, 1, 5));
00230
00231
00232 check(failures, ++testNum, "getNumOverlaps(1, 6, 5)", (uint32_t)1, cigar.getNumOverlaps(1, 6, 5));
00233
00234
00235 check(failures, ++testNum, "getNumOverlaps(25, 30, 5)", (uint32_t)0, cigar.getNumOverlaps(25, 30, 5));
00236
00237
00238 check(failures, ++testNum, "getNumOverlaps(24, 30, 5)", (uint32_t)1, cigar.getNumOverlaps(24, 30, 5));
00239
00240
00241 check(failures, ++testNum, "getNumOverlaps(25, 31, 5)", (uint32_t)1, cigar.getNumOverlaps(25, 31, 5));
00242
00243
00244 check(failures, ++testNum, "getNumOverlaps(1, 31, 5)", (uint32_t)21, cigar.getNumOverlaps(1, 31, 5));
00245
00246
00247 check(failures, ++testNum, "getNumOverlaps(1, 101, 5)", (uint32_t)38, cigar.getNumOverlaps(1, 101, 5));
00248
00249
00250 check(failures, ++testNum, "getNumOverlaps(-1, -1, 5)", (uint32_t)38, cigar.getNumOverlaps(-1, -1, 5));
00251
00252
00253 check(failures, ++testNum, "getNumOverlaps(6, 52, 5)", (uint32_t)36, cigar.getNumOverlaps(6, 52, 5));
00254
00255
00256 check(failures, ++testNum, "getNumOverlaps(40, 45, 5)", (uint32_t)0, cigar.getNumOverlaps(40, 45, 5));
00257
00258
00259 check(failures, ++testNum, "getNumOverlaps(-1, 10, 5)", (uint32_t)5, cigar.getNumOverlaps(-1, 10, 5));
00260
00261
00262 check(failures, ++testNum, "getNumOverlaps(50, -1, 5)", (uint32_t)3, cigar.getNumOverlaps(50, -1, 5));
00263
00264
00265
00266 cigar.Set("4M10N4M3I2M4D3M");
00267 String expectedResult = "4M10N4M3I2M4D3M";
00268 String cigarString = "HI";
00269 cigar.getCigarString(cigarString);
00270 check(failures, ++testNum, "getCigarString", expectedResult, cigarString);
00271
00272
00273
00274 check(failures, ++testNum, "getNumOverlaps(5,32,5)", (uint32_t)13, cigar.getNumOverlaps(5,32,5));
00275 check(failures, ++testNum, "getNumOverlaps(5,31,5)", (uint32_t)12, cigar.getNumOverlaps(5,31,5));
00276 check(failures, ++testNum, "getNumOverlaps(0,100,5)", (uint32_t)13, cigar.getNumOverlaps(0,100,5));
00277 check(failures, ++testNum, "getNumOverlaps(-1, -1,5)", (uint32_t)13, cigar.getNumOverlaps(-1, -1,5));
00278 check(failures, ++testNum, "getNumOverlaps(-1,10,5)", (uint32_t)4, cigar.getNumOverlaps(-1,10,5));
00279 check(failures, ++testNum, "getNumOverlaps(10,-1,5)", (uint32_t)9, cigar.getNumOverlaps(10,-1,5));
00280 check(failures, ++testNum, "getNumOverlaps(9,19,5)", (uint32_t)0, cigar.getNumOverlaps(9,19,5));
00281 check(failures, ++testNum, "getNumOverlaps(9,20,5)", (uint32_t)1, cigar.getNumOverlaps(9,20,5));
00282 check(failures, ++testNum, "getNumOverlaps(9,6,5)", (uint32_t)0, cigar.getNumOverlaps(9,6,5));
00283 check(failures, ++testNum, "getNumOverlaps(0,5,5)", (uint32_t)0, cigar.getNumOverlaps(0,5,5));
00284 check(failures, ++testNum, "getNumOverlaps(32,40,5)", (uint32_t)0, cigar.getNumOverlaps(32,40,5));
00285 check(failures, ++testNum, "getNumOverlaps(0,5,1)", (uint32_t)4, cigar.getNumOverlaps(0,5,1));
00286 check(failures, ++testNum, "getNumOverlaps(32,40,32)", (uint32_t)4, cigar.getNumOverlaps(32,40,32));
00287
00288
00289
00290 check(failures, ++testNum, "getQueryIndex(0)", 0, cigar.getQueryIndex(0));
00291 check(failures, ++testNum, "getQueryIndex(1)", 1, cigar.getQueryIndex(1));
00292 check(failures, ++testNum, "getQueryIndex(2)", 2, cigar.getQueryIndex(2));
00293 check(failures, ++testNum, "getQueryIndex(3)", 3, cigar.getQueryIndex(3));
00294
00295 check(failures, ++testNum, "getQueryIndex(4)", -1, cigar.getQueryIndex(4));
00296 check(failures, ++testNum, "getQueryIndex(5)", -1, cigar.getQueryIndex(5));
00297 check(failures, ++testNum, "getQueryIndex(6)", -1, cigar.getQueryIndex(6));
00298 check(failures, ++testNum, "getQueryIndex(7)", -1, cigar.getQueryIndex(7));
00299 check(failures, ++testNum, "getQueryIndex(8)", -1, cigar.getQueryIndex(8));
00300 check(failures, ++testNum, "getQueryIndex(9)", -1, cigar.getQueryIndex(9));
00301 check(failures, ++testNum, "getQueryIndex(10)", -1, cigar.getQueryIndex(10));
00302 check(failures, ++testNum, "getQueryIndex(11)", -1, cigar.getQueryIndex(11));
00303 check(failures, ++testNum, "getQueryIndex(12)", -1, cigar.getQueryIndex(12));
00304 check(failures, ++testNum, "getQueryIndex(13)", -1, cigar.getQueryIndex(13));
00305
00306 check(failures, ++testNum, "getQueryIndex(14)", 4, cigar.getQueryIndex(14));
00307 check(failures, ++testNum, "getQueryIndex(15)", 5, cigar.getQueryIndex(15));
00308 check(failures, ++testNum, "getQueryIndex(16)", 6, cigar.getQueryIndex(16));
00309 check(failures, ++testNum, "getQueryIndex(17)", 7, cigar.getQueryIndex(17));
00310
00311
00312 check(failures, ++testNum, "getQueryIndex(18)", 11, cigar.getQueryIndex(18));
00313 check(failures, ++testNum, "getQueryIndex(19)", 12, cigar.getQueryIndex(19));
00314
00315 check(failures, ++testNum, "getQueryIndex(20)", -1, cigar.getQueryIndex(20));
00316 check(failures, ++testNum, "getQueryIndex(21)", -1, cigar.getQueryIndex(21));
00317 check(failures, ++testNum, "getQueryIndex(22)", -1, cigar.getQueryIndex(22));
00318 check(failures, ++testNum, "getQueryIndex(23)", -1, cigar.getQueryIndex(23));
00319
00320 check(failures, ++testNum, "getQueryIndex(24)", 13, cigar.getQueryIndex(24));
00321 check(failures, ++testNum, "getQueryIndex(25)", 14, cigar.getQueryIndex(25));
00322 check(failures, ++testNum, "getQueryIndex(26)", 15, cigar.getQueryIndex(26));
00323
00324
00325
00326 check(failures, ++testNum, "getQueryIndex(0, 5)", -1, cigar.getQueryIndex(0, 5));
00327 check(failures, ++testNum, "getQueryIndex(1, 5)", -1, cigar.getQueryIndex(1, 5));
00328 check(failures, ++testNum, "getQueryIndex(2, 5)", -1, cigar.getQueryIndex(2, 5));
00329 check(failures, ++testNum, "getQueryIndex(3, 5)", -1, cigar.getQueryIndex(3, 5));
00330 check(failures, ++testNum, "getQueryIndex(4, 5)", -1, cigar.getQueryIndex(4, 5));
00331
00332 check(failures, ++testNum, "getQueryIndex(5, 5)", 0, cigar.getQueryIndex(5, 5));
00333 check(failures, ++testNum, "getQueryIndex(6, 5)", 1, cigar.getQueryIndex(6, 5));
00334 check(failures, ++testNum, "getQueryIndex(7, 5)", 2, cigar.getQueryIndex(7, 5));
00335 check(failures, ++testNum, "getQueryIndex(8, 5)", 3, cigar.getQueryIndex(8, 5));
00336
00337 check(failures, ++testNum, "getQueryIndex(9, 5)", -1, cigar.getQueryIndex(9, 5));
00338 check(failures, ++testNum, "getQueryIndex(10, 5)", -1, cigar.getQueryIndex(10, 5));
00339 check(failures, ++testNum, "getQueryIndex(11, 5)", -1, cigar.getQueryIndex(11, 5));
00340 check(failures, ++testNum, "getQueryIndex(12, 5)", -1, cigar.getQueryIndex(12, 5));
00341 check(failures, ++testNum, "getQueryIndex(13, 5)", -1, cigar.getQueryIndex(13, 5));
00342 check(failures, ++testNum, "getQueryIndex(14, 5)", -1, cigar.getQueryIndex(14, 5));
00343 check(failures, ++testNum, "getQueryIndex(15, 5)", -1, cigar.getQueryIndex(15, 5));
00344 check(failures, ++testNum, "getQueryIndex(16, 5)", -1, cigar.getQueryIndex(16, 5));
00345 check(failures, ++testNum, "getQueryIndex(17, 5)", -1, cigar.getQueryIndex(17, 5));
00346 check(failures, ++testNum, "getQueryIndex(18, 5)", -1, cigar.getQueryIndex(18, 5));
00347
00348 check(failures, ++testNum, "getQueryIndex(19, 5)", 4, cigar.getQueryIndex(19, 5));
00349 check(failures, ++testNum, "getQueryIndex(20, 5)", 5, cigar.getQueryIndex(20, 5));
00350 check(failures, ++testNum, "getQueryIndex(21, 5)", 6, cigar.getQueryIndex(21, 5));
00351 check(failures, ++testNum, "getQueryIndex(22, 5)", 7, cigar.getQueryIndex(22, 5));
00352
00353
00354 check(failures, ++testNum, "getQueryIndex(23, 5)", 11, cigar.getQueryIndex(23, 5));
00355 check(failures, ++testNum, "getQueryIndex(24, 5)", 12, cigar.getQueryIndex(24, 5));
00356
00357 check(failures, ++testNum, "getQueryIndex(25, 5)", -1, cigar.getQueryIndex(25, 5));
00358 check(failures, ++testNum, "getQueryIndex(26, 5)", -1, cigar.getQueryIndex(26, 5));
00359 check(failures, ++testNum, "getQueryIndex(27, 5)", -1, cigar.getQueryIndex(27, 5));
00360 check(failures, ++testNum, "getQueryIndex(28, 5)", -1, cigar.getQueryIndex(28, 5));
00361
00362 check(failures, ++testNum, "getQueryIndex(29, 5)", 13, cigar.getQueryIndex(29, 5));
00363 check(failures, ++testNum, "getQueryIndex(30, 5)", 14, cigar.getQueryIndex(30, 5));
00364 check(failures, ++testNum, "getQueryIndex(31, 5)", 15, cigar.getQueryIndex(31, 5));
00365
00366
00367
00368 check(failures, ++testNum, "getRefOffset(0)", 0, cigar.getRefOffset(0));
00369 check(failures, ++testNum, "getRefOffset(1)", 1, cigar.getRefOffset(1));
00370 check(failures, ++testNum, "getRefOffset(2)", 2, cigar.getRefOffset(2));
00371 check(failures, ++testNum, "getRefOffset(3)", 3, cigar.getRefOffset(3));
00372
00373
00374 check(failures, ++testNum, "getRefOffset(4)", 14, cigar.getRefOffset(4));
00375 check(failures, ++testNum, "getRefOffset(5)", 15, cigar.getRefOffset(5));
00376 check(failures, ++testNum, "getRefOffset(6)", 16, cigar.getRefOffset(6));
00377 check(failures, ++testNum, "getRefOffset(7)", 17, cigar.getRefOffset(7));
00378
00379 check(failures, ++testNum, "getRefOffset(8)", -1, cigar.getRefOffset(8));
00380 check(failures, ++testNum, "getRefOffset(9)", -1, cigar.getRefOffset(9));
00381 check(failures, ++testNum, "getRefOffset(10)", -1, cigar.getRefOffset(10));
00382
00383 check(failures, ++testNum, "getRefOffset(11)", 18, cigar.getRefOffset(11));
00384 check(failures, ++testNum, "getRefOffset(12)", 19, cigar.getRefOffset(12));
00385
00386
00387 check(failures, ++testNum, "getRefOffset(13)", 24, cigar.getRefOffset(13));
00388 check(failures, ++testNum, "getRefOffset(14)", 25, cigar.getRefOffset(14));
00389 check(failures, ++testNum, "getRefOffset(15)", 26, cigar.getRefOffset(15));
00390
00391
00392
00393
00394 check(failures, ++testNum, "getRefPosition(0, 5)", 5, cigar.getRefPosition(0, 5));
00395 check(failures, ++testNum, "getRefPosition(1, 5)", 6, cigar.getRefPosition(1, 5));
00396 check(failures, ++testNum, "getRefPosition(2, 5)", 7, cigar.getRefPosition(2, 5));
00397 check(failures, ++testNum, "getRefPosition(3, 5)", 8, cigar.getRefPosition(3, 5));
00398
00399
00400 check(failures, ++testNum, "getRefPosition(4, 5)", 19, cigar.getRefPosition(4, 5));
00401 check(failures, ++testNum, "getRefPosition(5, 5)", 20, cigar.getRefPosition(5, 5));
00402 check(failures, ++testNum, "getRefPosition(6, 5)", 21, cigar.getRefPosition(6, 5));
00403 check(failures, ++testNum, "getRefPosition(7, 5)", 22, cigar.getRefPosition(7, 5));
00404
00405 check(failures, ++testNum, "getRefPosition(8, 5)", -1, cigar.getRefPosition(8, 5));
00406 check(failures, ++testNum, "getRefPosition(9, 5)", -1, cigar.getRefPosition(9, 5));
00407 check(failures, ++testNum, "getRefPosition(10, 5)", -1, cigar.getRefPosition(10, 5));
00408
00409 check(failures, ++testNum, "getRefPosition(11, 5)", 23, cigar.getRefPosition(11, 5));
00410 check(failures, ++testNum, "getRefPosition(12, 5)", 24, cigar.getRefPosition(12, 5));
00411
00412
00413 check(failures, ++testNum, "getRefPosition(13, 5)", 29, cigar.getRefPosition(13, 5));
00414 check(failures, ++testNum, "getRefPosition(14, 5)", 30, cigar.getRefPosition(14, 5));
00415 check(failures, ++testNum, "getRefPosition(15, 5)", 31, cigar.getRefPosition(15, 5));
00416
00417
00418
00419
00420
00421
00422 uint32_t cigarBuf[] = {0x24,
00423 0x30,
00424 0x11,
00425 0x20,
00426 0x12,
00427 0x10,
00428 0x26,
00429 0x10,
00430 0x33,
00431 0x10,
00432 0x35};
00433 cigar.Set(cigarBuf, 11);
00434 cigarString = "HI";
00435 cigar.getCigarString(cigarString);
00436 expectedResult = "2S3M1I2M1D1M2P1M3N1M3H";
00437 check(failures, ++testNum, "getCigarString", expectedResult, cigarString);
00438 check(failures, ++testNum, "getNumEndClips", 3, cigar.getNumEndClips());
00439 check(failures, ++testNum, "getNumBeginClips", 2, cigar.getNumBeginClips());
00440
00441 std::cout << "\nCigarRoller PASS: " << testNum - failures << " FAIL: " << failures << std::endl;
00442
00443 return(failures);
00444 }
00445
00446
00447 int main(int argc, const char **argv)
00448 {
00449 CigarRollerTest roller;
00450
00451 bool showAllCasesFlag = false;
00452 int opt;
00453
00454 while(( opt = getopt(argc, (char **) argv, "v")) != -1) {
00455 switch(opt) {
00456 case 'v':
00457 showAllCasesFlag = true;
00458 break;
00459 default:
00460 std::cerr << "usage: testSW [-v]" << std::endl;
00461 exit(1);
00462 }
00463 }
00464
00465
00466
00467
00468
00469 return(roller.test());
00470
00471
00472
00473
00474
00475
00476
00477
00478 }