• 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 // <filesystem>
13 
14 // class path
15 
16 // path& make_preferred()
17 
18 #include "filesystem_include.hpp"
19 #include <type_traits>
20 #include <cassert>
21 
22 #include "test_macros.h"
23 #include "test_iterators.h"
24 #include "count_new.hpp"
25 #include "filesystem_test_helper.hpp"
26 
27 
28 struct MakePreferredTestcase {
29   const char* value;
30 };
31 
32 const MakePreferredTestcase TestCases[] =
33   {
34       {""}
35     , {"hello_world"}
36     , {"/"}
37     , {"/foo/bar/baz/"}
38     , {"\\"}
39     , {"\\foo\\bar\\baz\\"}
40     , {"\\foo\\/bar\\/baz\\"}
41   };
42 
main()43 int main()
44 {
45   // This operation is an identity operation on linux.
46   using namespace fs;
47   for (auto const & TC : TestCases) {
48     path p(TC.value);
49     assert(p == TC.value);
50     path& Ref = (p.make_preferred());
51     assert(p.native() == TC.value);
52     assert(&Ref == &p);
53   }
54 }
55