| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "na64utest/testing-environment.hh" | ||
| 2 | |||
| 3 | #include "na64util/log4cpp-extras.hh" | ||
| 4 | #include "log4cpp/OstreamAppender.hh" | ||
| 5 | #include "log4cpp/FileAppender.hh" | ||
| 6 | |||
| 7 | namespace na64dp { | ||
| 8 | namespace test { | ||
| 9 | |||
| 10 | Environment * Environment::_self = nullptr; | ||
| 11 | |||
| 12 | void | ||
| 13 | 1 | Environment::SetUp() { | |
| 14 | 1 | log4cpp::Category & root = log4cpp::Category::getRoot(); | |
| 15 | |||
| 16 | log4cpp::Appender * consoleAppender | ||
| 17 |
2/3✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
✗ Branch 10 not taken.
|
2 | = new log4cpp::OstreamAppender("console", &std::cout); |
| 18 |
2/3✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
✗ Branch 8 not taken.
|
1 | consoleAppender->setLayout(new log4cpp::BasicLayout()); |
| 19 | |||
| 20 | 1 | log4cpp::Appender * fileAppender = nullptr; | |
| 21 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
|
1 | if( ! _file.empty() ) { |
| 22 | ✗ | fileAppender = new log4cpp::FileAppender("default", _file.c_str()); | |
| 23 | ✗ | fileAppender->setLayout(new log4cpp::BasicLayout()); | |
| 24 | ✗ | root.addAppender( fileAppender ); | |
| 25 | } | ||
| 26 | |||
| 27 | 1 | root.setPriority( _rootLevel ); | |
| 28 | 1 | root.addAppender( consoleAppender ); | |
| 29 | |||
| 30 |
3/4✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
✓ Branch 8 taken 1 times.
✗ Branch 13 not taken.
|
2 | _calibManager = new calib::Manager(log4cpp::Category::getInstance("calib.manager")); |
| 31 | |||
| 32 | 1 | _self = this; | |
| 33 | 1 | } | |
| 34 | |||
| 35 | // Override this to define how to tear down the environment. | ||
| 36 | void | ||
| 37 | 1 | Environment::TearDown() { | |
| 38 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(_calibManager) { |
| 39 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | delete _calibManager; |
| 40 | 1 | _calibManager = nullptr; | |
| 41 | } | ||
| 42 | |||
| 43 | 1 | log4cpp::Category::shutdown(); | |
| 44 | 1 | _self = nullptr; | |
| 45 | 1 | } | |
| 46 | |||
| 47 | na64dp::calib::Manager & | ||
| 48 | 9 | Environment::calib_mgr() { | |
| 49 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | assert(_self); |
| 50 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | assert(_calibManager); |
| 51 | 9 | return *_calibManager; | |
| 52 | } | ||
| 53 | |||
| 54 | } // namespace ::na64dp::test | ||
| 55 | } // namespace na64dp | ||
| 56 |