#include <boost/test/unit_test.hpp>
#include "UnitTests.hpp"
#include <armnn/Logging.hpp>
#include <boost/algorithm/string.hpp>
Go to the source code of this file.
◆ BOOST_TEST_MODULE
#define BOOST_TEST_MODULE UnitTests |
◆ BOOST_AUTO_TEST_CASE()
BOOST_AUTO_TEST_CASE |
( |
LoggerTest |
| ) |
|
Definition at line 68 of file UnitTests.cpp.
References ARMNN_LOG, BOOST_AUTO_TEST_SUITE_END(), BOOST_CHECK(), armnn::debug, armnn::error, armnn::fatal, armnn::info, armnn::SetAllLoggingSinks(), armnn::SetLogFilter(), armnn::trace, and armnn::warning.
73 struct StreamRedirector
76 StreamRedirector(std::ostream& stream, std::streambuf* newStreamBuffer)
78 , m_BackupBuffer(m_Stream.rdbuf(newStreamBuffer))
80 ~StreamRedirector() { m_Stream.rdbuf(m_BackupBuffer); }
83 std::ostream& m_Stream;
84 std::streambuf* m_BackupBuffer;
88 StreamRedirector redirect(std::cout, ss.rdbuf());
90 using namespace armnn;
95 ARMNN_LOG(trace) <<
"My trace message; " << -2;
96 ARMNN_LOG(debug) <<
"My debug message; " << -1;
97 ARMNN_LOG(info) <<
"My info message; " << 0;
98 ARMNN_LOG(warning) <<
"My warning message; " << 1;
99 ARMNN_LOG(error) <<
"My error message; " << 2;
100 ARMNN_LOG(fatal) <<
"My fatal message; " << 3;
106 BOOST_CHECK(boost::contains(ss.str(),
"Trace: My trace message; -2"));
107 BOOST_CHECK(boost::contains(ss.str(),
"Debug: My debug message; -1"));
108 BOOST_CHECK(boost::contains(ss.str(),
"Info: My info message; 0"));
109 BOOST_CHECK(boost::contains(ss.str(),
"Warning: My warning message; 1"));
110 BOOST_CHECK(boost::contains(ss.str(),
"Error: My error message; 2"));
111 BOOST_CHECK(boost::contains(ss.str(),
"Fatal: My fatal message; 3"));
#define ARMNN_LOG(severity)
void SetLogFilter(LogSeverity level)
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
void SetAllLoggingSinks(bool standardOut, bool debugOut, bool coloured)
◆ BOOST_GLOBAL_FIXTURE()
BOOST_GLOBAL_FIXTURE |
( |
ConfigureLoggingFixture |
| ) |
|