source: trunk/test/dna_reverse_complement.cc @ 3628

Last change on this file since 3628 was 3628, checked in by Peter, 6 years ago

merge release 0.14.2 into trunk

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.3 KB
Line 
1// $Id: dna_reverse_complement.cc 3628 2017-03-08 07:42:41Z peter $
2
3/*
4  Copyright (C) 2016, 2017 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 <config.h>
23
24#include "Suite.h"
25
26#include "yat/omic/algorithm.h"
27
28#include <boost/concept_archetype.hpp>
29#include <boost/iterator/iterator_archetypes.hpp>
30
31using namespace theplu::yat;
32using namespace omic;
33int main(int argc, char* argv[])
34{
35  test::Suite suite(argc, argv);
36
37  std::string random("ACGTATATATAGG");
38  // test that reverse complement (in-place) and copy version yield same results
39  std::string result1(random);
40  dna_reverse_complement(result1.begin(), result1.end());
41  std::string result2;
42  dna_reverse_complement_copy(random.begin(), random.end(),
43                              std::back_inserter(result2));
44  if (result1 != result2) {
45    suite.add(false);
46    suite.err() << "input: " << random << "\n";
47    suite.err() << "dna_reverse_complement: " << result1 << "\n";
48    suite.err() << "dna_reverse_complement_copy: " << result2 << "\n";
49  }
50
51  if (false) { // do not run compiler tests
52    using namespace boost::iterator_archetypes;
53    using boost::iterator_archetype;
54    boost::input_iterator_archetype<char> input;
55    boost::detail::dummy_constructor arg;
56    boost::output_iterator_archetype<char> output(arg);
57    boost::mutable_forward_iterator_archetype<char> forward;
58    boost::mutable_bidirectional_iterator_archetype<char> bidirect;
59
60    boost::iterator_archetype<char
61      , boost::iterator_archetypes::readable_iterator_t
62      , boost::bidirectional_traversal_tag> const_bidirect;
63
64    dna_complement(input, input, output);
65    dna_reverse_complement(bidirect, bidirect);
66    dna_reverse_complement_copy(const_bidirect, const_bidirect, output);
67  }
68
69  return suite.return_value();
70}
Note: See TracBrowser for help on using the repository browser.