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 string() const; 16 // std::wstring wstring() const; 17 // std::u8string u8string() const; 18 // std::u16string u16string() const; 19 // std::u32string 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 33 MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); 34 35 int main(int, char**) 36 { 37 using namespace fs; 38 auto const& MS = longString; 39 const char* value = longString; 40 const path p(value); 41 { 42 std::string s = p.string(); 43 assert(s == value); 44 } 45 { 46 std::string s = p.u8string(); 47 assert(s == (const char*)MS); 48 } 49 { 50 std::wstring s = p.wstring(); 51 assert(s == (const wchar_t*)MS); 52 } 53 { 54 std::u16string s = p.u16string(); 55 assert(s == (const char16_t*)MS); 56 } 57 { 58 std::u32string s = p.u32string(); 59 assert(s == (const char32_t*)MS); 60 } 61 62 return 0; 63 } 64