Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Add Android implementation of writeToDebugConsole that prints to Logcat (#1710)

Commit
e5c0e3322dfd9410d94e151674b0e16b3073fbfe
Author
Mike Cowan ·
Committer
Martin Hořeňovský
Parents
dc8c8e957fd5

Files · Download .tar.gz

Changes

 include/internal/catch_debug_console.cpp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/internal/catch_debug_console.cpp b/include/internal/catch_debug_console.cpp
index 5d25f651..26751c7e 100644
--- a/include/internal/catch_debug_console.cpp
+++ b/include/internal/catch_debug_console.cpp
@@ -11,7 +11,16 @@
 #include "catch_platform.h"
 #include "catch_windows_h_proxy.h"
 
-#ifdef CATCH_PLATFORM_WINDOWS
+#if defined(__ANDROID__)
+#include <android/log.h>
+
+    namespace Catch {
+        void writeToDebugConsole( std::string const& text ) {
+            __android_log_print( ANDROID_LOG_DEBUG, "Catch", text.c_str() );
+        }
+    }
+
+#elif defined(CATCH_PLATFORM_WINDOWS)
 
     namespace Catch {
         void writeToDebugConsole( std::string const& text ) {