1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // UNSUPPORTED: c++98, c++03 10 11 // <filesystem> 12 13 // class path 14 15 // std::string generic_string() const; 16 // std::wstring generic_wstring() const; 17 // std::u8string generic_u8string() const; 18 // std::u16string generic_u16string() const; 19 // std::u32string generic_u32string() const; 20 21 22 #include "filesystem_include.hpp" 23 #include <type_traits> 24 #include <cassert> 25 26 #include "test_macros.h" 27 #include "test_iterators.h" 28 #include "count_new.hpp" 29 #include "min_allocator.h" 30 #include "filesystem_test_helper.hpp" 31 32 MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); 33 34 int main(int, char**) 35 { 36 using namespace fs; 37 auto const& MS = longString; 38 const char* value = longString; 39 const path p(value); 40 { 41 std::string s = p.generic_string(); 42 assert(s == value); 43 } 44 { 45 std::string s = p.generic_u8string(); 46 assert(s == (const char*)MS); 47 } 48 { 49 std::wstring s = p.generic_wstring(); 50 assert(s == (const wchar_t*)MS); 51 } 52 { 53 std::u16string s = p.generic_u16string(); 54 assert(s == (const char16_t*)MS); 55 } 56 { 57 std::u32string s = p.generic_u32string(); 58 assert(s == (const char32_t*)MS); 59 } 60 61 return 0; 62 } 63