| 1 | //===-- Tests for Test Filter functionality -------------------------------===// |
| 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 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "test/UnitTest/LibcTest.h" |
| 10 | |
| 11 | using LIBC_NAMESPACE::testing::TestOptions; |
| 12 | |
| 13 | TEST(LlvmLibcTestFilterTest, CorrectFilter) {} |
| 14 | |
| 15 | TEST(LlvmLibcTestFilterTest, CorrectFilter2) {} |
| 16 | |
| 17 | TEST(LlvmLibcTestFilterTest, IncorrectFilter) {} |
| 18 | |
| 19 | TEST(LlvmLibcTestFilterTest, NoFilter) {} |
| 20 | |
| 21 | TEST(LlvmLibcTestFilterTest, CheckCorrectFilter) { |
| 22 | TestOptions Options; |
| 23 | Options.TestFilter = "LlvmLibcTestFilterTest.NoFilter" ; |
| 24 | ASSERT_EQ(LIBC_NAMESPACE::testing::Test::runTests(Options), 0); |
| 25 | |
| 26 | Options.TestFilter = "LlvmLibcTestFilterTest.IncorrFilter" ; |
| 27 | ASSERT_EQ(LIBC_NAMESPACE::testing::Test::runTests(Options), 1); |
| 28 | |
| 29 | Options.TestFilter = "LlvmLibcTestFilterTest.CorrectFilter" ; |
| 30 | ASSERT_EQ(LIBC_NAMESPACE::testing::Test::runTests(Options), 0); |
| 31 | |
| 32 | Options.TestFilter = "LlvmLibcTestFilterTest.CorrectFilter2" ; |
| 33 | ASSERT_EQ(LIBC_NAMESPACE::testing::Test::runTests(Options), 0); |
| 34 | } |
| 35 | |
| 36 | int main() { |
| 37 | TestOptions Options{"LlvmLibcTestFilterTest.NoFilter" , /*PrintColor=*/true}; |
| 38 | LIBC_NAMESPACE::testing::Test::runTests(Options); |
| 39 | return 0; |
| 40 | } |
| 41 | |