2 #include <boost/test/unit_test.hpp>     7 BOOST_AUTO_TEST_SUITE(CountingOperatorsTest)
     9 BOOST_AUTO_TEST_CASE( test_counting_operators_map_plus )
    11   using Sequence::operator+;
    12   std::map<char,unsigned> baseCounts,baseCounts2;
    15   baseCounts2[
'A'] = 11;
    16   baseCounts2[
'C'] = 17;
    17   std::map<char,unsigned> baseCounts3 = baseCounts + baseCounts2;
    19   BOOST_REQUIRE_EQUAL( baseCounts3[
'A'], 16 );
    20   BOOST_REQUIRE_EQUAL( baseCounts3[
'G'], 10 );
    21   BOOST_REQUIRE_EQUAL( baseCounts3[
'C'], 17 );
    24 BOOST_AUTO_TEST_CASE( test_counting_operators_map_plus_equal )
    26   using Sequence::operator+=;
    27   std::map<char,unsigned> baseCounts,baseCounts2;
    30   baseCounts2[
'A'] = 11;
    31   baseCounts2[
'C'] = 17;
    32   baseCounts += baseCounts2;
    34   BOOST_REQUIRE_EQUAL( baseCounts[
'A'], 16 );
    35   BOOST_REQUIRE_EQUAL( baseCounts[
'G'], 10 );
    36   BOOST_REQUIRE_EQUAL( baseCounts[
'C'], 17 );
    39 BOOST_AUTO_TEST_CASE( test_counting_operators_vector_plus )
    41   using Sequence::operator+;
    42   std::vector< std::pair<char,unsigned> > baseCounts,baseCounts2;
    43   baseCounts.push_back(std::make_pair(
'A',5u));
    44   baseCounts.push_back(std::make_pair(
'G',10u));
    45   baseCounts2.push_back(std::make_pair(
'A',11u));
    46   baseCounts2.push_back(std::make_pair(
'C',17u));
    48   auto baseCounts3 = baseCounts + baseCounts2;
    50   std::string bases = {
'A',
'G',
'C'};
    52   auto i = std::find_if(baseCounts3.cbegin(),
    54                         [](
const std::pair<char,unsigned> & __p) {
    55                           return __p.first == 
'A';
    57   BOOST_REQUIRE( i != baseCounts3.cend() );
    58   BOOST_REQUIRE_EQUAL( i->second,16 );
    60   i = std::find_if(baseCounts3.cbegin(),
    62                    [](
const std::pair<char,unsigned> & __p) {
    63                      return __p.first == 
'G';
    65   BOOST_REQUIRE( i != baseCounts3.cend() );
    66   BOOST_REQUIRE_EQUAL( i->second,10 );
    68   i = std::find_if(baseCounts3.cbegin(),
    70                    [](
const std::pair<char,unsigned> & __p) {
    71                      return __p.first == 
'C';
    73   BOOST_REQUIRE( i != baseCounts3.cend() );
    74   BOOST_REQUIRE_EQUAL( i->second,17 );
    77 BOOST_AUTO_TEST_SUITE_END()
 Declarations of operators to add associative containers together.