aboutsummaryrefslogtreecommitdiff
path: root/unittest/Catch/projects/runners/iTchRunner/internal/iTchRunnerReporter.h
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-12-22 16:53:56 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2017-12-22 16:53:56 +0100
commite9fc58cb304323f07aba736fc523903481404cff (patch)
tree59db450412ca101aa9601b3f2174436898f955c1 /unittest/Catch/projects/runners/iTchRunner/internal/iTchRunnerReporter.h
parent8150ee4edc7e32d5c27cd3e0f68c630d90865638 (diff)
parent48b3d82ffe1ed19db9ba3cf7e6536ecf92e27391 (diff)
downloadlibnitrokey-e9fc58cb304323f07aba736fc523903481404cff.tar.gz
libnitrokey-e9fc58cb304323f07aba736fc523903481404cff.tar.bz2
Merge commit '48b3d82ffe1ed19db9ba3cf7e6536ecf92e27391' as 'unittest/Catch'
Diffstat (limited to 'unittest/Catch/projects/runners/iTchRunner/internal/iTchRunnerReporter.h')
-rw-r--r--unittest/Catch/projects/runners/iTchRunner/internal/iTchRunnerReporter.h115
1 files changed, 115 insertions, 0 deletions
diff --git a/unittest/Catch/projects/runners/iTchRunner/internal/iTchRunnerReporter.h b/unittest/Catch/projects/runners/iTchRunner/internal/iTchRunnerReporter.h
new file mode 100644
index 0000000..d262886
--- /dev/null
+++ b/unittest/Catch/projects/runners/iTchRunner/internal/iTchRunnerReporter.h
@@ -0,0 +1,115 @@
+/*
+ * iTchRunnerReporter.h
+ * iTchRunner
+ *
+ * Created by Phil on 07/02/2011.
+ * Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
+ *
+ */
+#ifndef TWOBLUECUBES_ITCHRUNNERREPORTER_H_INCLUDED
+#define TWOBLUECUBES_ITCHRUNNERREPORTER_H_INCLUDED
+
+#include "catch.hpp"
+
+@protocol iTchRunnerDelegate
+
+-(void) testWasRun: (const Catch::AssertionResult*) result;
+
+@end
+
+namespace Catch
+{
+ class iTchRunnerReporter : public SharedImpl<IReporter>
+ {
+ public:
+ ///////////////////////////////////////////////////////////////////////////
+ iTchRunnerReporter
+ (
+ id<iTchRunnerDelegate> delegate
+ )
+ : m_delegate( delegate )
+ {
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ virtual bool shouldRedirectStdout
+ ()
+ const
+ {
+ return true;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ static std::string getDescription
+ ()
+ {
+ return "Captures results for iOS runner";
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ size_t getSucceeded
+ ()
+ const
+ {
+ return m_totals.assertions.passed;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ size_t getFailed
+ ()
+ const
+ {
+ return m_totals.assertions.failed;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ void reset()
+ {
+ m_totals = Totals();
+ }
+
+ private: // IReporter
+
+ ///////////////////////////////////////////////////////////////////////////
+ virtual void StartTesting
+ ()
+ {}
+
+ ///////////////////////////////////////////////////////////////////////////
+ virtual void EndTesting
+ (
+ const Totals& totals
+ )
+ {
+ m_totals = totals;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ virtual void Result
+ (
+ const AssertionResult& result
+ )
+ {
+ [m_delegate testWasRun: &result];
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Deliberately unimplemented:
+ virtual void StartGroup( const std::string& ){}
+ virtual void EndGroup( const std::string&, const Totals& ){}
+ virtual void StartTestCase( const TestCaseInfo& ){}
+ virtual void StartSection( const std::string& sectionName, const std::string& description ) {}
+ virtual void EndSection( const std::string&, const Counts& ){}
+ virtual void EndTestCase( const TestCaseInfo&, const Totals&, const std::string&, const std::string& ){}
+ virtual void Aborted() {}
+ virtual void NoAssertionsInSection( std::string const& sectionName ) {}
+ virtual void NoAssertionsInTestCase( std::string const& testName ) {}
+
+ private:
+ Totals m_totals;
+
+ id<iTchRunnerDelegate> m_delegate;
+ };
+}
+
+#endif // TWOBLUECUBES_ITCHRUNNERREPORTER_H_INCLUDED