named_overloads.pass.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. // UNSUPPORTED: c++98, c++03
  10. // <experimental/filesystem>
  11. // class path
  12. // std::string string() const;
  13. // std::wstring wstring() const;
  14. // std::u8string u8string() const;
  15. // std::u16string u16string() const;
  16. // std::u32string u32string() const;
  17. #include "filesystem_include.hpp"
  18. #include <type_traits>
  19. #include <cassert>
  20. #include "test_macros.h"
  21. #include "test_iterators.h"
  22. #include "count_new.hpp"
  23. #include "min_allocator.h"
  24. #include "filesystem_test_helper.hpp"
  25. MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
  26. int main()
  27. {
  28. using namespace fs;
  29. auto const& MS = longString;
  30. const char* value = longString;
  31. const path p(value);
  32. {
  33. std::string s = p.string();
  34. assert(s == value);
  35. }
  36. {
  37. std::string s = p.u8string();
  38. assert(s == (const char*)MS);
  39. }
  40. {
  41. std::wstring s = p.wstring();
  42. assert(s == (const wchar_t*)MS);
  43. }
  44. {
  45. std::u16string s = p.u16string();
  46. assert(s == (const char16_t*)MS);
  47. }
  48. {
  49. std::u32string s = p.u32string();
  50. assert(s == (const char32_t*)MS);
  51. }
  52. }