• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // UNSUPPORTED: c++98, c++03
11 
12 // <experimental/filesystem>
13 
14 // class path
15 
16 // std::string  generic_string() const;
17 // std::wstring generic_wstring() const;
18 // std::u8string  generic_u8string() const;
19 // std::u16string generic_u16string() const;
20 // std::u32string generic_u32string() const;
21 
22 
23 #include <experimental/filesystem>
24 #include <type_traits>
25 #include <cassert>
26 
27 #include "test_macros.h"
28 #include "test_iterators.h"
29 #include "count_new.hpp"
30 #include "min_allocator.h"
31 #include "filesystem_test_helper.hpp"
32 
33 namespace fs = std::experimental::filesystem;
34 
35 MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
36 
main()37 int main()
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