ptr_flg.pass.cpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // <regex>
  10. // template <class charT, class traits = regex_traits<charT>> class basic_regex;
  11. // basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
  12. #include <regex>
  13. #include <cassert>
  14. template <class CharT>
  15. void
  16. test(const CharT* p, std::regex_constants::syntax_option_type f, unsigned mc)
  17. {
  18. std::basic_regex<CharT> r(p, f);
  19. assert(r.flags() == f);
  20. assert(r.mark_count() == mc);
  21. }
  22. int main()
  23. {
  24. test("", std::regex_constants::basic, 0);
  25. test("\\(a\\)", std::regex_constants::basic, 1);
  26. test("\\(a[bc]\\)", std::regex_constants::basic, 1);
  27. test("\\(a\\([bc]\\)\\)", std::regex_constants::basic, 2);
  28. test("(a([bc]))", std::regex_constants::basic, 0);
  29. }