diff options
Diffstat (limited to 'test/std/experimental/string.view/string.view.cons')
6 files changed, 0 insertions, 316 deletions
diff --git a/test/std/experimental/string.view/string.view.cons/default.pass.cpp b/test/std/experimental/string.view/string.view.cons/default.pass.cpp deleted file mode 100644 index 37df020e7ea4..000000000000 --- a/test/std/experimental/string.view/string.view.cons/default.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_view> - -// constexpr basic_string_view () noexcept; - -#include <experimental/string_view> -#include <cassert> - -#include "test_macros.h" - -template<typename T> -void test () { -#if TEST_STD_VER > 11 - { - constexpr T sv1; - static_assert ( sv1.size() == 0, "" ); - static_assert ( sv1.empty(), ""); - } -#endif - - { - T sv1; - assert ( sv1.size() == 0 ); - assert ( sv1.empty()); - } -} - -int main () { - typedef std::experimental::string_view string_view; - typedef std::experimental::u16string_view u16string_view; - typedef std::experimental::u32string_view u32string_view; - typedef std::experimental::wstring_view wstring_view; - - test<string_view> (); - test<u16string_view> (); - test<u32string_view> (); - test<wstring_view> (); - -} diff --git a/test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp b/test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp deleted file mode 100644 index a8638389e168..000000000000 --- a/test/std/experimental/string.view/string.view.cons/from_literal.pass.cpp +++ /dev/null @@ -1,65 +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_view> - -// constexpr basic_string_view(const _CharT* _s) -// : __data (_s), __size(_Traits::length(_s)) {} - - -#include <experimental/string_view> -#include <string> -#include <cassert> - -#include "test_macros.h" -#include "constexpr_char_traits.hpp" - -template<typename CharT> -size_t StrLen ( const CharT *s ) { - size_t retVal = 0; - while ( *s != 0 ) { ++retVal; ++s; } - return retVal; - } - -template<typename CharT> -void test ( const CharT *s ) { - std::experimental::basic_string_view<CharT> sv1 ( s ); - assert ( sv1.size() == StrLen( s )); - assert ( sv1.data() == s ); - } - - -int main () { - - test ( "QBCDE" ); - test ( "A" ); - test ( "" ); - - test ( L"QBCDE" ); - test ( L"A" ); - test ( L"" ); - -#if TEST_STD_VER >= 11 - test ( u"QBCDE" ); - test ( u"A" ); - test ( u"" ); - - test ( U"QBCDE" ); - test ( U"A" ); - test ( U"" ); -#endif - -#if TEST_STD_VER > 11 - { - constexpr std::experimental::basic_string_view<char, constexpr_char_traits<char>> sv1 ( "ABCDE" ); - static_assert ( sv1.size() == 5, ""); - } -#endif -} diff --git a/test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp b/test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp deleted file mode 100644 index c2f312daa863..000000000000 --- a/test/std/experimental/string.view/string.view.cons/from_ptr_len.pass.cpp +++ /dev/null @@ -1,83 +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_view> - -// constexpr basic_string_view(const _CharT* _s, size_type _len) -// : __data (_s), __size(_len) {} - - -#include <experimental/string_view> -#include <string> -#include <cassert> - -#include "test_macros.h" - -template<typename CharT> -void test ( const CharT *s, size_t sz ) { - { - std::experimental::basic_string_view<CharT> sv1 ( s, sz ); - assert ( sv1.size() == sz ); - assert ( sv1.data() == s ); - } -} - -int main () { - - test ( "QBCDE", 5 ); - test ( "QBCDE", 2 ); - test ( "", 0 ); -#if TEST_STD_VER > 11 - { - constexpr const char *s = "QBCDE"; - constexpr std::experimental::basic_string_view<char> sv1 ( s, 2 ); - static_assert ( sv1.size() == 2, "" ); - static_assert ( sv1.data() == s, "" ); - } -#endif - - test ( L"QBCDE", 5 ); - test ( L"QBCDE", 2 ); - test ( L"", 0 ); -#if TEST_STD_VER > 11 - { - constexpr const wchar_t *s = L"QBCDE"; - constexpr std::experimental::basic_string_view<wchar_t> sv1 ( s, 2 ); - static_assert ( sv1.size() == 2, "" ); - static_assert ( sv1.data() == s, "" ); - } -#endif - -#if TEST_STD_VER >= 11 - test ( u"QBCDE", 5 ); - test ( u"QBCDE", 2 ); - test ( u"", 0 ); -#if TEST_STD_VER > 11 - { - constexpr const char16_t *s = u"QBCDE"; - constexpr std::experimental::basic_string_view<char16_t> sv1 ( s, 2 ); - static_assert ( sv1.size() == 2, "" ); - static_assert ( sv1.data() == s, "" ); - } -#endif - - test ( U"QBCDE", 5 ); - test ( U"QBCDE", 2 ); - test ( U"", 0 ); -#if TEST_STD_VER > 11 - { - constexpr const char32_t *s = U"QBCDE"; - constexpr std::experimental::basic_string_view<char32_t> sv1 ( s, 2 ); - static_assert ( sv1.size() == 2, "" ); - static_assert ( sv1.data() == s, "" ); - } -#endif -#endif -} diff --git a/test/std/experimental/string.view/string.view.cons/from_string.pass.cpp b/test/std/experimental/string.view/string.view.cons/from_string.pass.cpp deleted file mode 100644 index 4ecd2cdff9ba..000000000000 --- a/test/std/experimental/string.view/string.view.cons/from_string.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_view> - -// template<class Allocator> -// basic_string_view(const basic_string<_CharT, _Traits, Allocator>& _str) noexcept - - -#include <experimental/string_view> -#include <string> -#include <cassert> - -#include "test_macros.h" - -struct dummy_char_traits : public std::char_traits<char> {}; - -template<typename CharT, typename Traits> -void test ( const std::basic_string<CharT, Traits> &str ) { - std::experimental::basic_string_view<CharT, Traits> sv1 ( str ); - assert ( sv1.size() == str.size()); - assert ( sv1.data() == str.data()); -} - -int main () { - - test ( std::string("QBCDE") ); - test ( std::string("") ); - test ( std::string() ); - - test ( std::wstring(L"QBCDE") ); - test ( std::wstring(L"") ); - test ( std::wstring() ); - -#if TEST_STD_VER >= 11 - test ( std::u16string{u"QBCDE"} ); - test ( std::u16string{u""} ); - test ( std::u16string{} ); - - test ( std::u32string{U"QBCDE"} ); - test ( std::u32string{U""} ); - test ( std::u32string{} ); -#endif - - test ( std::basic_string<char, dummy_char_traits>("QBCDE") ); - test ( std::basic_string<char, dummy_char_traits>("") ); - test ( std::basic_string<char, dummy_char_traits>() ); - -} diff --git a/test/std/experimental/string.view/string.view.cons/from_string1.fail.cpp b/test/std/experimental/string.view/string.view.cons/from_string1.fail.cpp deleted file mode 100644 index 72e9dad83c84..000000000000 --- a/test/std/experimental/string.view/string.view.cons/from_string1.fail.cpp +++ /dev/null @@ -1,32 +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_view> - -// template<class Allocator> -// basic_string_view(const basic_string<_CharT, _Traits, Allocator>& _str) noexcept - -#include <experimental/string_view> -#include <string> -#include <cassert> - -struct dummy_char_traits : public std::char_traits<char> {}; - -int main () { - using string_view = std::experimental::basic_string_view<char>; - using string = std:: basic_string <char, dummy_char_traits>; - - { - string s{"QBCDE"}; - string_view sv1 ( s ); - assert ( sv1.size() == s.size()); - assert ( sv1.data() == s.data()); - } -} diff --git a/test/std/experimental/string.view/string.view.cons/from_string2.fail.cpp b/test/std/experimental/string.view/string.view.cons/from_string2.fail.cpp deleted file mode 100644 index a14e131c85aa..000000000000 --- a/test/std/experimental/string.view/string.view.cons/from_string2.fail.cpp +++ /dev/null @@ -1,32 +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_view> - -// template<class Allocator> -// basic_string_view(const basic_string<_CharT, _Traits, Allocator>& _str) noexcept - -#include <experimental/string_view> -#include <string> -#include <cassert> - -struct dummy_char_traits : public std::char_traits<char> {}; - -int main () { - using string_view = std::experimental::basic_string_view<char, dummy_char_traits>; - using string = std:: basic_string <char>; - - { - string s{"QBCDE"}; - string_view sv1 ( s ); - assert ( sv1.size() == s.size()); - assert ( sv1.data() == s.data()); - } -} |