transform.pass.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  3. //
  4. // The LLVM Compiler Infrastructure
  5. //
  6. // This file is dual licensed under the MIT and the University of Illinois Open
  7. // Source Licenses. See LICENSE.TXT for details.
  8. //
  9. //===----------------------------------------------------------------------===//
  10. // REQUIRES: locale.cs_CZ.ISO8859-2
  11. // <regex>
  12. // template <class charT> struct regex_traits;
  13. // template <class ForwardIterator>
  14. // string_type transform(ForwardIterator first, ForwardIterator last) const;
  15. #include <regex>
  16. #include <cassert>
  17. #include "test_iterators.h"
  18. #include "platform_support.h" // locale name macros
  19. int main()
  20. {
  21. {
  22. std::regex_traits<char> t;
  23. const char a[] = "a";
  24. const char B[] = "B";
  25. typedef forward_iterator<const char*> F;
  26. assert(t.transform(F(a), F(a+1)) > t.transform(F(B), F(B+1)));
  27. t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));
  28. assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1)));
  29. }
  30. {
  31. std::regex_traits<wchar_t> t;
  32. const wchar_t a[] = L"a";
  33. const wchar_t B[] = L"B";
  34. typedef forward_iterator<const wchar_t*> F;
  35. assert(t.transform(F(a), F(a+1)) > t.transform(F(B), F(B+1)));
  36. t.imbue(std::locale(LOCALE_cs_CZ_ISO8859_2));
  37. assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1)));
  38. }
  39. }