Skip to content

Commit

Permalink
[TEST] Increase code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
eseiler committed Jul 5, 2019
1 parent 3b7cd9b commit 31d8fe9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 0 additions & 2 deletions include/seqan3/range/container/dynamic_bitset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1425,8 +1425,6 @@ class dynamic_bitset
for (std::streamsize n = num_char; n > 0 && (is.peek() == is.widen('0') || is.peek() == is.widen('1')); --n)
{
char c = is.get();
if (is.eof())
break;
c == is.widen('0') ? arg.insert(arg.cbegin(), false) : arg.insert(arg.cbegin(), true);
}

Expand Down
11 changes: 8 additions & 3 deletions test/unit/range/container/dynamic_bitset_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ TEST(dynamic_bitset, standard_construction)
EXPECT_TRUE((std::is_move_assignable_v<dynamic_bitset<58>>));
EXPECT_TRUE((std::is_trivially_move_assignable_v<dynamic_bitset<58>>));
EXPECT_TRUE((std::is_nothrow_move_assignable_v<dynamic_bitset<58>>));
EXPECT_THROW(dynamic_bitset{std::numeric_limits<uint64_t>::max()}, std::invalid_argument);
EXPECT_THROW(dynamic_bitset{"10101011x0101"}, std::invalid_argument);
}

TEST(dynamic_bitset, concepts)
Expand Down Expand Up @@ -284,7 +286,7 @@ constexpr bool access_test()

dynamic_bitset t1{0b1111'0000'0000'0000};
dynamic_bitset const t2{0b1111'0000'0000'0000};
dynamic_bitset expected{0b0111'0000'0000'0011};
dynamic_bitset expected{0b0111'0000'0000'0001};
expected.resize(t1.size());

for (size_t i = 0u; i < t1.size() - 4u; ++i)
Expand All @@ -306,9 +308,11 @@ constexpr bool access_test()

t1[1] = true;
res &= t1 == dynamic_bitset{0b1111'0000'0000'0010};
t1.at(1) = false;
res &= t1 == t2;

t1.front() = true;
res &= t1 == dynamic_bitset{0b1111'0000'0000'0011};
res &= t1 == dynamic_bitset{0b1111'0000'0000'0001};

t1.back() = false;
res &= t1 == expected;
Expand Down Expand Up @@ -556,6 +560,7 @@ constexpr bool insert_test()
t0.insert(t0.cend(), 3, true);
t0.insert(t0.cbegin() + 1, false);
t0.insert(t0.cbegin() + 3, 2, false);
t0.insert(t0.cbegin() + 3, 0, false);
res &= t0 == t1;

return res;
Expand Down Expand Up @@ -721,7 +726,7 @@ TEST(dynamic_bitset, input)
}

{ // eof before capacity reached
dynamic_bitset t1{""};
dynamic_bitset t1{};
std::istringstream is{"00110001"};
is >> t1;
EXPECT_EQ(t1, dynamic_bitset{"00110001"});
Expand Down

0 comments on commit 31d8fe9

Please sign in to comment.