named_overloads.pass.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 generic_string() const;
  13. // std::wstring generic_wstring() const;
  14. // std::u8string generic_u8string() const;
  15. // std::u16string generic_u16string() const;
  16. // std::u32string generic_u32string() const;
  17. #include <experimental/filesystem>
  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. namespace fs = std::experimental::filesystem;
  26. MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
  27. int main()
  28. {
  29. using namespace fs;
  30. auto const& MS = longString;
  31. const char* value = longString;
  32. const path p(value);
  33. {
  34. std::string s = p.generic_string();
  35. assert(s == value);
  36. }
  37. {
  38. std::string s = p.generic_u8string();
  39. assert(s == (const char*)MS);
  40. }
  41. {
  42. std::wstring s = p.generic_wstring();
  43. assert(s == (const wchar_t*)MS);
  44. }
  45. {
  46. std::u16string s = p.generic_u16string();
  47. assert(s == (const char16_t*)MS);
  48. }
  49. {
  50. std::u32string s = p.generic_u32string();
  51. assert(s == (const char32_t*)MS);
  52. }
  53. }