named_overloads.pass.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. // UNSUPPORTED: c++98, c++03
  9. // <filesystem>
  10. // class path
  11. // std::string generic_string() const;
  12. // std::wstring generic_wstring() const;
  13. // std::u8string generic_u8string() const;
  14. // std::u16string generic_u16string() const;
  15. // std::u32string generic_u32string() const;
  16. #include "filesystem_include.hpp"
  17. #include <type_traits>
  18. #include <cassert>
  19. #include "test_macros.h"
  20. #include "test_iterators.h"
  21. #include "count_new.hpp"
  22. #include "min_allocator.h"
  23. #include "filesystem_test_helper.hpp"
  24. MultiStringType longString = MKSTR("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/123456789/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
  25. int main(int, char**)
  26. {
  27. using namespace fs;
  28. auto const& MS = longString;
  29. const char* value = longString;
  30. const path p(value);
  31. {
  32. std::string s = p.generic_string();
  33. assert(s == value);
  34. }
  35. {
  36. std::string s = p.generic_u8string();
  37. assert(s == (const char*)MS);
  38. }
  39. {
  40. std::wstring s = p.generic_wstring();
  41. assert(s == (const wchar_t*)MS);
  42. }
  43. {
  44. std::u16string s = p.generic_u16string();
  45. assert(s == (const char16_t*)MS);
  46. }
  47. {
  48. std::u32string s = p.generic_u32string();
  49. assert(s == (const char32_t*)MS);
  50. }
  51. return 0;
  52. }