MCPcopy Create free account
hub / github.com/OpenGene/fastp / testSimd

Function testSimd

src/simd.cpp:326–564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

324}
325
326bool testSimd() {
327 bool pass = true;
328
329 // --- reverseComplement ---
330 // Basic case
331 {
332 const char* in = "AAAATTTTCCCCGGGG";
333 int len = 16;
334 char out[16];
335 reverseComplement(in, out, len);
336 char ref[16];
337 scalarReverseComplement(in, ref, len);
338 if (memcmp(out, ref, len) != 0) {
339 fprintf(stderr, "FAIL: reverseComplement basic\n");
340 pass = false;
341 }
342 }
343 // Mixed case
344 {
345 const char* in = "AaTtCcGgN";
346 int len = 9;
347 char out[9];
348 reverseComplement(in, out, len);
349 char ref[9];
350 scalarReverseComplement(in, ref, len);
351 if (memcmp(out, ref, len) != 0) {
352 fprintf(stderr, "FAIL: reverseComplement mixed case\n");
353 pass = false;
354 }
355 }
356 // Empty
357 {
358 char out[1] = {'X'};
359 reverseComplement("", out, 0);
360 // Should not crash; out unchanged
361 }
362 // Length 1
363 {
364 char out[1];
365 reverseComplement("A", out, 1);
366 if (out[0] != 'T') {
367 fprintf(stderr, "FAIL: reverseComplement len=1\n");
368 pass = false;
369 }
370 }
371 // Long string (> typical SIMD width) to exercise SIMD + tail
372 {
373 const char* in = "ATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCG";
374 int len = 68;
375 char out[68], ref[68];
376 reverseComplement(in, out, len);
377 scalarReverseComplement(in, ref, len);
378 if (memcmp(out, ref, len) != 0) {
379 fprintf(stderr, "FAIL: reverseComplement long string\n");
380 pass = false;
381 }
382 }
383

Callers 1

runMethod · 0.85

Calls 8

reverseComplementFunction · 0.85
scalarReverseComplementFunction · 0.85
countQualityMetricsFunction · 0.85
countAdjacentDiffsFunction · 0.85
scalarCountAdjacentDiffsFunction · 0.85
countMismatchesFunction · 0.85
countMismatchesBoundedFunction · 0.85

Tested by 1

runMethod · 0.68