Lines Matching full:testing
52 feels more like Lisp than C++. The `::testing::AssertionResult` class solves
60 namespace testing {
81 testing::AssertionResult IsEven(int n) {
83 return testing::AssertionSuccess();
85 return testing::AssertionFailure() << n << " is odd";
119 testing::AssertionResult IsEven(int n) {
121 return testing::AssertionSuccess() << n << " is even";
123 return testing::AssertionFailure() << n << " is odd";
160 using ::testing::FloatLE;
161 using ::testing::DoubleLE;
186 using ::testing::HasSubstr;
187 using ::testing::MatchesRegex;
203 ::testing::StaticAssertTypeEq<T1, T2>();
219 void Bar() { testing::StaticAssertTypeEq<int, T>(); }
283 of classes derived from either `::testing::Environment` or `::testing::Test`.
292 class SkipFixture : public ::testing::Test {
359 types with extra debugging information for testing purposes only. If so, you can
396 call `::testing::PrintToString(x)`, which returns an `std::string`:
402 << "point_ints = " << testing::PrintToString(point_ints);
449 EXPECT_EXIT(NormalExit(), testing::ExitedWithCode(0), "Success");
453 EXPECT_EXIT(KillProcess(), testing::KilledBySignal(SIGKILL),
493 class FooTest : public testing::Test { ... };
581 risks of testing in a possibly multithreaded environment. It trades increased
584 The automated testing framework does not set the style flag. You can choose a
597 testing::InitGoogleTest(&argc, argv);
762 class ThrowListener : public testing::EmptyTestEventListener {
763 void OnTestPartResult(const testing::TestPartResult& result) override {
764 if (result.type() == testing::TestPartResult::kFatalFailure) {
765 throw testing::AssertionException(result);
771 testing::UnitTest::GetInstance()->listeners().Append(new ThrowListener);
811 `HasFatalFailure()` in the `::testing::Test` class returns `true` if an
838 fixture, you must add the `::testing::Test::` prefix, as in:
841 if (testing::Test::HasFatalFailure()) return;
875 > needs to be prefixed with `::testing::Test::` if used outside of the
928 class FooTest : public testing::Test {
984 First, you subclass the `::testing::Environment` class to define a test
988 class Environment : public ::testing::Environment {
1001 calling the `::testing::AddGlobalTestEnvironment()` function:
1036 testing::Environment* const foo_env =
1037 testing::AddGlobalTestEnvironment(new FooEnvironment);
1057 * You want to test your code over various inputs (a.k.a. data-driven testing).
1064 must be derived from both `testing::Test` and `testing::WithParamInterface<T>`
1067 `testing::TestWithParam<T>`, which itself is derived from both `testing::Test`
1068 and `testing::WithParamInterface<T>`. `T` can be any copyable type. If it's a
1079 public testing::TestWithParam<absl::string_view> {
1086 class BaseTest : public testing::Test {
1090 public testing::WithParamInterface<absl::string_view> {
1115 [`INSTANTIATE_TEST_SUITE_P`](reference/testing.md#INSTANTIATE_TEST_SUITE_P) in
1116 the Testing Reference.
1120 [`Values`](reference/testing.md#param-generators) parameter generator:
1125 testing::Values("meeny", "miny", "moe"));
1135 [parameter generator](reference/testing.md#param-generators).
1158 [`ValuesIn`](reference/testing.md#param-generators) parameter generator:
1162 INSTANTIATE_TEST_SUITE_P(Pets, FooTest, testing::ValuesIn(kPets));
1221 `testing::TestParamInfo<class ParamType>`, and return `std::string`.
1223 `testing::PrintToStringParamName` is a builtin test suffix generator that
1224 returns the value of `testing::PrintToString(GetParam())`. It does not work for
1233 class MyTestSuite : public testing::TestWithParam<int> {};
1240 INSTANTIATE_TEST_SUITE_P(MyGroup, MyTestSuite, testing::Range(0, 10),
1241 testing::PrintToStringParamName());
1254 class MyTestSuite : public testing::TestWithParam<std::tuple<MyType, std::string>> {
1259 testing::Combine(
1260 testing::Values(MyType::MY_FOO, MyType::MY_BAR),
1261 testing::Values("A", "B")),
1262 [](const testing::TestParamInfo<MyTestSuite::ParamType>& info) {
1289 Remember to derive it from `::testing::Test`:
1293 class FooTest : public testing::Test {
1306 using MyTypes = ::testing::Types<char, int, unsigned int>;
1361 class FooTest : public testing::Test {
1404 using MyTypes = ::testing::Types<char, int, unsigned int>;
1414 that type directly without `::testing::Types<...>`, like this:
1422 ## Testing Private Code
1426 black-box testing principle, most of the time you should test your code through
1432 extracting an implementation class, and testing it. Then use that implementation
1524 class FooTest : public testing::Test {
1537 If you are building a testing utility on top of GoogleTest, you'll want to test
1540 The challenge is to verify that your testing utility reports failures correctly.
1588 provides the `::testing::RegisterTest` that allows callers to register arbitrary
1620 class MyFixture : public testing::Test {
1640 testing::RegisterTest(
1650 testing::InitGoogleTest(&argc, argv);
1663 [`TestInfo`](reference/testing.md#TestInfo) class has this information.
1666 `current_test_info()` on the [`UnitTest`](reference/testing.md#UnitTest)
1672 const testing::TestInfo* const test_info =
1673 testing::UnitTest::GetInstance()->current_test_info();
1698 [`testing::TestEventListener`](reference/testing.md#TestEventListener) or
1699 [`testing::EmptyTestEventListener`](reference/testing.md#EmptyTestEventListener)
1721 class MinimalistPrinter : public testing::EmptyTestEventListener {
1723 void OnTestStart(const testing::TestInfo& test_info) override {
1729 void OnTestPartResult(const testing::TestPartResult& test_part_result) override {
1738 void OnTestEnd(const testing::TestInfo& test_info) override {
1749 [`TestEventListeners`](reference/testing.md#TestEventListeners) - note the "s"
1755 testing::InitGoogleTest(&argc, argv);
1757 testing::TestEventListeners& listeners =
1758 testing::UnitTest::GetInstance()->listeners();
1814 `::testing::InitGoogleTest()` before calling `RUN_ALL_TESTS()`.
1902 class DISABLED_BarTest : public testing::Test { ... };