source: trunk/test/unit/nl/tno/metagenomics/FastaServiceTests.groovy @ 33

Last change on this file since 33 was 33, checked in by robert@…, 12 years ago

Renamed Metagenomics module to MassSequencing? module

File size: 866 bytes
Line 
1package nl.tno.massSequencing
2
3import grails.test.*
4
5class FastaServiceTests extends GrailsUnitTestCase {
6        def fastaService
7       
8    protected void setUp() {
9        super.setUp()
10
11                mockLogging( FastaService.class, true );
12               
13                fastaService = new FastaService();
14
15    }
16
17    protected void tearDown() {
18        super.tearDown()
19    }
20
21    void testCreateTag() {
22                // Simple check for uniqueness on different lengths
23                for( int length = 1; length <= 5; length++ ) {
24                        println "Checking uniqueness on length " + length
25                       
26                        int maxTags = 4 ** length;
27                        List tags = []
28                        for( int tagNum = 0; tagNum < maxTags; tagNum++ ) {
29                                String tag = fastaService.createTag( length, tagNum );
30                                assert tag.size() == length;
31                                tags << tag;
32                        }
33                       
34                        // All tags should be unique
35                        assert tags.unique().size() == tags.size();
36                        assert tags.size() == maxTags
37                }
38
39    }
40}
Note: See TracBrowser for help on using the repository browser.