[go: up one dir, main page]

File: test_seq.c

package info (click to toggle)
andi 0.13-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 952 kB
  • sloc: ansic: 2,267; sh: 426; cpp: 99; makefile: 76; awk: 51
file content (88 lines) | stat: -rw-r--r-- 1,754 bytes parent folder | download | duplicates (3)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include <glib.h>
#include "global.h"
#include <stdio.h>
#include <string.h>
#include "sequence.h"

double ANCHOR_P_VALUE = 0.025;

int FLAGS = F_NONE;

void test_seq_basic(){

	seq_t S;

	seq_init( &S, "ACGT", "name");

	g_assert_cmpstr(S.S, ==, "ACGT");
	g_assert_cmpstr(S.name, ==, "name");
	g_assert_cmpuint(S.len, ==, 4);

	seq_free( &S);
}

void test_seq_full(){

	seq_t S;
	seq_subject subject;

	seq_init( &S, "ACGTTGCA", "name");
	int check = seq_subject_init( &subject, &S);

	g_assert_cmpint(check, ==, 0);

	g_assert_cmpstr(subject.RS, ==, "TGCAACGT#ACGTTGCA");
	g_assert_cmpuint(subject.RSlen, ==, 8*2+1);
	g_assert( subject.gc == 0.5);

	seq_subject_free( &subject);
	seq_free( &S);
}

void test_seq_nonacgt(){
	seq_t S;
	seq_subject subject;

	seq_init( &S, "11ACGTNN7682394689NNTGCA11", "name");
	seq_subject_init( &subject, &S);

	g_assert_cmpstr(S.S, ==, "ACGTTGCA");
	g_assert_cmpuint(S.len, ==, 8 );
	g_assert( FLAGS & F_NON_ACGT);

	g_assert_cmpstr(subject.RS, ==, "TGCAACGT#ACGTTGCA");
	g_assert_cmpuint(subject.RSlen, ==, 8*2+1);
	g_assert( subject.gc == 0.5);

	seq_subject_free( &subject);
	seq_free( &S);

	FLAGS = F_NONE;

	seq_init( &S, "@ACGT_!0TGCA        ", "name");
	seq_subject_init( &subject, &S);

	g_assert_cmpstr(S.S, ==, "ACGT!TGCA");
	g_assert_cmpuint(S.len, ==, 9 );
	g_assert( FLAGS & F_NON_ACGT);

	g_assert_cmpstr(subject.RS, ==, "TGCA;ACGT#ACGT!TGCA");
	g_assert_cmpuint(subject.RSlen, ==, 9*2+1);

	seq_subject_free( &subject);
	seq_free( &S);

	FLAGS = F_NONE;

}

int main(int argc, char *argv[])
{
	g_test_init( &argc, &argv, NULL);
	g_test_add_func("/seq/basic", test_seq_basic);
	g_test_add_func("/seq/full", test_seq_full);
	g_test_add_func("/seq/non acgt", test_seq_nonacgt);

	return g_test_run();
}