]> git.donarmstrong.com Git - biopieces.git/blob - code_c/Maasha/src/test/test_fasta.c
removed commented out stale code
[biopieces.git] / code_c / Maasha / src / test / test_fasta.c
1 /* Martin Asser Hansen (mail@maasha.dk) Copyright (C) 2008 - All right reserved */
2
3 #include "common.h"
4 #include "filesys.h"
5 #include "mem.h"
6 #include "seq.h"
7 #include "fasta.h"
8
9 #define TEST_FILE1 "test/test_files/test.fna"
10 #define TEST_FILE2 "/Users/m.hansen/DATA/genomes/hg18/hg18.fna"
11 #define TEST_COUNT 10
12 #define TEST_SIZE  10
13
14 static void test_fasta_get_entry();
15 static void test_fasta_put_entry();
16
17
18 int main()
19 {
20     fprintf( stderr, "Running all tests for fasta.c\n" );
21
22     test_fasta_get_entry();
23     test_fasta_put_entry();
24
25     fprintf( stderr, "Done\n\n" );
26
27     return EXIT_SUCCESS;
28 }
29
30
31 void test_fasta_get_entry()
32 {
33     fprintf( stderr, "   Testing fasta_get_entry ... " );
34
35     FILE *fp            = NULL;
36     seq_entry *entry    = NULL;
37     size_t max_seq_name = MAX_SEQ_NAME;
38     size_t max_seq      = MAX_SEQ;
39
40     fp = read_open( TEST_FILE1 );
41
42     entry = seq_new( max_seq_name, max_seq );
43
44     while ( ( fasta_get_entry( fp, &entry ) != FALSE ) ) {
45 //        printf( "seq_name: %s seq_len: %zu\n", entry->seq_name, entry->seq_len );
46     }
47
48     seq_destroy( entry );
49
50     close_stream( fp );
51
52     fprintf( stderr, "OK\n" );
53 }
54
55
56 void test_fasta_put_entry()
57 {
58     fprintf( stderr, "   Testing fasta_put_entry ... " );
59
60     FILE *fp            = NULL;
61     seq_entry *entry    = NULL;
62     size_t max_seq_name = MAX_SEQ_NAME;
63     size_t max_seq      = MAX_SEQ;
64
65     fp = read_open( TEST_FILE1 );
66
67     entry = seq_new( max_seq_name, max_seq );
68
69     while ( ( fasta_get_entry( fp, &entry ) != FALSE ) ) {
70 //        fasta_put_entry( entry );
71     }
72
73     seq_destroy( entry );
74
75     close_stream( fp );
76
77     fprintf( stderr, "OK\n" );
78 }
79
80