Skip to content

Commit

Permalink
[MISC] Remove 'using namespace seqan3' from test/unit/alphabet/c*.
Browse files Browse the repository at this point in the history
  • Loading branch information
Irallia committed Mar 19, 2020
1 parent 2d9d9c9 commit 6577155
Show file tree
Hide file tree
Showing 9 changed files with 367 additions and 342 deletions.
2 changes: 2 additions & 0 deletions test/unit/alphabet/cigar/cigar_op_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "../semi_alphabet_test_template.hpp"
#include <seqan3/alphabet/cigar/cigar_op.hpp>

using seqan3::operator""_cigar_op;

INSTANTIATE_TYPED_TEST_SUITE_P(cigar_op, alphabet_, seqan3::cigar_op, );
INSTANTIATE_TYPED_TEST_SUITE_P(cigar_op, semi_alphabet_test, seqan3::cigar_op, );
INSTANTIATE_TYPED_TEST_SUITE_P(cigar_op, alphabet_constexpr, seqan3::cigar_op, );
Expand Down
22 changes: 12 additions & 10 deletions test/unit/alphabet/cigar/cigar_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,32 @@
#include "../semi_alphabet_test_template.hpp"
#include "../semi_alphabet_constexpr_test_template.hpp"

using seqan3::get;

INSTANTIATE_TYPED_TEST_SUITE_P(cigar, semi_alphabet_test, seqan3::cigar, );
INSTANTIATE_TYPED_TEST_SUITE_P(cigar, semi_alphabet_constexpr, seqan3::cigar, );

using namespace seqan3;

TEST(cigar, brace_init)
{
cigar c1{uint32_t{223}, 'M'_cigar_op};
EXPECT_EQ(c1.to_string(), small_string<11>{"223M"});
using seqan3::operator""_cigar_op;

seqan3::cigar c1{uint32_t{223}, 'M'_cigar_op};
EXPECT_EQ(c1.to_string(), seqan3::small_string<11>{"223M"});
}

TEST(cigar, to_string)
{
cigar c1{};
seqan3::cigar c1{};

assign_rank_to(uint32_t{223}, get<0>(c1));
assign_char_to('M', get<1>(c1));
EXPECT_EQ(c1.to_string(), small_string<11>{"223M"});
seqan3::assign_rank_to(uint32_t{223}, get<0>(c1));
seqan3::assign_char_to('M', get<1>(c1));
EXPECT_EQ(c1.to_string(), seqan3::small_string<11>{"223M"});
}

TEST(cigar, assign_string)
{
cigar c1{};
seqan3::cigar c1{};
c1.assign_string("223M");
EXPECT_EQ(uint32_t{223}, to_rank(get<0>(c1)));
EXPECT_EQ(uint32_t{223}, seqan3::to_rank(get<0>(c1)));
EXPECT_EQ('M', get<1>(c1).to_char());
}
6 changes: 2 additions & 4 deletions test/unit/alphabet/cigar/debug_stream_cigar_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@

#include <seqan3/alphabet/cigar/cigar.hpp>

using namespace seqan3;

TEST(debug_stream_test, cigar)
{
std::ostringstream o;
debug_stream_type my_stream{o};
seqan3::debug_stream_type my_stream{o};

cigar c1{};
seqan3::cigar c1{};
c1.assign_string("223M");

my_stream << c1;
Expand Down
25 changes: 14 additions & 11 deletions test/unit/alphabet/composite/alphabet_tuple_base_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,44 @@
#include "../semi_alphabet_test_template.hpp"
#include "alphabet_tuple_base_test_template.hpp"

using namespace seqan3;
using seqan3::operator""_dna4;
using seqan3::operator""_dna5;
using seqan3::operator""_rna4;
using seqan3::operator""_rna5;

template <typename type1, typename type2>
struct test_composite : public alphabet_tuple_base<test_composite<type1, type2>, type1, type2>
struct test_composite : public seqan3::alphabet_tuple_base<test_composite<type1, type2>, type1, type2>
{
using base_t = alphabet_tuple_base<test_composite<type1, type2>, type1, type2>;
using base_t = seqan3::alphabet_tuple_base<test_composite<type1, type2>, type1, type2>;
using base_t::base_t;
using base_t::operator=;
};

template <>
class alphabet_tuple_base_test<test_composite<dna4, dna5>> : public ::testing::Test
class alphabet_tuple_base_test<test_composite<seqan3::dna4, seqan3::dna5>> : public ::testing::Test
{
public:
using T = test_composite<dna4, dna5>;
using T = test_composite<seqan3::dna4, seqan3::dna5>;

T instance = T{value_1(), value_2()};
T zero_instance = T{decltype(value_1()){}, decltype(value_2()){}};
size_t tup_size{2};

// test_composite<dna4, dna5>
// test_composite<seqan3::dna4, seqan3::dna5>
// -------------------------------------------------------------------------
dna4 value_1()
seqan3::dna4 value_1()
{
return 'G'_dna4;
}
rna4 assignable_to_value_1()
seqan3::rna4 assignable_to_value_1()
{
return 'G'_rna4;
}
dna5 value_2()
seqan3::dna5 value_2()
{
return 'G'_dna5;
}
rna5 assignable_to_value_2()
seqan3::rna5 assignable_to_value_2()
{
return 'G'_rna5;
}
Expand All @@ -60,7 +63,7 @@ class alphabet_tuple_base_test<test_composite<dna4, dna5>> : public ::testing::T
}
};

