Eric Fiselier | 6e9a694 | 2016-06-17 19:46:40 +0000 | [diff] [blame] | 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 | |
Eric Fiselier | f1471a3 | 2018-03-26 05:46:57 +0000 | [diff] [blame] | 23 | #include "filesystem_include.hpp" |
Eric Fiselier | 6e9a694 | 2016-06-17 19:46:40 +0000 | [diff] [blame] | 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 | |
Eric Fiselier | 6e9a694 | 2016-06-17 19:46:40 +0000 | [diff] [blame] | 33 | MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); |
| 34 | |
| 35 | int main() |
| 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.generic_string(); |
| 43 | assert(s == value); |
| 44 | } |
| 45 | { |
| 46 | std::string s = p.generic_u8string(); |
| 47 | assert(s == (const char*)MS); |
| 48 | } |
| 49 | { |
| 50 | std::wstring s = p.generic_wstring(); |
| 51 | assert(s == (const wchar_t*)MS); |
| 52 | } |
| 53 | { |
| 54 | std::u16string s = p.generic_u16string(); |
| 55 | assert(s == (const char16_t*)MS); |
| 56 | } |
| 57 | { |
| 58 | std::u32string s = p.generic_u32string(); |
| 59 | assert(s == (const char32_t*)MS); |
| 60 | } |
| 61 | } |