]> git.donarmstrong.com Git - biopieces.git/blob - code_c/Maasha/src/test/test_seq.c
bipartite_scan.c alpha
[biopieces.git] / code_c / Maasha / src / test / test_seq.c
1 #include "common.h"
2 #include "mem.h"
3 #include "seq.h"
4
5 static void test_seq_new();
6 static void test_seq_uppercase();
7 static void test_seq_destroy();
8
9
10 int main()
11 {
12     fprintf( stderr, "Running all tests for seq.c\n" );
13
14     test_seq_new();
15     test_seq_uppercase();
16     test_seq_destroy();
17
18     fprintf( stderr, "Done\n\n" );
19
20     return EXIT_SUCCESS;
21 }
22
23
24 void test_seq_new()
25 {
26     fprintf( stderr, "   Testing seq_new ... " );
27
28     seq_entry *entry        = NULL;
29     size_t     max_seq_name = MAX_SEQ_NAME;
30     size_t     max_seq      = MAX_SEQ;
31
32     entry = seq_new( max_seq_name, max_seq );
33
34     assert( entry->seq_name != NULL );
35     assert( entry->seq      != NULL );
36     assert( entry->seq_len  == 0 );
37
38     seq_destroy( entry );
39
40     fprintf( stderr, "OK\n" );
41 }
42
43
44 void test_seq_uppercase()
45 {
46     fprintf( stderr, "   Testing seq_uppercase ... " );
47
48     char   seq[] = "atcg";
49
50     seq_uppercase( seq );
51
52     assert( strcmp( seq, "ATCG" ) == 0 );
53
54     fprintf( stderr, "OK\n" );
55 }
56
57
58 void test_seq_destroy()
59 {
60     fprintf( stderr, "   Testing seq_destroy ... " );
61
62     seq_entry *entry        = NULL;
63     size_t     max_seq_name = MAX_SEQ_NAME;
64     size_t     max_seq      = MAX_SEQ;
65
66     entry = seq_new( max_seq_name, max_seq );
67
68     assert( entry->seq_name != NULL );
69     assert( entry->seq      != NULL );
70     assert( entry->seq_len  == 0 );
71
72     seq_destroy( entry );
73
74     fprintf( stderr, "OK\n" );
75 }
76
77