using test_composite_types = ::testing::Types<test_composite<dna4, dna5>>;
using test_composite_types = ::testing::Types<test_composite<seqan3::dna4, seqan3::dna5>>;

INSTANTIATE_TYPED_TEST_SUITE_P(test_composite, semi_alphabet_test, test_composite_types, );
INSTANTIATE_TYPED_TEST_SUITE_P(test_composite, alphabet_tuple_base_test, test_composite_types, );
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <seqan3/alphabet/composite/alphabet_tuple_base.hpp>
#include <seqan3/core/concept/tuple.hpp>

using namespace seqan3;
using seqan3::get;

template <typename T>
class alphabet_tuple_base_test : public ::testing::Test {};
Expand All @@ -19,7 +19,7 @@ TYPED_TEST_SUITE_P(alphabet_tuple_base_test);

TYPED_TEST_P(alphabet_tuple_base_test, concept_check)
{
EXPECT_TRUE(tuple_like<TypeParam>);
EXPECT_TRUE(seqan3::tuple_like<TypeParam>);
}

// default/zero construction
Expand Down
32 changes: 17 additions & 15 deletions test/unit/alphabet/composite/alphabet_variant_detail_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,35 @@
#include <seqan3/alphabet/nucleotide/dna4.hpp>
#include <seqan3/alphabet/nucleotide/dna5.hpp>

using namespace seqan3;

template <typename ...alphabet_types>
class detail_alphabet_variant : public alphabet_variant<alphabet_types...>
class detail_alphabet_variant : public seqan3::alphabet_variant<alphabet_types...>
{
public:
using alphabet_variant<alphabet_types...>::partial_sum_sizes;
using alphabet_variant<alphabet_types...>::rank_to_char;
using alphabet_variant<alphabet_types...>::char_to_rank;
using seqan3::alphabet_variant<alphabet_types...>::partial_sum_sizes;
using seqan3::alphabet_variant<alphabet_types...>::rank_to_char;
using seqan3::alphabet_variant<alphabet_types...>::char_to_rank;
};

