Gazebo Common

API Reference

5.7.0
gz/common/testing/AutoLogFixture.hh
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2022 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17 #ifndef GZ_COMMON_TESTING_AUTOLOGFIXTURE_HH_
18 #define GZ_COMMON_TESTING_AUTOLOGFIXTURE_HH_
19 
20 #include <memory>
21 #include <string>
22 
24 #ifdef GTEST_API_
25 
26 #include <gz/utils/ImplPtr.hh>
27 
28 namespace gz::common::testing
29 {
34 class AutoLogFixture : public ::testing::Test
35 {
37  public: AutoLogFixture();
38 
40  public: virtual ~AutoLogFixture();
41 
43  protected: virtual void SetUp() override;
44 
47  protected: std::string FullLogPath() const;
48 
51  protected: std::string LogContent() const;
52 
54  GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr)
55 };
56 } // namespace gz::common::testing
57 
58 #include <gz/common/testing/detail/AutoLogFixture.hh>
59 
60 #else
61 #warning "AutoLogFixture needs <gtest/gtest.h> to be included in order to work"
62 #endif // GTEST_API_
63 
64 #endif // GZ_COMMON_TESTING_AUTOLOGFIXTURE_HH_