From 5a83710e371fe68a06e6e3876c6a2c8b820a8976 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sat, 20 Dec 2014 01:40:03 +0000 Subject: Move test into test/std subdirectory. llvm-svn: 224658 --- .../assign2.pass.cpp | 28 ++++++++++++++ .../assign3.pass.cpp | 29 ++++++++++++++ .../compare.pass.cpp | 44 ++++++++++++++++++++++ .../copy.pass.cpp | 29 ++++++++++++++ .../eof.pass.cpp | 24 ++++++++++++ .../eq.pass.cpp | 28 ++++++++++++++ .../eq_int_type.pass.cpp | 30 +++++++++++++++ .../find.pass.cpp | 29 ++++++++++++++ .../length.pass.cpp | 30 +++++++++++++++ .../lt.pass.cpp | 28 ++++++++++++++ .../move.pass.cpp | 33 ++++++++++++++++ .../not_eof.pass.cpp | 30 +++++++++++++++ .../to_char_type.pass.cpp | 28 ++++++++++++++ .../to_int_type.pass.cpp | 28 ++++++++++++++ .../types.pass.cpp | 33 ++++++++++++++++ 15 files changed, 451 insertions(+) create mode 100644 libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign2.pass.cpp create mode 100644 libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign3.pass.cpp create mode 100644 libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/compare.pass.cpp create mode 100644 libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/copy.pass.cpp create mode 100644 libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eof.pass.cpp create mode 100644 libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp create mode 100644 libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq_int_type.pass.cpp create mode 100644 libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/find.pass.cpp create mode 100644 libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/length.pass.cpp create mode 100644 libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp create mode 100644 libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/move.pass.cpp create mode 100644 libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/not_eof.pass.cpp create mode 100644 libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_char_type.pass.cpp create mode 100644 libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_int_type.pass.cpp create mode 100644 libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/types.pass.cpp (limited to 'libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t') diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign2.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign2.pass.cpp new file mode 100644 index 00000000000..35dcd9602d3 --- /dev/null +++ b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign2.pass.cpp @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// template<> struct char_traits + +// static void assign(char_type& c1, const char_type& c2); + +#include +#include + +int main() +{ +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L + char32_t c = U'\0'; + std::char_traits::assign(c, U'a'); + assert(c == U'a'); +#endif +#endif // _LIBCPP_HAS_NO_UNICODE_CHARS +} diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign3.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign3.pass.cpp new file mode 100644 index 00000000000..cce0420be85 --- /dev/null +++ b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/assign3.pass.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// template<> struct char_traits + +// static char_type* assign(char_type* s, size_t n, char_type a); + +#include +#include + +int main() +{ +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS + char32_t s1[] = {1, 2, 3}; + char32_t s2[3] = {0}; + assert(std::char_traits::assign(s2, 3, char32_t(5)) == s2); + assert(s2[0] == char32_t(5)); + assert(s2[1] == char32_t(5)); + assert(s2[2] == char32_t(5)); +#endif // _LIBCPP_HAS_NO_UNICODE_CHARS +} diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/compare.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/compare.pass.cpp new file mode 100644 index 00000000000..ee3019cf274 --- /dev/null +++ b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/compare.pass.cpp @@ -0,0 +1,44 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// template<> struct char_traits + +// static int compare(const char_type* s1, const char_type* s2, size_t n); + +#include +#include + +int main() +{ +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L + assert(std::char_traits::compare(U"", U"", 0) == 0); + + assert(std::char_traits::compare(U"1", U"1", 1) == 0); + assert(std::char_traits::compare(U"1", U"2", 1) < 0); + assert(std::char_traits::compare(U"2", U"1", 1) > 0); + + assert(std::char_traits::compare(U"12", U"12", 2) == 0); + assert(std::char_traits::compare(U"12", U"13", 2) < 0); + assert(std::char_traits::compare(U"12", U"22", 2) < 0); + assert(std::char_traits::compare(U"13", U"12", 2) > 0); + assert(std::char_traits::compare(U"22", U"12", 2) > 0); + + assert(std::char_traits::compare(U"123", U"123", 3) == 0); + assert(std::char_traits::compare(U"123", U"223", 3) < 0); + assert(std::char_traits::compare(U"123", U"133", 3) < 0); + assert(std::char_traits::compare(U"123", U"124", 3) < 0); + assert(std::char_traits::compare(U"223", U"123", 3) > 0); + assert(std::char_traits::compare(U"133", U"123", 3) > 0); + assert(std::char_traits::compare(U"124", U"123", 3) > 0); +#endif +#endif // _LIBCPP_HAS_NO_UNICODE_CHARS +} diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/copy.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/copy.pass.cpp new file mode 100644 index 00000000000..5f23514abd3 --- /dev/null +++ b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/copy.pass.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// template<> struct char_traits + +// static char_type* copy(char_type* s1, const char_type* s2, size_t n); + +#include +#include + +int main() +{ +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS + char32_t s1[] = {1, 2, 3}; + char32_t s2[3] = {0}; + assert(std::char_traits::copy(s2, s1, 3) == s2); + assert(s2[0] == char32_t(1)); + assert(s2[1] == char32_t(2)); + assert(s2[2] == char32_t(3)); +#endif // _LIBCPP_HAS_NO_UNICODE_CHARS +} diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eof.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eof.pass.cpp new file mode 100644 index 00000000000..8f804aa22e7 --- /dev/null +++ b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eof.pass.cpp @@ -0,0 +1,24 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// template<> struct char_traits + +// static constexpr int_type eof(); + +#include +#include + +int main() +{ +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS + std::char_traits::int_type i = std::char_traits::eof(); +#endif +} diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp new file mode 100644 index 00000000000..ffeff0cf45a --- /dev/null +++ b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// template<> struct char_traits + +// static constexpr bool eq(char_type c1, char_type c2); + +#include +#include + +int main() +{ +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L + char32_t c = U'\0'; + assert(std::char_traits::eq(U'a', U'a')); + assert(!std::char_traits::eq(U'a', U'A')); +#endif +#endif // _LIBCPP_HAS_NO_UNICODE_CHARS +} diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq_int_type.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq_int_type.pass.cpp new file mode 100644 index 00000000000..eb5c6966101 --- /dev/null +++ b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq_int_type.pass.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// template<> struct char_traits + +// static constexpr bool eq_int_type(int_type c1, int_type c2); + +#include +#include + +int main() +{ +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L + assert( std::char_traits::eq_int_type(U'a', U'a')); + assert(!std::char_traits::eq_int_type(U'a', U'A')); + assert(!std::char_traits::eq_int_type(std::char_traits::eof(), U'A')); +#endif + assert( std::char_traits::eq_int_type(std::char_traits::eof(), + std::char_traits::eof())); +#endif // _LIBCPP_HAS_NO_UNICODE_CHARS +} diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/find.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/find.pass.cpp new file mode 100644 index 00000000000..148fc0ccfcc --- /dev/null +++ b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/find.pass.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// template<> struct char_traits + +// static const char_type* find(const char_type* s, size_t n, const char_type& a); + +#include +#include + +int main() +{ +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS + char32_t s1[] = {1, 2, 3}; + assert(std::char_traits::find(s1, 3, char32_t(1)) == s1); + assert(std::char_traits::find(s1, 3, char32_t(2)) == s1+1); + assert(std::char_traits::find(s1, 3, char32_t(3)) == s1+2); + assert(std::char_traits::find(s1, 3, char32_t(4)) == 0); + assert(std::char_traits::find(s1, 3, char32_t(0)) == 0); +#endif // _LIBCPP_HAS_NO_UNICODE_CHARS +} diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/length.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/length.pass.cpp new file mode 100644 index 00000000000..d80ce051d1f --- /dev/null +++ b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/length.pass.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// template<> struct char_traits + +// static size_t length(const char_type* s); + +#include +#include + +int main() +{ +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L + assert(std::char_traits::length(U"") == 0); + assert(std::char_traits::length(U"a") == 1); + assert(std::char_traits::length(U"aa") == 2); + assert(std::char_traits::length(U"aaa") == 3); + assert(std::char_traits::length(U"aaaa") == 4); +#endif +#endif // _LIBCPP_HAS_NO_UNICODE_CHARS +} diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp new file mode 100644 index 00000000000..f667507f045 --- /dev/null +++ b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// template<> struct char_traits + +// static constexpr bool lt(char_type c1, char_type c2); + +#include +#include + +int main() +{ +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L + char32_t c = U'\0'; + assert(!std::char_traits::lt(U'a', U'a')); + assert( std::char_traits::lt(U'A', U'a')); +#endif +#endif // _LIBCPP_HAS_NO_UNICODE_CHARS +} diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/move.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/move.pass.cpp new file mode 100644 index 00000000000..6fbc6d94fe5 --- /dev/null +++ b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/move.pass.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// template<> struct char_traits + +// static char_type* move(char_type* s1, const char_type* s2, size_t n); + +#include +#include + +int main() +{ +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS + char32_t s1[] = {1, 2, 3}; + assert(std::char_traits::move(s1, s1+1, 2) == s1); + assert(s1[0] == char32_t(2)); + assert(s1[1] == char32_t(3)); + assert(s1[2] == char32_t(3)); + s1[2] = char32_t(0); + assert(std::char_traits::move(s1+1, s1, 2) == s1+1); + assert(s1[0] == char32_t(2)); + assert(s1[1] == char32_t(2)); + assert(s1[2] == char32_t(3)); +#endif // _LIBCPP_HAS_NO_UNICODE_CHARS +} diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/not_eof.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/not_eof.pass.cpp new file mode 100644 index 00000000000..d794417bfd7 --- /dev/null +++ b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/not_eof.pass.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// template<> struct char_traits + +// static constexpr int_type not_eof(int_type c); + +#include +#include + +int main() +{ +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L + assert(std::char_traits::not_eof(U'a') == U'a'); + assert(std::char_traits::not_eof(U'A') == U'A'); +#endif + assert(std::char_traits::not_eof(0) == 0); + assert(std::char_traits::not_eof(std::char_traits::eof()) != + std::char_traits::eof()); +#endif // _LIBCPP_HAS_NO_UNICODE_CHARS +} diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_char_type.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_char_type.pass.cpp new file mode 100644 index 00000000000..1f67242b2ae --- /dev/null +++ b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_char_type.pass.cpp @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// template<> struct char_traits + +// static constexpr char_type to_char_type(int_type c); + +#include +#include + +int main() +{ +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L + assert(std::char_traits::to_char_type(U'a') == U'a'); + assert(std::char_traits::to_char_type(U'A') == U'A'); +#endif + assert(std::char_traits::to_char_type(0) == 0); +#endif // _LIBCPP_HAS_NO_UNICODE_CHARS +} diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_int_type.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_int_type.pass.cpp new file mode 100644 index 00000000000..a378186bdd6 --- /dev/null +++ b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/to_int_type.pass.cpp @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// template<> struct char_traits + +// static constexpr int_type to_int_type(char_type c); + +#include +#include + +int main() +{ +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS +#if __cplusplus >= 201103L + assert(std::char_traits::to_int_type(U'a') == U'a'); + assert(std::char_traits::to_int_type(U'A') == U'A'); +#endif + assert(std::char_traits::to_int_type(0) == 0); +#endif // _LIBCPP_HAS_NO_UNICODE_CHARS +} diff --git a/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/types.pass.cpp b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/types.pass.cpp new file mode 100644 index 00000000000..3b48af14f96 --- /dev/null +++ b/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/types.pass.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// template<> struct char_traits + +// typedef char32_t char_type; +// typedef uint_least32_t int_type; +// typedef streamoff off_type; +// typedef u32streampos pos_type; +// typedef mbstate_t state_type; + +#include +#include +#include + +int main() +{ +#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS + static_assert((std::is_same::char_type, char32_t>::value), ""); + static_assert((std::is_same::int_type, std::uint_least32_t>::value), ""); + static_assert((std::is_same::off_type, std::streamoff>::value), ""); + static_assert((std::is_same::pos_type, std::u32streampos>::value), ""); + static_assert((std::is_same::state_type, std::mbstate_t>::value), ""); +#endif // _LIBCPP_HAS_NO_UNICODE_CHARS +} -- cgit v1.2.3