2368 |
11 Dec 10 |
peter |
// $Id$ |
2368 |
11 Dec 10 |
peter |
2 |
|
2368 |
11 Dec 10 |
peter |
3 |
/* |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2010, 2011, 2012 Peter Johansson |
2368 |
11 Dec 10 |
peter |
5 |
|
2368 |
11 Dec 10 |
peter |
This file is part of the yat library, http://dev.thep.lu.se/yat |
2368 |
11 Dec 10 |
peter |
7 |
|
2368 |
11 Dec 10 |
peter |
The yat library is free software; you can redistribute it and/or |
2368 |
11 Dec 10 |
peter |
modify it under the terms of the GNU General Public License as |
2368 |
11 Dec 10 |
peter |
published by the Free Software Foundation; either version 3 of the |
2368 |
11 Dec 10 |
peter |
License, or (at your option) any later version. |
2368 |
11 Dec 10 |
peter |
12 |
|
2368 |
11 Dec 10 |
peter |
The yat library is distributed in the hope that it will be useful, |
2368 |
11 Dec 10 |
peter |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
2368 |
11 Dec 10 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2368 |
11 Dec 10 |
peter |
General Public License for more details. |
2368 |
11 Dec 10 |
peter |
17 |
|
2368 |
11 Dec 10 |
peter |
You should have received a copy of the GNU General Public License |
2368 |
11 Dec 10 |
peter |
along with yat. If not, see <http://www.gnu.org/licenses/>. |
2368 |
11 Dec 10 |
peter |
20 |
*/ |
2368 |
11 Dec 10 |
peter |
21 |
|
2881 |
18 Nov 12 |
peter |
22 |
#include <config.h> |
2881 |
18 Nov 12 |
peter |
23 |
|
2368 |
11 Dec 10 |
peter |
24 |
#include "Suite.h" |
2368 |
11 Dec 10 |
peter |
25 |
|
2368 |
11 Dec 10 |
peter |
26 |
#include "yat/omic/Codon.h" |
2368 |
11 Dec 10 |
peter |
27 |
|
2368 |
11 Dec 10 |
peter |
28 |
using namespace theplu::yat; |
2368 |
11 Dec 10 |
peter |
29 |
|
2368 |
11 Dec 10 |
peter |
30 |
int main(int argc,char* argv[]) |
3251 |
04 Jun 14 |
peter |
31 |
{ |
2368 |
11 Dec 10 |
peter |
32 |
test::Suite suite(argc, argv); |
2368 |
11 Dec 10 |
peter |
33 |
using omic::Codon; |
2369 |
11 Dec 10 |
peter |
34 |
using omic::DNA; |
3251 |
04 Jun 14 |
peter |
35 |
|
2368 |
11 Dec 10 |
peter |
36 |
Codon c1; |
2369 |
11 Dec 10 |
peter |
37 |
Codon c2("ATG"); |
2369 |
11 Dec 10 |
peter |
38 |
DNA a('A'); |
2369 |
11 Dec 10 |
peter |
39 |
c1 = Codon(a,a,a); |
2369 |
11 Dec 10 |
peter |
40 |
if (!suite.add(c1.amino_acid()=='K')) { |
2369 |
11 Dec 10 |
peter |
41 |
suite.err() << "error: amino_acid() returned: " << c1.amino_acid() |
2369 |
11 Dec 10 |
peter |
42 |
<< "\n"; |
2369 |
11 Dec 10 |
peter |
43 |
suite.err() << "expected: L\n"; |
3251 |
04 Jun 14 |
peter |
44 |
} |
2369 |
11 Dec 10 |
peter |
45 |
std::string correct("ATG"); |
2369 |
11 Dec 10 |
peter |
46 |
for (size_t i=0; i<3; ++i) { |
2369 |
11 Dec 10 |
peter |
47 |
if (!suite.add(c2(i)==DNA(correct[i]))) |
2369 |
11 Dec 10 |
peter |
48 |
suite.err() << "error: (" << i << ") returned: " << c2(i) <<"\n" |
2369 |
11 Dec 10 |
peter |
49 |
<< "expected: " << correct[i] << "\n"; |
2369 |
11 Dec 10 |
peter |
50 |
} |
2368 |
11 Dec 10 |
peter |
51 |
|
2369 |
11 Dec 10 |
peter |
52 |
if (!suite.add(c2.start())) |
2369 |
11 Dec 10 |
peter |
53 |
suite.err() << "error: expected start() to return true\n"; |
2369 |
11 Dec 10 |
peter |
54 |
if (!suite.add(!c2.stop())) |
2369 |
11 Dec 10 |
peter |
55 |
suite.err() << "error: expected end() to return false\n"; |
2369 |
11 Dec 10 |
peter |
56 |
|
2470 |
12 Apr 11 |
peter |
57 |
if (!suite.add(Codon("ATG").amino_acid()=='M')) |
3251 |
04 Jun 14 |
peter |
58 |
suite.err() << "error: Codon(\"ATG\").amino_acid() returns: `" |
2470 |
12 Apr 11 |
peter |
59 |
<< Codon("ATG").amino_acid() << "'\n"; |
2470 |
12 Apr 11 |
peter |
60 |
|
2470 |
12 Apr 11 |
peter |
61 |
if (!suite.add(Codon("ATG").start())) |
3251 |
04 Jun 14 |
peter |
62 |
suite.err() << "error: Codon(\"ATG\").start() returns: false\n"; |
2470 |
12 Apr 11 |
peter |
63 |
|
2368 |
11 Dec 10 |
peter |
64 |
return suite.return_value(); |
2368 |
11 Dec 10 |
peter |
65 |
} |