Skip to content

Commit 0df0840

Browse files
committed
Add unit test
1 parent 47bd223 commit 0df0840

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

llvm/unittests/ADT/STLForwardCompatTest.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,25 @@ TYPED_TEST(STLForwardCompatRemoveCVRefTest, RemoveCVRefT) {
4545
llvm::remove_cvref_t<From>>::value));
4646
}
4747

48+
template <typename T> class TypeIdentityTest : public ::testing::Test {
49+
public:
50+
using TypeIdentity = llvm::type_identity<T>;
51+
};
52+
53+
struct A {
54+
struct B {};
55+
};
56+
using TypeIdentityTestTypes =
57+
::testing::Types<int, volatile int, A, const A::B>;
58+
59+
TYPED_TEST_SUITE(TypeIdentityTest, TypeIdentityTestTypes, /*NameGenerator*/);
60+
61+
TYPED_TEST(TypeIdentityTest, Identity) {
62+
// TestFixture is the instantiated TypeIdentityTest.
63+
EXPECT_TRUE(
64+
(std::is_same_v<TypeParam, typename TestFixture::TypeIdentity::type>));
65+
}
66+
4867
TEST(TransformTest, TransformStd) {
4968
std::optional<int> A;
5069

0 commit comments

Comments
 (0)