5 #define BOOST_TEST_MODULE UnitTests 6 #include <boost/test/unit_test.hpp> 11 struct ConfigureLoggingFixture
13 ConfigureLoggingFixture()
24 #include <boost/iostreams/filtering_stream.hpp> 25 #include <boost/iostreams/tee.hpp> 29 using namespace boost::iostreams;
32 struct DebugOutputSink : boost::iostreams::sink
34 std::streamsize write(
const char* s, std::streamsize n)
37 std::string s2(s, boost::numeric_cast<size_t>(n));
38 OutputDebugString(s2.c_str());
43 class SetupDebugOutput
49 m_OutputStream.push(tee(std::cout));
50 m_OutputStream.push(m_DebugOutputSink);
52 boost::unit_test::unit_test_log.set_stream(m_OutputStream);
55 filtering_ostream m_OutputStream;
56 DebugOutputSink m_DebugOutputSink;
61 #endif // defined(_MSC_VER) 71 struct StreamRedirector
74 StreamRedirector(std::ostream& stream, std::streambuf* newStreamBuffer)
76 , m_BackupBuffer(m_Stream.rdbuf(newStreamBuffer))
78 ~StreamRedirector() { m_Stream.rdbuf(m_BackupBuffer); }
81 std::ostream& m_Stream;
82 std::streambuf* m_BackupBuffer;
86 StreamRedirector redirect(std::cout, ss.rdbuf());
88 using namespace armnn;
104 BOOST_CHECK(ss.str().find(
"Trace: My trace message; -2") != std::string::npos);
105 BOOST_CHECK(ss.str().find(
"Debug: My debug message; -1") != std::string::npos);
106 BOOST_CHECK(ss.str().find(
"Info: My info message; 0") != std::string::npos);
107 BOOST_CHECK(ss.str().find(
"Warning: My warning message; 1") != std::string::npos);
108 BOOST_CHECK(ss.str().find(
"Error: My error message; 2") != std::string::npos);
109 BOOST_CHECK(ss.str().find(
"Fatal: My fatal message; 3") != std::string::npos);
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
BOOST_AUTO_TEST_CASE(LoggerTest)
void SetAllLoggingSinks(bool standardOut, bool debugOut, bool coloured)
#define ARMNN_LOG(severity)
Copyright (c) 2020 ARM Limited.
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
void SetLogFilter(LogSeverity level)
void ConfigureLoggingTest()
BOOST_AUTO_TEST_SUITE_END()
BOOST_GLOBAL_FIXTURE(ConfigureLoggingFixture)