Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / re / re.alg / re.alg.replace / exponential.pass.cpp
blob316759fd895dd9e1c0df27daef37d5b50067318e
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 //===----------------------------------------------------------------------===//
9 // <regex>
10 // UNSUPPORTED: no-exceptions
12 // template <class OutputIterator, class BidirectionalIterator,
13 // class traits, class charT, class ST, class SA>
14 // OutputIterator
15 // regex_replace(OutputIterator out,
16 // BidirectionalIterator first, BidirectionalIterator last,
17 // const basic_regex<charT, traits>& e,
18 // const basic_string<charT, ST, SA>& fmt,
19 // regex_constants::match_flag_type flags =
20 // regex_constants::match_default);
22 #include <regex>
23 #include <cassert>
25 #include "test_macros.h"
27 int main(int, char**)
29 try {
30 std::regex re("a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?aaaaaaaaaaaaaaaaaaaa");
31 const char s[] = "aaaaaaaaaaaaaaaaaaaa";
32 std::string r = std::regex_replace(s, re, "123-&", std::regex_constants::format_sed);
33 LIBCPP_ASSERT(false);
34 assert(r == "123-aaaaaaaaaaaaaaaaaaaa");
35 } catch (const std::regex_error &e) {
36 assert(e.code() == std::regex_constants::error_complexity);
38 return 0;