-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_revcomp.cxx
46 lines (34 loc) · 1017 Bytes
/
check_revcomp.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include "common.h"
#include "revcomp.h"
static const size_t LENGTH = 100000;
int main()
{
char *seq = static_cast<char *>(malloc(LENGTH + 1));
char *rev = static_cast<char *>(malloc(LENGTH + 1));
char *rev2 = static_cast<char *>(malloc(LENGTH + 1));
gen(seq, LENGTH);
rev = revcomp_simple(seq, LENGTH, rev);
rev2 = revcomp_table(seq, LENGTH, rev2);
assert(strcmp(rev, rev2) == 0);
rev2 = revcomp_reverse(seq, LENGTH, rev2);
assert(strcmp(rev, rev2) == 0);
rev2 = revcomp_twocase(seq, LENGTH, rev2);
assert(strcmp(rev, rev2) == 0);
rev2 = revcomp_twocase_switch(seq, LENGTH, rev2);
assert(strcmp(rev, rev2) == 0);
rev2 = revcomp_twiddle(seq, LENGTH, rev2);
assert(strcmp(rev, rev2) == 0);
rev2 = revcomp_subtraction(seq, LENGTH, rev2);
assert(strcmp(rev, rev2) == 0);
rev2 = revcomp_twostep(seq, LENGTH, rev2);
assert(strcmp(rev, rev2) == 0);
free(seq);
free(rev);
free(rev2);
return 0;
}