Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / strings / basic.string / string.starts_with / starts_with.char.pass.cpp
blobeb9399d62eaa3b755e82d77f623f8cb13478ee02
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++03, c++11, c++14, c++17
10 // <string>
12 // constexpr bool starts_with(charT x) const noexcept;
14 #include <string>
15 #include <cassert>
17 #include "test_macros.h"
19 template <class S>
20 constexpr void test_string() {
21 S s1{};
22 S s2{"abcde", 5};
24 ASSERT_NOEXCEPT(s1.starts_with('e'));
26 assert(!s1.starts_with('a'));
27 assert(!s1.starts_with('x'));
28 assert(s2.starts_with('a'));
29 assert(!s2.starts_with('x'));
32 constexpr bool test() {
33 test_string<std::string>();
35 return true;
38 int main(int, char**) {
39 test();
40 static_assert(test());
42 return 0;