diff --git a/tests/beman/iterator_interface/iterator_interface.test.cpp b/tests/beman/iterator_interface/iterator_interface.test.cpp index fb707a1..bc666b1 100644 --- a/tests/beman/iterator_interface/iterator_interface.test.cpp +++ b/tests/beman/iterator_interface/iterator_interface.test.cpp @@ -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 struct filtered_int_iterator : ext_iterator_interface_compat, std::forward_iterator_tag, int> {