Skip to content

Commit

Permalink
tests: Add unit tests for repeated_chars_iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
RaduNichita committed Nov 14, 2024
1 parent fed466b commit f9a47b7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/beman/iterator_interface/iterator_interface.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ TEST(IteratorTest, TestRepeatedChars) {
ASSERT_EQ(result, "foofoof");
}

TEST(IteratorTest, TestDistance) {
repeated_chars_iterator first("foo", 3, 0); // 3 is the length of "foo", 0 is this iterator's position.
repeated_chars_iterator last("foo", 3, 3); // 3 is the length of "foo", 3 is this iterator's position.
ASSERT_EQ(std::distance(first, last), 3);
}

TEST(IteratorTest, TestLoop) {
repeated_chars_iterator first("foo", 3, 0); // 3 is the length of "foo", 0 is this iterator's position.
repeated_chars_iterator last("foo", 3, 3); // 3 is the length of "foo", 3 is this iterator's position.
ASSERT_EQ(std::next(first, 3), last);
}

template <typename Pred>
struct filtered_int_iterator
: ext_iterator_interface_compat<filtered_int_iterator<Pred>, std::forward_iterator_tag, int> {
Expand Down

0 comments on commit f9a47b7

Please sign in to comment.