Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / re / re.traits / length.pass.cpp
blobe14df640197b2c67b3e7c55fe06276fc8174e2a9
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>
11 // template <class charT> struct regex_traits;
13 // static std::size_t length(const char_type* p);
15 #include <regex>
16 #include <cassert>
17 #include "test_macros.h"
19 int main(int, char**)
21 assert(std::regex_traits<char>::length("") == 0);
22 assert(std::regex_traits<char>::length("1") == 1);
23 assert(std::regex_traits<char>::length("12") == 2);
24 assert(std::regex_traits<char>::length("123") == 3);
26 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
27 assert(std::regex_traits<wchar_t>::length(L"") == 0);
28 assert(std::regex_traits<wchar_t>::length(L"1") == 1);
29 assert(std::regex_traits<wchar_t>::length(L"12") == 2);
30 assert(std::regex_traits<wchar_t>::length(L"123") == 3);
31 #endif
33 return 0;