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
11using LIBC_NAMESPACE::testing::TestOptions;
12
13TEST(LlvmLibcTestFilterTest, CorrectFilter) {}
14
15TEST(LlvmLibcTestFilterTest, CorrectFilter2) {}
16
17TEST(LlvmLibcTestFilterTest, IncorrectFilter) {}
18
19TEST(LlvmLibcTestFilterTest, NoFilter) {}
20
21TEST(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
36int main() {
37 TestOptions Options{"LlvmLibcTestFilterTest.NoFilter", /*PrintColor=*/true};
38 LIBC_NAMESPACE::testing::Test::runTests(Options);
39 return 0;
40}
41

Provided by KDAB

Privacy Policy
Update your C++ knowledge – Modern C++11/14/17 Training
Find out more

source code of libc/test/utils/UnitTest/testfilter_test.cpp