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++03
10 
11 // These tests require locale for non-char paths
12 // UNSUPPORTED: libcpp-has-no-localization
13 
14 // <filesystem>
15 
16 // class path
17 
18 // std::string  generic_string() const;
19 // std::wstring generic_wstring() const;
20 // std::u8string  generic_u8string() const;
21 // std::u16string generic_u16string() const;
22 // std::u32string generic_u32string() const;
23 
24 
25 #include "filesystem_include.h"
26 #include <type_traits>
27 #include <cassert>
28 
29 #include "test_macros.h"
30 #include "test_iterators.h"
31 #include "count_new.h"
32 #include "min_allocator.h"
33 #include "filesystem_test_helper.h"
34 
35 MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
36 
37 int main(int, char**)
38 {
39   using namespace fs;
40   auto const& MS = longString;
41   const char* value = longString;
42   const path p(value);
43   {
44     std::string s = p.generic_string();
45     assert(s == value);
46   }
47   {
48     std::string s = p.generic_u8string();
49     assert(s == (const char*)MS);
50   }
51   {
52     std::wstring s = p.generic_wstring();
53     assert(s == (const wchar_t*)MS);
54   }
55   {
56     std::u16string s = p.generic_u16string();
57     assert(s == (const char16_t*)MS);
58   }
59   {
60     std::u32string s = p.generic_u32string();
61     assert(s == (const char32_t*)MS);
62   }
63 
64   return 0;
65 }
66