diff options
author | telsoa01 <telmo.soares@arm.com> | 2018-03-09 14:13:49 +0000 |
---|---|---|
committer | telsoa01 <telmo.soares@arm.com> | 2018-03-09 14:13:49 +0000 |
commit | 4fcda0101ec3d110c1d6d7bee5c83416b645528a (patch) | |
tree | c9a70aeb2887006160c1b3d265c27efadb7bdbae /src/armnn/test/UnitTests.cpp | |
download | armnn-4fcda0101ec3d110c1d6d7bee5c83416b645528a.tar.gz |
Release 18.02
Change-Id: Id3c11dc5ee94ef664374a988fcc6901e9a232fa6
Diffstat (limited to 'src/armnn/test/UnitTests.cpp')
-rw-r--r-- | src/armnn/test/UnitTests.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/armnn/test/UnitTests.cpp b/src/armnn/test/UnitTests.cpp new file mode 100644 index 0000000000..0e2f99583f --- /dev/null +++ b/src/armnn/test/UnitTests.cpp @@ -0,0 +1,60 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// See LICENSE file in the project root for full license information. +// +#define BOOST_TEST_MODULE UnitTests +#include <boost/test/unit_test.hpp> + +#include "UnitTests.hpp" + +struct ConfigureLoggingFixture +{ + ConfigureLoggingFixture() + { + ConfigureLoggingTest(); + } +}; + +BOOST_GLOBAL_FIXTURE(ConfigureLoggingFixture); + +// On Windows, duplicate the boost test logging output to the Visual Studio output window using OutputDebugString. +#if defined(_MSC_VER) + +#include <boost/iostreams/filtering_stream.hpp> +#include <boost/iostreams/tee.hpp> +#include <iostream> +#include <Windows.h> + +using namespace boost::iostreams; +using namespace std; + +struct DebugOutputSink : boost::iostreams::sink +{ + std::streamsize write(const char* s, std::streamsize n) + { + // The given string is not null-terminated, so we need to copy it. + std::string s2(s, boost::numeric_cast<size_t>(n)); + OutputDebugString(s2.c_str()); + return n; + } +}; + +class SetupDebugOutput +{ +public: + SetupDebugOutput() + { + // Send the output to both cout (as standard) and the debug output. + m_OutputStream.push(tee(std::cout)); + m_OutputStream.push(m_DebugOutputSink); + + boost::unit_test::unit_test_log.set_stream(m_OutputStream); + } +private: + filtering_ostream m_OutputStream; + DebugOutputSink m_DebugOutputSink; +}; + +BOOST_GLOBAL_FIXTURE(SetupDebugOutput); + +#endif // defined(_MSC_VER)
\ No newline at end of file |