libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

named_overloads.pass.cpp (1538B)


      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 // std::string  string() const;
     17 // std::wstring wstring() const;
     18 // std::u8string  u8string() const;
     19 // std::u16string u16string() const;
     20 // std::u32string u32string() const;
     21 
     22 
     23 #include "filesystem_include.hpp"
     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 
     34 MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
     35 
     36 int main()
     37 {
     38   using namespace fs;
     39   auto const& MS = longString;
     40   const char* value = longString;
     41   const path p(value);
     42   {
     43     std::string s = p.string();
     44     assert(s == value);
     45   }
     46   {
     47     std::string s = p.u8string();
     48     assert(s == (const char*)MS);
     49   }
     50   {
     51     std::wstring s = p.wstring();
     52     assert(s == (const wchar_t*)MS);
     53   }
     54   {
     55     std::u16string s = p.u16string();
     56     assert(s == (const char16_t*)MS);
     57   }
     58   {
     59     std::u32string s = p.u32string();
     60     assert(s == (const char32_t*)MS);
     61   }
     62 }