source: trunk/test/codon.cc @ 2370

Last change on this file since 2370 was 2370, checked in by Peter, 12 years ago

closes #646

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1// $Id: codon.cc 2370 2010-12-11 04:00:49Z peter $
2
3/*
4  Copyright (C) 2010 Peter Johansson
5
6  This file is part of the yat library, http://dev.thep.lu.se/yat
7
8  The yat library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 3 of the
11  License, or (at your option) any later version.
12
13  The yat library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with yat. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22#include "Suite.h"
23
24#include "yat/omic/Codon.h"
25
26using namespace theplu::yat;
27
28int main(int argc,char* argv[])
29{ 
30  test::Suite suite(argc, argv);
31  using omic::Codon;
32  using omic::DNA;
33 
34  Codon c1;
35  Codon c2("ATG");
36  DNA a('A');
37  c1 = Codon(a,a,a);
38  if (!suite.add(c1.amino_acid()=='K')) {
39    suite.err() << "error: amino_acid() returned: " << c1.amino_acid()
40                << "\n";
41    suite.err() << "expected: L\n";
42  } 
43  std::string correct("ATG");
44  for (size_t i=0; i<3; ++i) {
45    if (!suite.add(c2(i)==DNA(correct[i])))
46      suite.err() << "error: (" << i << ") returned: " << c2(i) <<"\n"
47                  << "expected: " << correct[i] << "\n";
48  }
49
50  if (!suite.add(c2.start()))
51    suite.err() << "error: expected start() to return true\n";
52  if (!suite.add(!c2.stop()))
53    suite.err() << "error: expected end() to return false\n";
54
55  return suite.return_value();
56}
Note: See TracBrowser for help on using the repository browser.