brintos

brintos / llvm-project-archived public Read only

0
0
Text · 964 B · 4e20bbe Raw
44 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2010 11// <string_view>12 13//   constexpr bool contains(charT x) const noexcept;14 15#include <string_view>16#include <cassert>17 18#include "test_macros.h"19 20constexpr bool test() {21  using SV = std::string_view;22 23  SV sv1{};24  SV sv2{"abcde", 5};25 26  ASSERT_NOEXCEPT(sv1.contains('e'));27 28  assert(!sv1.contains('c'));29  assert(!sv1.contains('e'));30  assert(!sv1.contains('x'));31  assert(sv2.contains('c'));32  assert(sv2.contains('e'));33  assert(!sv2.contains('x'));34 35  return true;36}37 38int main(int, char**) {39  test();40  static_assert(test());41 42  return 0;43}44