Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: rrahn <[email protected]>
  • Loading branch information
smehringer and rrahn authored Oct 15, 2020
1 parent 1242347 commit e8a2067
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
3 changes: 1 addition & 2 deletions include/seqan3/io/alignment_file/format_sam_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,8 @@ inline void format_sam_base::read_field(stream_view_type && stream_view, target_
// and in that case might read `past-the-end` on a second call of std::ranges::begin.
if (auto it = std::ranges::begin(stream_view); it != std::ranges::end(stream_view))
{
char c = *it;
// Write to target if field does not represent an empty string, denoted as single '*' character.
if (!(++it == std::ranges::end(stream_view) && c == '*'))
if (char c = *it; !(++it == std::ranges::end(stream_view) && c == '*'))
{
target.push_back(seqan3::assign_char_to(c, target_range_value_t{}));
std::ranges::copy(std::ranges::subrange<begin_iterator_t, end_iterator_t>{it, std::ranges::end(stream_view)}
Expand Down
10 changes: 2 additions & 8 deletions test/unit/io/alignment_file/format_sam_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,14 +338,8 @@ TEST_F(sam_format, issue2195)
};
seqan3::alignment_file_input fin{istream, seqan3::format_sam{}};

std::vector<seqan3::phred42> expected_quality
{
seqan3::assign_char_to('*', seqan3::phred42{}),
seqan3::assign_char_to('9', seqan3::phred42{}),
seqan3::assign_char_to('<', seqan3::phred42{}),
seqan3::assign_char_to('9', seqan3::phred42{}),
seqan3::assign_char_to(';', seqan3::phred42{})
};
using seqan3::operator""_phred42;
std::vector<seqan3::phred42> expected_quality = "*9<9;"_phred42;

EXPECT_RANGE_EQ(seqan3::get<seqan3::field::id>(*fin.begin()), std::string{"*r1"});
EXPECT_RANGE_EQ(seqan3::get<seqan3::field::qual>(*fin.begin()), expected_quality);
Expand Down

0 comments on commit e8a2067

Please sign in to comment.