diff --git a/test/test_iterator.cpp b/test/test_iterator.cpp index a1aab8ea..1f6cc1e6 100644 --- a/test/test_iterator.cpp +++ b/test/test_iterator.cpp @@ -14,6 +14,7 @@ #include "doctest/doctest.h" +#include #include #include @@ -241,4 +242,28 @@ namespace sparrow CHECK(valid); } } + + TEST_SUITE("pointer_iterator") + { + TEST_CASE("make_pointer_iterator") + { + std::array a = { 2, 4, 6 }; + auto iter = make_pointer_iterator(a.begin()); + CHECK_EQ(*iter, a[0]); + ++iter; + CHECK_EQ(*iter, a[1]); + ++iter; + CHECK_EQ(*iter, a[2]); + } + + TEST_CASE("const conversion") + { + std::array a = { 2, 4, 6 }; + using iterator = pointer_iterator; + using const_iterator = pointer_iterator; + + const_iterator iter{a.begin()}; + CHECK_EQ(*iter, a[0]); + } + } }