#include <doctest/doctest.h>
#include "UnitTests.hpp"
Go to the source code of this file.
◆ DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN |
◆ TEST_SUITE()
TEST_SUITE |
( |
"LoggerSuite" |
| ) |
|
Definition at line 23 of file UnitTests.cpp.
25 TEST_CASE_FIXTURE(ConfigureLoggingFixture,
"LoggerTest")
29 struct StreamRedirector
32 StreamRedirector(std::ostream& stream, std::streambuf* newStreamBuffer)
34 , m_BackupBuffer(m_Stream.rdbuf(newStreamBuffer))
36 ~StreamRedirector() { m_Stream.rdbuf(m_BackupBuffer); }
39 std::ostream& m_Stream;
40 std::streambuf* m_BackupBuffer;
43 StreamRedirector redirect(std::cout, ss.rdbuf());
45 using namespace armnn;
49 ARMNN_LOG(trace) <<
"My trace message; " << -2;
50 ARMNN_LOG(debug) <<
"My debug message; " << -1;
51 ARMNN_LOG(info) <<
"My info message; " << 0;
52 ARMNN_LOG(warning) <<
"My warning message; " << 1;
53 ARMNN_LOG(error) <<
"My error message; " << 2;
54 ARMNN_LOG(fatal) <<
"My fatal message; " << 3;
59 CHECK(ss.str().find(
"Trace: My trace message; -2") != std::string::npos);
60 CHECK(ss.str().find(
"Debug: My debug message; -1") != std::string::npos);
61 CHECK(ss.str().find(
"Info: My info message; 0") != std::string::npos);
62 CHECK(ss.str().find(
"Warning: My warning message; 1") != std::string::npos);
63 CHECK(ss.str().find(
"Error: My error message; 2") != std::string::npos);
64 CHECK(ss.str().find(
"Fatal: My fatal message; 3") != std::string::npos);
References ARMNN_LOG, armnn::debug, armnn::error, armnn::Fatal, armnn::fatal, armnn::info, armnn::SetAllLoggingSinks(), armnn::SetLogFilter(), armnn::Trace, armnn::trace, and armnn::warning.