File: testfastqread.cpp

package info (click to toggle)
mothur 1.48.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,692 kB
  • sloc: cpp: 161,866; makefile: 122; sh: 31
file content (49 lines) | stat: -rw-r--r-- 1,759 bytes parent folder | download | duplicates (4)
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
//
//  testfastqread.cpp
//  Mothur
//
//  Created by Sarah Westcott on 3/29/16.
//  Copyright (c) 2016 Schloss Lab. All rights reserved.
//

#include "testfastqread.h"
#include "dataset.h"

/**************************************************************************************************/
TestFastqRead::TestFastqRead() {  //setup
    m = MothurOut::getInstance();
    TestFastqDataSet data;
    reads = data.getForwardFastq();
    filenames = data.getSubsetFRFastq(100);
}
/**************************************************************************************************/
TestFastqRead::~TestFastqRead() {
    for (int i = 0; i < filenames.size(); i++) { util.mothurRemove(filenames[i]); }
     //teardown
}
/**************************************************************************************************/
//Using ATGCGTCATC & 40 39 38 37 36 35 34 33 32 31
TEST(Test_Container_FastqRead, FastqReadConstructor) {
    TestFastqRead testFastq;
    
    vector<int> scores; for (int i = 31; i < 41; i++) { scores.push_back(i); }
    Sequence seq("testSeq", "ATGCGTCATC");
    QualityScores qual("testSeq", scores);
    FastqRead read(seq, qual);
    
    EXPECT_EQ(read.getSeq(), "ATGCGTCATC");
    EXPECT_EQ(read.getScores()[0], 31);
}

TEST(Test_Container_FastqRead, FastqReadFromFileConstructor) {
    TestFastqRead testFastq;
        
    ifstream in; bool ignore; string format = "illumina1.8+";
    Utils util; util.openInputFile(testFastq.filenames[0], in);
        
    FastqRead read(in, ignore, format);
    
    EXPECT_EQ(read.getSeq(), (testFastq.reads[0]).getSeq());
    EXPECT_EQ(read.getScores()[0], testFastq.reads[0].getScores()[0]);
}
/**************************************************************************************************/