libsequence  1.9.5
FastaConstructors.cc
1 
3 #include <Sequence/Fasta.hpp>
4 #include <string>
5 #include <boost/test/unit_test.hpp>
6 #include <iostream>
7 #include <functional>
8 
10 {
11  std::string name, seq;
13  : name{ "seqname" }, seq{ "AGCGTAGACAGTAGAGTGAT" }
14  {
15  }
16 };
17 
18 BOOST_FIXTURE_TEST_SUITE(FastaConstructorsTest, fasta_constructors_fixture)
19 
20 BOOST_AUTO_TEST_CASE(empty)
21 {
23  BOOST_REQUIRE(f.name.empty());
24  BOOST_REQUIRE(f.seq.empty());
25 }
26 
27 BOOST_AUTO_TEST_CASE(string_con)
28 {
29  Sequence::Fasta f = Sequence::Fasta(name, seq);
30  BOOST_CHECK(f.name == name);
31  BOOST_CHECK(f.seq == seq);
32 }
33 
34 BOOST_AUTO_TEST_CASE(copy_con)
35 {
36  Sequence::Fasta f = Sequence::Fasta(name.c_str(), seq.c_str());
37  BOOST_CHECK(f.name == name);
38  BOOST_CHECK(f.seq == seq);
39 
40  Sequence::Fasta f2(f);
41  BOOST_REQUIRE(f == f2);
42 }
43 
44 BOOST_AUTO_TEST_CASE(move_con)
45 {
46  Sequence::Fasta f = Sequence::Fasta(name.c_str(), seq.c_str());
47  BOOST_CHECK(f.name == name);
48  BOOST_CHECK(f.seq == seq);
49 
50  Sequence::Fasta f2(std::move(f));
51  BOOST_CHECK(f2.name == name);
52  BOOST_CHECK(f2.seq == seq);
53  BOOST_CHECK(f.length() == 0);
54  BOOST_CHECK(f.name.empty());
55 }
56 
57 BOOST_AUTO_TEST_CASE(move_con2)
58 //This "should" work???
59 {
60  std::string a(name), b(seq);
61  Sequence::Fasta f = Sequence::Fasta(std::move(a), std::move(b));
62  BOOST_CHECK(f.name == name);
63  BOOST_CHECK(f.seq == seq);
64  BOOST_CHECK(a.empty());
65  BOOST_CHECK(b.empty());
66 }
67 
68 BOOST_AUTO_TEST_CASE(move_assign)
69 {
70  Sequence::Fasta f = Sequence::Fasta(name, seq);
71  BOOST_CHECK(f.name == name);
72  BOOST_CHECK(f.seq == seq);
73 
74  Sequence::Fasta f2;
75  f2 = std::move(f);
76  BOOST_CHECK(f2.name == name);
77  BOOST_CHECK(f2.seq == seq);
78  BOOST_CHECK(f.length() == 0);
79  BOOST_CHECK(f.name.empty());
80 }
81 BOOST_AUTO_TEST_SUITE_END()
82 //EOF
FASTA sequence stream.
Definition: Fasta.hpp:49
\ file FastaConstructors.cc
size_type length(void) const
Definition: Seq.cc:58
Declaration of Sequence::Fasta streams.