[libc-commits] [PATCH] D100631: [libc] Extends the testing framework to support typed test
Guillaume Chatelet via Phabricator via libc-commits
libc-commits at lists.llvm.org
Fri Apr 16 02:37:48 PDT 2021
gchatelet created this revision.
gchatelet added reviewers: sivachandra, phosek.
Herald added subscribers: libc-commits, ecnelises, tschuett.
Herald added a project: libc-project.
gchatelet requested review of this revision.
This patch provides TYPED_TEST and TYPED_TEST_F (similar in functionnality to gtest).
This is needed to extensively test building blocks for memory functions.
Example for TYPED_TEST_F:
template <typename T> class LlvmLibcMyTestFixture : public testing::Test {};
using Types = testing::TypeList<char, int, long>;
TYPED_TEST_F(LlvmLibcMyTestFixture, Simple, Types) {
EXPECT_LE(sizeof(ParamType), 8UL);
}
Example for TYPED_TEST:
using Types = testing::TypeList<char, int, long>;
TYPED_TEST(LlvmLibcMyTest, Simple, Types) {
EXPECT_LE(sizeof(ParamType), 8UL);
}
Because we can't use RTTI and <typeinfo>, `TypeParam` is displayed as "UNSET" by default and the user can provide a readable name using the `REGISTER_TYPE_NAME` macro.
I noticed that Fuchsia is using its own testing framework. We can either add the same functionality to zxtest or disable them on Fuchsia. WDYT?
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D100631
Files:
libc/utils/UnitTest/LibcTest.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100631.338038.patch
Type: text/x-patch
Size: 7556 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20210416/d6e5da6b/attachment-0001.bin>
More information about the libc-commits
mailing list