diff options
Diffstat (limited to 'libcxx/test/strings/basic.string/string.iterators')
16 files changed, 0 insertions, 821 deletions
diff --git a/libcxx/test/strings/basic.string/string.iterators/begin.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/begin.pass.cpp deleted file mode 100644 index 55f2eb30f80..00000000000 --- a/libcxx/test/strings/basic.string/string.iterators/begin.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <string> - -// iterator begin(); -// const_iterator begin() const; - -#include <string> -#include <cassert> - -#include "min_allocator.h" - -template <class S> -void -test(S s) -{ - const S& cs = s; - typename S::iterator b = s.begin(); - typename S::const_iterator cb = cs.begin(); - if (!s.empty()) - { - assert(*b == s[0]); - } - assert(b == cb); -} - -int main() -{ - { - typedef std::string S; - test(S()); - test(S("123")); - } -#if __cplusplus >= 201103L - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; - test(S()); - test(S("123")); - } -#endif -} diff --git a/libcxx/test/strings/basic.string/string.iterators/cbegin.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/cbegin.pass.cpp deleted file mode 100644 index d0c6ddbb950..00000000000 --- a/libcxx/test/strings/basic.string/string.iterators/cbegin.pass.cpp +++ /dev/null @@ -1,45 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <string> - -// const_iterator cbegin() const; - -#include <string> -#include <cassert> - -#include "min_allocator.h" - -template <class S> -void -test(const S& s) -{ - typename S::const_iterator cb = s.cbegin(); - if (!s.empty()) - { - assert(*cb == s[0]); - } - assert(cb == s.begin()); -} - -int main() -{ - { - typedef std::string S; - test(S()); - test(S("123")); - } -#if __cplusplus >= 201103L - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; - test(S()); - test(S("123")); - } -#endif -} diff --git a/libcxx/test/strings/basic.string/string.iterators/cend.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/cend.pass.cpp deleted file mode 100644 index 6b86d263245..00000000000 --- a/libcxx/test/strings/basic.string/string.iterators/cend.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <string> - -// const_iterator cend() const; - -#include <string> -#include <cassert> - -#include "min_allocator.h" - -template <class S> -void -test(const S& s) -{ - typename S::const_iterator ce = s.cend(); - assert(ce == s.end()); -} - -int main() -{ - { - typedef std::string S; - test(S()); - test(S("123")); - } -#if __cplusplus >= 201103L - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; - test(S()); - test(S("123")); - } -#endif -} diff --git a/libcxx/test/strings/basic.string/string.iterators/crbegin.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/crbegin.pass.cpp deleted file mode 100644 index 6f29f433f31..00000000000 --- a/libcxx/test/strings/basic.string/string.iterators/crbegin.pass.cpp +++ /dev/null @@ -1,45 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <string> - -// const_reverse_iterator crbegin() const; - -#include <string> -#include <cassert> - -#include "min_allocator.h" - -template <class S> -void -test(const S& s) -{ - typename S::const_reverse_iterator cb = s.crbegin(); - if (!s.empty()) - { - assert(*cb == s.back()); - } - assert(cb == s.rbegin()); -} - -int main() -{ - { - typedef std::string S; - test(S()); - test(S("123")); - } -#if __cplusplus >= 201103L - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; - test(S()); - test(S("123")); - } -#endif -} diff --git a/libcxx/test/strings/basic.string/string.iterators/crend.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/crend.pass.cpp deleted file mode 100644 index 1fb422c080a..00000000000 --- a/libcxx/test/strings/basic.string/string.iterators/crend.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <string> - -// const_reverse_iterator crend() const; - -#include <string> -#include <cassert> - -#include "min_allocator.h" - -template <class S> -void -test(const S& s) -{ - typename S::const_reverse_iterator ce = s.crend(); - assert(ce == s.rend()); -} - -int main() -{ - { - typedef std::string S; - test(S()); - test(S("123")); - } -#if __cplusplus >= 201103L - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; - test(S()); - test(S("123")); - } -#endif -} diff --git a/libcxx/test/strings/basic.string/string.iterators/db_iterators_2.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/db_iterators_2.pass.cpp deleted file mode 100644 index 6cac1875ce8..00000000000 --- a/libcxx/test/strings/basic.string/string.iterators/db_iterators_2.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <string> - -// Compare iterators from different containers with <. - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <string> -#include <cassert> -#include <iterator> -#include <exception> -#include <cstdlib> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::string S; - S s1; - S s2; - bool b = s1.begin() < s2.begin(); - assert(false); - } -#if __cplusplus >= 201103L - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; - S s1; - S s2; - bool b = s1.begin() < s2.begin(); - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/strings/basic.string/string.iterators/db_iterators_3.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/db_iterators_3.pass.cpp deleted file mode 100644 index d90387e3a46..00000000000 --- a/libcxx/test/strings/basic.string/string.iterators/db_iterators_3.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <string> - -// Subtract iterators from different containers with <. - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <string> -#include <cassert> -#include <iterator> -#include <exception> -#include <cstdlib> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::string S; - S s1; - S s2; - int i = s1.begin() - s2.begin(); - assert(false); - } -#if __cplusplus >= 201103L - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; - S s1; - S s2; - int i = s1.begin() - s2.begin(); - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/strings/basic.string/string.iterators/db_iterators_4.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/db_iterators_4.pass.cpp deleted file mode 100644 index c4a2d0a4baf..00000000000 --- a/libcxx/test/strings/basic.string/string.iterators/db_iterators_4.pass.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <string> - -// Index iterator out of bounds. - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <string> -#include <cassert> -#include <iterator> -#include <exception> -#include <cstdlib> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::string C; - C c(1, '\0'); - C::iterator i = c.begin(); - assert(i[0] == 0); - assert(i[1] == 0); - assert(false); - } -#if __cplusplus >= 201103L - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> C; - C c(1, '\0'); - C::iterator i = c.begin(); - assert(i[0] == 0); - assert(i[1] == 0); - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/strings/basic.string/string.iterators/db_iterators_5.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/db_iterators_5.pass.cpp deleted file mode 100644 index ce44cb1ba5b..00000000000 --- a/libcxx/test/strings/basic.string/string.iterators/db_iterators_5.pass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <string> - -// Add to iterator out of bounds. - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <string> -#include <cassert> -#include <iterator> -#include <exception> -#include <cstdlib> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::string C; - C c(1, '\0'); - C::iterator i = c.begin(); - i += 1; - assert(i == c.end()); - i = c.begin(); - i += 2; - assert(false); - } -#if __cplusplus >= 201103L - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> C; - C c(1, '\0'); - C::iterator i = c.begin(); - i += 1; - assert(i == c.end()); - i = c.begin(); - i += 2; - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/strings/basic.string/string.iterators/db_iterators_6.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/db_iterators_6.pass.cpp deleted file mode 100644 index 8fab8babc61..00000000000 --- a/libcxx/test/strings/basic.string/string.iterators/db_iterators_6.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <string> - -// Decrement iterator prior to begin. - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <string> -#include <cassert> -#include <iterator> -#include <exception> -#include <cstdlib> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::string C; - C c(1, '\0'); - C::iterator i = c.end(); - --i; - assert(i == c.begin()); - --i; - assert(false); - } -#if __cplusplus >= 201103L - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> C; - C c(1, '\0'); - C::iterator i = c.end(); - --i; - assert(i == c.begin()); - --i; - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/strings/basic.string/string.iterators/db_iterators_7.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/db_iterators_7.pass.cpp deleted file mode 100644 index d1cac07e222..00000000000 --- a/libcxx/test/strings/basic.string/string.iterators/db_iterators_7.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <string> - -// Increment iterator past end. - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <string> -#include <cassert> -#include <iterator> -#include <exception> -#include <cstdlib> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::string C; - C c(1, '\0'); - C::iterator i = c.begin(); - ++i; - assert(i == c.end()); - ++i; - assert(false); - } -#if __cplusplus >= 201103L - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> C; - C c(1, '\0'); - C::iterator i = c.begin(); - ++i; - assert(i == c.end()); - ++i; - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/strings/basic.string/string.iterators/db_iterators_8.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/db_iterators_8.pass.cpp deleted file mode 100644 index 914c77d48c5..00000000000 --- a/libcxx/test/strings/basic.string/string.iterators/db_iterators_8.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <string> - -// Dereference non-dereferenceable iterator. - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <string> -#include <cassert> -#include <iterator> -#include <exception> -#include <cstdlib> - -#include "min_allocator.h" - -int main() -{ - { - typedef std::string C; - C c(1, '\0'); - C::iterator i = c.end(); - char j = *i; - assert(false); - } -#if __cplusplus >= 201103L - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> C; - C c(1, '\0'); - C::iterator i = c.end(); - char j = *i; - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/strings/basic.string/string.iterators/end.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/end.pass.cpp deleted file mode 100644 index 02180bbd73d..00000000000 --- a/libcxx/test/strings/basic.string/string.iterators/end.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <string> - -// iterator end(); -// const_iterator end() const; - -#include <string> -#include <cassert> - -#include "min_allocator.h" - -template <class S> -void -test(S s) -{ - const S& cs = s; - typename S::iterator e = s.end(); - typename S::const_iterator ce = cs.end(); - if (s.empty()) - { - assert(e == s.begin()); - assert(ce == cs.begin()); - } - assert(e - s.begin() == s.size()); - assert(ce - cs.begin() == cs.size()); -} - -int main() -{ - { - typedef std::string S; - test(S()); - test(S("123")); - } -#if __cplusplus >= 201103L - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; - test(S()); - test(S("123")); - } -#endif -} diff --git a/libcxx/test/strings/basic.string/string.iterators/iterators.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/iterators.pass.cpp deleted file mode 100644 index 386cededa53..00000000000 --- a/libcxx/test/strings/basic.string/string.iterators/iterators.pass.cpp +++ /dev/null @@ -1,73 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <string> - -// iterator begin(); -// iterator end(); -// const_iterator begin() const; -// const_iterator end() const; -// const_iterator cbegin() const; -// const_iterator cend() const; - -#include <string> -#include <cassert> - -int main() -{ -#if _LIBCPP_STD_VER > 11 - { // N3644 testing - typedef std::string C; - C::iterator ii1{}, ii2{}; - C::iterator ii4 = ii1; - C::const_iterator cii{}; - assert ( ii1 == ii2 ); - assert ( ii1 == ii4 ); - assert ( ii1 == cii ); - assert ( !(ii1 != ii2 )); - assert ( !(ii1 != cii )); - } - - { // N3644 testing - typedef std::wstring C; - C::iterator ii1{}, ii2{}; - C::iterator ii4 = ii1; - C::const_iterator cii{}; - assert ( ii1 == ii2 ); - assert ( ii1 == ii4 ); - assert ( ii1 == cii ); - assert ( !(ii1 != ii2 )); - assert ( !(ii1 != cii )); - } - - { // N3644 testing - typedef std::u16string C; - C::iterator ii1{}, ii2{}; - C::iterator ii4 = ii1; - C::const_iterator cii{}; - assert ( ii1 == ii2 ); - assert ( ii1 == ii4 ); - assert ( ii1 == cii ); - assert ( !(ii1 != ii2 )); - assert ( !(ii1 != cii )); - } - - { // N3644 testing - typedef std::u32string C; - C::iterator ii1{}, ii2{}; - C::iterator ii4 = ii1; - C::const_iterator cii{}; - assert ( ii1 == ii2 ); - assert ( ii1 == ii4 ); - assert ( ii1 == cii ); - assert ( !(ii1 != ii2 )); - assert ( !(ii1 != cii )); - } -#endif -} diff --git a/libcxx/test/strings/basic.string/string.iterators/rbegin.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/rbegin.pass.cpp deleted file mode 100644 index 0111ad11363..00000000000 --- a/libcxx/test/strings/basic.string/string.iterators/rbegin.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <string> - -// reverse_iterator rbegin(); -// const_reverse_iterator rbegin() const; - -#include <string> -#include <cassert> - -#include "min_allocator.h" - -template <class S> -void -test(S s) -{ - const S& cs = s; - typename S::reverse_iterator b = s.rbegin(); - typename S::const_reverse_iterator cb = cs.rbegin(); - if (!s.empty()) - { - assert(*b == s.back()); - } - assert(b == cb); -} - -int main() -{ - { - typedef std::string S; - test(S()); - test(S("123")); - } -#if __cplusplus >= 201103L - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; - test(S()); - test(S("123")); - } -#endif -} diff --git a/libcxx/test/strings/basic.string/string.iterators/rend.pass.cpp b/libcxx/test/strings/basic.string/string.iterators/rend.pass.cpp deleted file mode 100644 index 750173dc342..00000000000 --- a/libcxx/test/strings/basic.string/string.iterators/rend.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <string> - -// reverse_iterator rend(); -// const_reverse_iterator rend() const; - -#include <string> -#include <cassert> - -#include "min_allocator.h" - -template <class S> -void -test(S s) -{ - const S& cs = s; - typename S::reverse_iterator e = s.rend(); - typename S::const_reverse_iterator ce = cs.rend(); - if (s.empty()) - { - assert(e == s.rbegin()); - assert(ce == cs.rbegin()); - } - assert(e - s.rbegin() == s.size()); - assert(ce - cs.rbegin() == cs.size()); -} - -int main() -{ - { - typedef std::string S; - test(S()); - test(S("123")); - } -#if __cplusplus >= 201103L - { - typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; - test(S()); - test(S("123")); - } -#endif -} |