Fix support for typed tests and parameterized tests.
Bug: http://b/69425095 Test: run bionic_unit_tests --bionic-selftest Change-Id: Ifa23288f2ad84978b7748da0ea93d650fae926a8
This commit is contained in:
parent
8c75675ec6
commit
5e235c85bb
|
@ -312,6 +312,7 @@ static bool EnumerateTests(int argc, char** argv, std::vector<TestCase>& testcas
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& line : android::base::Split(content, "\n")) {
|
for (auto& line : android::base::Split(content, "\n")) {
|
||||||
|
line = android::base::Split(line, "#")[0];
|
||||||
line = android::base::Trim(line);
|
line = android::base::Trim(line);
|
||||||
if (line.empty()) continue;
|
if (line.empty()) continue;
|
||||||
if (android::base::EndsWith(line, ".")) {
|
if (android::base::EndsWith(line, ".")) {
|
||||||
|
@ -1265,3 +1266,24 @@ static void deathtest_helper_fail() {
|
||||||
TEST_F(bionic_selftest_DeathTest, fail) {
|
TEST_F(bionic_selftest_DeathTest, fail) {
|
||||||
ASSERT_EXIT(deathtest_helper_fail(), ::testing::ExitedWithCode(0), "");
|
ASSERT_EXIT(deathtest_helper_fail(), ::testing::ExitedWithCode(0), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class BionicSelfTest : public ::testing::TestWithParam<bool> {
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_P(BionicSelfTest, test_success) {
|
||||||
|
ASSERT_EQ(GetParam(), GetParam());
|
||||||
|
}
|
||||||
|
|
||||||
|
INSTANTIATE_TEST_CASE_P(bionic_selftest, BionicSelfTest, ::testing::Values(true, false));
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class bionic_selftest_TestT : public ::testing::Test {
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef ::testing::Types<char, int> MyTypes;
|
||||||
|
|
||||||
|
TYPED_TEST_CASE(bionic_selftest_TestT, MyTypes);
|
||||||
|
|
||||||
|
TYPED_TEST(bionic_selftest_TestT, test_success) {
|
||||||
|
ASSERT_EQ(true, true);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue