[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / llvm / unittests / ADT / STLForwardCompatTest.cpp
blob33c261b79a4407dd9d011d6a49e00880f17263a3
1 //===- STLForwardCompatTest.cpp - Unit tests for STLForwardCompat ---------===//
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 #include "llvm/ADT/STLForwardCompat.h"
10 #include "gtest/gtest.h"
12 namespace {
14 template <typename T>
15 class STLForwardCompatRemoveCVRefTest : public ::testing::Test {};
17 using STLForwardCompatRemoveCVRefTestTypes = ::testing::Types<
18 // clang-format off
19 std::pair<int, int>,
20 std::pair<int &, int>,
21 std::pair<const int, int>,
22 std::pair<volatile int, int>,
23 std::pair<const volatile int &, int>,
24 std::pair<int *, int *>,
25 std::pair<int *const, int *>,
26 std::pair<const int *, const int *>,
27 std::pair<int *&, int *>
28 // clang-format on
31 TYPED_TEST_SUITE(STLForwardCompatRemoveCVRefTest,
32 STLForwardCompatRemoveCVRefTestTypes, );
34 TYPED_TEST(STLForwardCompatRemoveCVRefTest, RemoveCVRef) {
35 using From = typename TypeParam::first_type;
36 using To = typename TypeParam::second_type;
37 EXPECT_TRUE(
38 (std::is_same<typename llvm::remove_cvref<From>::type, To>::value));
41 TYPED_TEST(STLForwardCompatRemoveCVRefTest, RemoveCVRefT) {
42 using From = typename TypeParam::first_type;
43 EXPECT_TRUE((std::is_same<typename llvm::remove_cvref<From>::type,
44 llvm::remove_cvref_t<From>>::value));
47 } // namespace