| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <gtest/gtest.h> | ||
| 4 | |||
| 5 | #include "na64calib/manager.hh" | ||
| 6 | |||
| 7 | namespace na64dp { | ||
| 8 | namespace test { | ||
| 9 | |||
| 10 | // Testing environment sets up the logger, calib manager, etc | ||
| 11 | class Environment : public ::testing::Environment { | ||
| 12 | private: | ||
| 13 | log4cpp::Priority::PriorityLevel _rootLevel; | ||
| 14 | const std::string _file; | ||
| 15 | |||
| 16 | na64dp::calib::Manager * _calibManager; | ||
| 17 | |||
| 18 | static Environment * _self; | ||
| 19 | public: | ||
| 20 | 1 | Environment( log4cpp::Priority::PriorityLevel lvl=log4cpp::Priority::DEBUG // TODO: FATAL | |
| 21 | 2 | , const std::string & logFile="" ) : _rootLevel(lvl) | |
| 22 | 1 | , _file(logFile) | |
| 23 |
1/1✓ Branch 2 taken 1 times.
|
1 | , _calibManager(nullptr) |
| 24 | 1 | {} | |
| 25 | |||
| 26 | 4 | ~Environment() override {} | |
| 27 | |||
| 28 | // Override this to define how to set up the environment. | ||
| 29 | void SetUp() override; | ||
| 30 | |||
| 31 | // Override this to define how to tear down the environment. | ||
| 32 | void TearDown() override; | ||
| 33 | |||
| 34 | // May return nullptr if not instantiated (should be called from within | ||
| 35 | // gtest routines) | ||
| 36 | 18 | static Environment * self() { return _self; } | |
| 37 | |||
| 38 | // following methods make sense only after SetUp() was called | ||
| 39 | // (otherwise plain C assertion failure will be triggered) | ||
| 40 | na64dp::calib::Manager & calib_mgr(); | ||
| 41 | }; | ||
| 42 | |||
| 43 | } // namespace ::na64dp::test | ||
| 44 | } // namespace na64dp | ||
| 45 | |||
| 46 |