brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · bb33ee4 Raw
40 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#include <__cxx03/__utility/is_pointer_in_range.h>10#include <cassert>11 12#include "test_macros.h"13 14template <class T, class U>15TEST_CONSTEXPR_CXX14 void test_cv_quals() {16  T i = 0;17  U j = 0;18  assert(!std::__is_pointer_in_range(&i, &i, &i));19  assert(std::__is_pointer_in_range(&i, &i + 1, &i));20  assert(!std::__is_pointer_in_range(&i, &i + 1, &j));21}22 23TEST_CONSTEXPR_CXX14 bool test() {24  test_cv_quals<int, int>();25  test_cv_quals<const int, int>();26  test_cv_quals<int, const int>();27  test_cv_quals<const int, const int>();28  test_cv_quals<volatile int, int>();29  test_cv_quals<int, volatile int>();30  test_cv_quals<volatile int, volatile int>();31 32  return true;33}34 35int main(int, char**) {36  test();37 38  return 0;39}40