Debian Codegraph @

src/tests/tests.c

raw symbols SCIP
1 /* tests.c - some tests for functions in scythe */cxx . . $ `<file>/src/tests/tests.c`/
2
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string.h>
6 #include "../scythe.h"cxx . . $ `<file>/src/scythe.h`/
7
8 #define TEST_INITcxx . . $ `src/tests/tests.c:8:9`! int iii, ppp=0, passed=0, failed=0, checked=0;
9 #define TESTcxx . . $ `src/tests/tests.c:9:9`!(test, name) if (!(test)) { \
10 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "FAILED TEST '%s'\n", name); \
11 failed++; \
12 } else { \
13 printf("PASSED TEST '%s'\n", name); \
14 passed++; \
15 } checked++; \
16
17 #define TEST_ARRAYcxx . . $ `src/tests/tests.c:17:9`!(array1, array2, n, name) for (iii = 0; iii < n; iii++) { \
18 ppp = 0; \
19 if (array1[iii] != array2[iii]) { \
20 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "FAILED TEST '%s'\n", name); \
21 ppp = 1; failed++; \
22 break; \
23 } \
24 } \
25 if (ppp == 0) { \
26 passed++; \
27 printf("PASSED TEST '%s'\n", name); \
28 } \
29 checked++; \
30
31 #define TEST_CLOSEcxx . . $ `src/tests/tests.c:31:9`! printf("\ntests: %d\npassed: %d\nfailed: %d\n", checked, passed, failed);
32
33 void test_score_sequencecxx . . $ test_score_sequence(49f6e7a06ebc5aa8).(void) {
34 char *seqa = "ATCGATCGATCGATCGATCGATCG";
35 char *seqb = "AACGATCGATCGATCGATCGATCG";
36 int cmp1[] = {1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
37 int *cmp1_t = calloccxx . . $ calloc(63a7bf2941bfcd7a).(24, sizeof(*cmp1_t));
38 score_sequencecxx . . $ score_sequence(573e900797376e94).(cmp1_t, seqa, seqb, strlencxx . . $ strlen(751346f8406fd082).(seqa));
39
40 TEST_INITcxx . . $ `src/tests/tests.c:8:9`!;
41 TEST_ARRAYcxx . . $ `src/tests/tests.c:17:9`!(cmp1, cmp1_t, 24, "score_sequence");
42
43 TESTcxx . . $ `src/tests/tests.c:9:9`!(sum(score_sequence(cmp1_t, seqa, seqb, strlen(seqa)), strlen(seqa)) == 22, "sum of score_sequence");
44
45 freecxx . . $ free(5d22bdacc48458e8).(cmp1_t);
46 TEST_CLOSEcxx . . $ `src/tests/tests.c:31:9`!;
47 }
48
49 int maincxx . . $ main(afcd3168fc1188a4).(int argc, char *argv[]) {
50 test_score_sequencecxx . . $ test_score_sequence(49f6e7a06ebc5aa8).();
51 return 0;
52 }