1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // UNSUPPORTED: c++98, c++03
12 // <experimental/filesystem>
16 // template <class Source>
17 // path(const Source& source);
18 // template <class InputIterator>
19 // path(InputIterator first, InputIterator last);
22 #include <experimental/filesystem>
23 #include <type_traits>
26 #include "test_macros.h"
27 #include "test_iterators.h"
28 #include "min_allocator.h"
29 #include "filesystem_test_helper.hpp"
31 namespace fs = std::experimental::filesystem;
33 template <class CharT>
34 void RunTestCase(MultiStringType const& MS) {
36 const char* Expect = MS;
37 const CharT* TestPath = MS;
38 const CharT* TestPathEnd = StrEnd(TestPath);
39 const std::size_t Size = TestPathEnd - TestPath;
40 const std::size_t SSize = StrEnd(Expect) - Expect;
41 assert(Size == SSize);
44 const std::basic_string<CharT> S(TestPath);
46 assert(p.native() == Expect);
47 assert(p.string<CharT>() == TestPath);
48 assert(p.string<CharT>() == S);
53 assert(p.native() == Expect);
54 assert(p.string<CharT>() == TestPath);
57 path p(TestPath, TestPathEnd);
58 assert(p.native() == Expect);
59 assert(p.string<CharT>() == TestPath);
63 using It = input_iterator<const CharT*>;
65 assert(p.native() == Expect);
66 assert(p.string<CharT>() == TestPath);
69 using It = input_iterator<const CharT*>;
70 path p(It{TestPath}, It{TestPathEnd});
71 assert(p.native() == Expect);
72 assert(p.string<CharT>() == TestPath);
77 for (auto const& MS : PathList) {
78 RunTestCase<char>(MS);
79 RunTestCase<wchar_t>(MS);
80 RunTestCase<char16_t>(MS);
81 RunTestCase<char32_t>(MS);