TEST(alphabet_variant_detail_test, partial_sum_sizes)
{
constexpr std::array partial_sum2 = detail_alphabet_variant<dna4, gap>::partial_sum_sizes;
constexpr std::array partial_sum2 = detail_alphabet_variant<seqan3::dna4, seqan3::gap>::partial_sum_sizes;
EXPECT_EQ(partial_sum2.size(), 3u);
EXPECT_EQ(partial_sum2[0], 0);
EXPECT_EQ(partial_sum2[1], 4);
EXPECT_EQ(partial_sum2[2], 5);

constexpr std::array partial_sum3 = detail_alphabet_variant<dna4, gap, dna5>::partial_sum_sizes;
constexpr std::array partial_sum3 = detail_alphabet_variant<seqan3::dna4,
seqan3::gap,
seqan3::dna5>::partial_sum_sizes;
EXPECT_EQ(partial_sum3.size(), 4u);
EXPECT_EQ(partial_sum3[0], 0);
EXPECT_EQ(partial_sum3[1], 4);
EXPECT_EQ(partial_sum3[2], 5);
EXPECT_EQ(partial_sum3[3], 10);

constexpr std::array partial_sum4 = detail_alphabet_variant<dna5, gap, dna4>::partial_sum_sizes;
constexpr std::array partial_sum4 = detail_alphabet_variant<seqan3::dna5,
seqan3::gap,
seqan3::dna4>::partial_sum_sizes;
EXPECT_EQ(partial_sum4.size(), 4u);
EXPECT_EQ(partial_sum4[0], 0);
EXPECT_EQ(partial_sum4[1], 5);
Expand All @@ -50,15 +52,15 @@ TEST(alphabet_variant_detail_test, partial_sum_sizes)

TEST(alphabet_variant_detail_test, rank_to_char)
{
constexpr std::array rank_to_char2 = detail_alphabet_variant<dna4, gap>::rank_to_char;
constexpr std::array rank_to_char2 = detail_alphabet_variant<seqan3::dna4, seqan3::gap>::rank_to_char;
EXPECT_EQ(rank_to_char2.size(), 5u);
EXPECT_EQ(rank_to_char2[0], 'A');
EXPECT_EQ(rank_to_char2[1], 'C');
EXPECT_EQ(rank_to_char2[2], 'G');
EXPECT_EQ(rank_to_char2[3], 'T');
EXPECT_EQ(rank_to_char2[4], '-');

constexpr std::array rank_to_char3 = detail_alphabet_variant<dna4, gap, dna5>::rank_to_char;
constexpr std::array rank_to_char3 = detail_alphabet_variant<seqan3::dna4, seqan3::gap, seqan3::dna5>::rank_to_char;
EXPECT_EQ(rank_to_char3.size(), 10u);
EXPECT_EQ(rank_to_char3[0], 'A');
EXPECT_EQ(rank_to_char3[1], 'C');
Expand All @@ -71,7 +73,7 @@ TEST(alphabet_variant_detail_test, rank_to_char)
EXPECT_EQ(rank_to_char3[8], 'N');
EXPECT_EQ(rank_to_char3[9], 'T');

constexpr std::array rank_to_char4 = detail_alphabet_variant<dna5, gap, dna4>::rank_to_char;
constexpr std::array rank_to_char4 = detail_alphabet_variant<seqan3::dna5, seqan3::gap, seqan3::dna4>::rank_to_char;
EXPECT_EQ(rank_to_char4.size(), 10u);
EXPECT_EQ(rank_to_char4[0], 'A');
EXPECT_EQ(rank_to_char4[1], 'C');
Expand All @@ -87,15 +89,15 @@ TEST(alphabet_variant_detail_test, rank_to_char)

TEST(alphabet_variant_detail_test, char_to_rank)
{
constexpr std::array char_to_rank2 = detail_alphabet_variant<dna4, gap>::char_to_rank;
constexpr std::array char_to_rank2 = detail_alphabet_variant<seqan3::dna4, seqan3::gap>::char_to_rank;
EXPECT_EQ(char_to_rank2.size(), 256u);
EXPECT_EQ(char_to_rank2['A'], 0);
EXPECT_EQ(char_to_rank2['C'], 1);
EXPECT_EQ(char_to_rank2['G'], 2);
EXPECT_EQ(char_to_rank2['T'], 3);
EXPECT_EQ(char_to_rank2['-'], 4);

constexpr std::array char_to_rank3 = detail_alphabet_variant<dna4, gap, dna5>::char_to_rank;
constexpr std::array char_to_rank3 = detail_alphabet_variant<seqan3::dna4, seqan3::gap, seqan3::dna5>::char_to_rank;
EXPECT_EQ(char_to_rank3.size(), 256u);
EXPECT_EQ(char_to_rank3['A'], 0);
EXPECT_EQ(char_to_rank3['C'], 1);
Expand All @@ -108,7 +110,7 @@ TEST(alphabet_variant_detail_test, char_to_rank)
EXPECT_EQ(char_to_rank3['N'], 8);
EXPECT_EQ(char_to_rank3['T'], 3);

constexpr std::array char_to_rank4 = detail_alphabet_variant<dna5, gap, dna4>::char_to_rank;
constexpr std::array char_to_rank4 = detail_alphabet_variant<seqan3::dna5, seqan3::gap, seqan3::dna4>::char_to_rank;
EXPECT_EQ(char_to_rank4.size(), 256u);
EXPECT_EQ(char_to_rank4['A'], 0);
EXPECT_EQ(char_to_rank4['C'], 1);
Expand Down
Loading

0 comments on commit 6577155

Please sign in to comment.