5 #define BOOST_TEST_MODULE UnitTests 6 #include <boost/test/unit_test.hpp> 11 #include <boost/algorithm/string.hpp> 13 struct ConfigureLoggingFixture
15 ConfigureLoggingFixture()
26 #include <boost/iostreams/filtering_stream.hpp> 27 #include <boost/iostreams/tee.hpp> 31 using namespace boost::iostreams;
34 struct DebugOutputSink : boost::iostreams::sink
36 std::streamsize write(
const char* s, std::streamsize n)
39 std::string s2(s, boost::numeric_cast<size_t>(n));
40 OutputDebugString(s2.c_str());
45 class SetupDebugOutput
51 m_OutputStream.push(tee(std::cout));
52 m_OutputStream.push(m_DebugOutputSink);
54 boost::unit_test::unit_test_log.set_stream(m_OutputStream);
57 filtering_ostream m_OutputStream;
58 DebugOutputSink m_DebugOutputSink;
63 #endif // defined(_MSC_VER) 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;
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"));
void ConfigureLoggingTest()
BOOST_AUTO_TEST_CASE(LoggerTest)
#define ARMNN_LOG(severity)
void SetLogFilter(LogSeverity level)
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
BOOST_AUTO_TEST_SUITE_END()
void SetAllLoggingSinks(bool standardOut, bool debugOut, bool coloured)
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
BOOST_GLOBAL_FIXTURE(ConfigureLoggingFixture)